OpenVeo AngularJS back end

API Docs for: 3.0.0
Show:

i18nService

Summary

Defines an internationalization service to manage string translations.

Methods

addDictionary

Syntax

addDictionary

(
  • name
  • [admin]
)
Promise

Summary

Adds a new dictionary, to the translation table, for the current language. A dictionary is referenced by its name and contains a JSON representation of all its translations. If dictionary does not exist yet, get it from the server.

Parameters:

  • name String

    The name of the dictionary to retrieve from server

  • [admin] Boolean optional

    true to retrieve a dictionary for the back office part (which requires authentication), false to get a dictionary without access restriction

Returns:

Promise:

The promise to retrieve the dictionary

destroy

Syntax

destroy

()

Summary

Destroys I18nService cached data.

getDictionary

Syntax

getDictionary

(
  • name
  • language
)
Object

Summary

Gets a dictionary with all its languages or just for the specific language.

Parameters:

  • name String

    The dictionary name

  • language String

    An optional language to retrieve

Returns:

Object:

The translations contained in the dictionary

getLanguage

Syntax

getLanguage

() String

Summary

Gets current language.

Returns:

String:

The current language country code (e.g en-US)

getLanguageName

Syntax

getLanguageName

(
  • language
)
String

Summary

Gets full name of a language by its code.

Parameters:

  • language String

    The language code

Returns:

String:

The language full name

getLanguages

Syntax

getLanguages

() Array

Summary

Gets supported languages.

Returns:

Array:

The list of supported languages

isLanguageSupported

Syntax

isLanguageSupported

(
  • language
)
Boolean

Summary

Tests if a language is supported.

Parameters:

  • language String

    The language code to test

Returns:

Boolean:

true if supported, false otherwise

removeDictionary

Syntax

removeDictionary

(
  • name
)

Summary

Removes a dictionary from cache.

Parameters:

  • name String

    The dictionary name

setLanguage

Syntax

setLanguage

(
  • language
)

Summary

Sets current language.

Parameters:

  • language String

    The current language country code (e.g en-CA)

translate

Syntax

translate

(
  • id
  • [dictionary]
)

Summary

Translates the given id using current language.

Parameters:

  • id String

    The id of the translation

  • [dictionary] String optional

    The name of a particular dictionary if several dictionaries are loaded