API Docs for: 1.0.0
Show:

eZ.CAPI Class

eZ JavaScript REST Client. See https://github.com/ezsystems/ez-js-rest-client

Constructor

Methods

_findPosixLocaleByPrefix

(
  • prefix
  • localesMap
  • e.g.
)
private

Returns the POSIX Locale matching the prefix

Parameters:

  • prefix String

    e.g. 'fr'

  • localesMap Object

    the locales map for the property

  • e.g. String

    'fr_fr'

_getExistingPropertyLanguages

(
  • property
  • e.g.
)
private

Returns an array containing the existing Locale in which the property exists.

Parameters:

  • property Object
  • e.g. Array

    ['fre-FR', 'eng-GB']

_getLocalesMap

(
  • fullLocalesMap
  • property
)
Object private

Creates a locales map for the languages in which the property exists.

Parameters:

  • fullLocalesMap Object
  • property Object

Returns:

Object:

an Object containing the locale indexed by normalized POSIX locales

_getNavigatorPosixLocales

() Array private

Returns an array containing the normalized POSIX locale configured in the browser.

Returns:

Array:

e.g. ['fr_fr', 'en_en', 'en']

_normalizeNavigatorLanguage

(
  • lang
)
String private

Normalizes browser's language

Parameters:

  • lang String

    the language e.g. 'fr-FR'

Returns:

String:

translateProperty

(
  • fullLocalesMap
  • property
)
String

Find the correct property translation according to browser's languages configuration. It basically iterates over the browser's languages to find a matching translation, if none matches, it takes the first one.

Parameters:

  • fullLocalesMap Object

    the Locales map between POSIX Locales (e.g.) fr_FR and Locales used in eZ Platform (e.g. fre-FR)

  • property Object

    the property to translate as a hash indexed by eZ Locale for example:

    {'eng-GB': 'potatoes', 'fre-FR': 'pomme de terre'}

Returns:

String:

Attributes

navigator

Navigator readonly

Holds a reference to the navigator object.