mirror of
https://github.com/marcogll/passkit-generator.git
synced 2026-03-15 18:25:24 +00:00
Added documentation for localize function;
Added check for translation type (must be an object)
This commit is contained in:
13
index.js
13
index.js
@@ -118,13 +118,22 @@ class Pass {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
|
* Adds traslated strings object to the list of translation to be inserted into the pass
|
||||||
|
*
|
||||||
|
* @method localize
|
||||||
|
* @params {String} lang - the ISO 3166 alpha-2 code for the language
|
||||||
|
* @params {Object} translations - key/value pairs where key is the
|
||||||
|
* string appearing in pass.json and value the translated string
|
||||||
|
*
|
||||||
|
* @see https://apple.co/2KOv0OW - Passes support localization
|
||||||
*/
|
*/
|
||||||
|
|
||||||
localize(lang, translations) {
|
localize(lang, translations) {
|
||||||
|
if (typeof translations === "object") {
|
||||||
this.l10n[lang] = translations;
|
this.l10n[lang] = translations;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_generateStringFile(lang) {
|
_generateStringFile(lang) {
|
||||||
if (this.l10n[lang] === undefined || !Object.keys(this.l10n[lang]).length) {
|
if (this.l10n[lang] === undefined || !Object.keys(this.l10n[lang]).length) {
|
||||||
|
|||||||
Reference in New Issue
Block a user