i18n

i18n

Source:

Internationalization Methods and template helpers for i18n, translations, right-to-left (RTL) and currency exchange support

Methods

(static) flushTranslationLoad() → {undefined}

Execute the bulk asset operation

Source:
Returns:

No return

Type
undefined

(static) formatPriceString(formatPrice, useDefaultShopCurrency) → {String}

Return shop/locale specific formatted price. Also accepts a range formatted with " - ".

Source:
Parameters:
Name Type Description
formatPrice String

currentPrice or "xx.xx - xx.xx" formatted String

useDefaultShopCurrency Boolean

flag for displaying shop's currency in Admin view of PDP

Returns:

returns locale formatted and exchange rate converted values

Type
String

(static) getBrowserLanguage() → {String}

Detects device default language

Source:
Returns:

language code

Type
String

(static) getLabelsFor(schema, name) → {Object}

Get Labels for simple.schema keys

Source:
Parameters:
Name Type Description
schema Object

schema

name String

name

Returns:

return schema label object

Type
Object

(static) getValidationErrorMessages() → {Object}

Get i18n messages for autoform messages. Currently using a globalMessage namespace only.

  1. Use schema-specific message for specific key
  2. Use schema-specific message for generic key
  3. Use schema-specific message for type

Source:
To Do:
  • Implement messaging hierarchy from simple-schema
Returns:

returns i18n translated message for schema labels

Type
Object

(static) i18n/addTranslation(lng, namespace, key, message) → {String}

Meteor method to add translations

Source:
Example
Meteor.call("i18n/addTranslation", "en", "addProductLabel", "Add product")
Parameters:
Name Type Description
lng String | Array

language

namespace String

namespace

key String

i18n key

message String

i18n message

Returns:

insert result

Type
String

(static) i18n/flushAllTranslations() → {undefined}

Method to remove all translations for all shops, and reload from jsonFiles

Source:
Example
Meteor.call("i18n/flushAllTranslations")
Returns:
Type
undefined

(static) i18n/flushTranslations() → {undefined}

Method to remove all translations for the current shop, and reload from jsonFiles

Source:
Example
Meteor.call("i18n/flushTranslations")
Returns:
Type
undefined

(static) importAllTranslations() → {undefined}

Imports all translations into Assets collection and Translation collection

Source:
Returns:
Type
undefined

(async, static) loadCoreTranslations()

imports i18n json files from private/data/i18n into the Assets collection Assets collection is processed with Reaction.Import after all assets have been loaded.

Source:

(static) loadTranslation(source) → {Boolean}

Server method: Load a single translation object as an Asset loadTranslation should generally be used before startup, to ensure that Assets load.

Source:
Parameters:
Name Type Description
source Object

a json i18next object

Returns:

false if assets weren't loaded

Type
Boolean

(static) loadTranslations(sources) → {Boolean}

Load an array of translation objects and import using loadTranslation

Source:
Parameters:
Name Type Description
sources Object

array of i18next translations

Returns:

false if assets weren't loaded

Type
Boolean

(static) reloadAllTranslations() → {undefined}

Reload translations for all shops

Source:
Returns:
Type
undefined

(static) reloadTranslationsForShop(shopId) → {undefined}

Reload translations for specified shop

Source:
Parameters:
Name Type Description
shopId string

Shop Id to reset translations for

Returns:
Type
undefined