Back to Top

ipret master

Micro i18n js library. No dependencies.

utils()

Returns

Void

exports.setStrings(lang, str)

Sets translations for a specific langauge.

Parameters

Name Type Description
lang string

Language code, e.g. 'tr' or 'en'.

str Object

{'string': 'translation'} translation pairs.

Returns

Void

exports.setLanguage(lang)

Updates active language.

Parameters

Name Type Description
lang string

Language code, e.g. 'tr' or 'en'.

Returns

Void

exports.translate(string)

Translates a string to active language.

Parameters

Name Type Description
string String

String to be translated.

Returns

String

Translated output.

exports.getLanguage()

Active language code.

Returns

String

Active language.

exports.getLanguages()

All languages.

Returns

Array

Language keys

slice()

Returns

Void

exports.stringFormat(str, args)

String format function.

Parameters

Name Type Description
str String

String to be formatted

args

Format params

Returns

Void