Class: OtaClient
Defined in: index.ts:8
Constructors
new OtaClient()
new OtaClient(
distributionHash
,config
?):OtaClient
Defined in: index.ts:27
Parameters
Parameter | Type | Description |
---|---|---|
distributionHash | string | Hash of released Crowdin project distribution |
config ? | ClientConfig | Client config |
Returns
Strings Management Methods
getStrings()
getStrings():
Promise
<LanguageStrings
>
Defined in: index.ts:170
Get all translation strings for all languages.
Returns
Promise
<LanguageStrings
>
Translation strings from json-based files for all languages
getStringsByLocale()
getStringsByLocale(
languageCode
?):Promise
<any
>
Defined in: index.ts:189
Get translation strings for a specific language.
Parameters
Parameter | Type | Description |
---|---|---|
languageCode ? | string | Language Code |
Returns
Promise
<any
>
Translation strings from json-based files for a given language
getStringByKey()
getStringByKey(
key
,languageCode
?):Promise
<any
>
Defined in: index.ts:204
Get translation string for a specific key.
Parameters
Parameter | Type | Description |
---|---|---|
key | string | string [] | path to the translation string in json file |
languageCode ? | string | Language Code |
Returns
Promise
<any
>
Translation string for language for given key
Content Management Methods
getContent()
getContent():
Promise
<{}>
Defined in: index.ts:80
List distribution's files content.
Returns
Promise
<{}>
An object mapping Language Code to arrays of strings: {[languageCode: string]: string[]}
getLanguageContent()
getLanguageContent(
languageCode
?):Promise
<string
[]>
Defined in: index.ts:91
List distribution's files content for a specific language.
Parameters
Parameter | Type | Description |
---|---|---|
languageCode ? | string | Language Code |
Returns
Promise
<string
[]>
getTranslations()
getTranslations():
Promise
<Translations
>
Defined in: index.ts:113
Get all translations for all languages.
Returns
Promise
<Translations
>
All translations per each language code
getLanguageTranslations()
getLanguageTranslations(
languageCode
?):Promise
<LanguageTranslations
[]>
Defined in: index.ts:132
Get translations for a specific language.
Parameters
Parameter | Type | Description |
---|---|---|
languageCode ? | string | Language Code |
Returns
Promise
<LanguageTranslations
[]>
Translations for each file in the distribution for a given language (content)
getFileTranslations()
getFileTranslations(
file
):Promise
<any
>
Defined in: index.ts:152
Get translations for a specific file.
Parameters
Parameter | Type | Description |
---|---|---|
file | string | file content path |
Returns
Promise
<any
>
Translations for a specific file (content)
Helper Methods
getHash()
getHash():
string
Defined in: index.ts:40
Get the distribution hash.
Returns
string
setCurrentLocale()
setCurrentLocale(
languageCode
?):void
Defined in: index.ts:51
Define the global language for the client instance. Default language code to be used if language was not passed as an input argument of the method.
Parameters
Parameter | Type | Description |
---|---|---|
languageCode ? | string | Language Code |
Returns
void
getCurrentLocale()
getCurrentLocale():
undefined
|string
Defined in: index.ts:60
Get the current locale of the client instance.
Returns
undefined
| string
getManifestTimestamp()
getManifestTimestamp():
Promise
<number
>
Defined in: index.ts:69
Get distribution's manifest timestamp.
Returns
Promise
<number
>
listLanguages()
listLanguages():
Promise
<string
[]>
Defined in: index.ts:102
List Crowdin project language codes.
Returns
Promise
<string
[]>
clearStringsCache()
clearStringsCache():
void
Defined in: index.ts:223
Clear the translation strings cache.
Returns
void