Class: OtaClient
Constructors
constructor
• new OtaClient(distributionHash
, config?
)
Parameters
Name | Type | Description |
---|---|---|
distributionHash | string | hash of released Crowdin project distribution |
config? | ClientConfig | client config |
Defined in
Strings Management Methods
getStringByKey
▸ getStringByKey(key
, languageCode?
): Promise
<any
>
Returns translation string for language for given key
Parameters
Name | Type | Description |
---|---|---|
key | string | string [] | path to the translation string in json file |
languageCode? | string | Language Code |
Returns
Promise
<any
>
Defined in
getStrings
▸ getStrings(): Promise
<LanguageStrings
>
Returns translation strings from json-based files for all languages
Returns
Promise
<LanguageStrings
>
Defined in
getStringsByLocale
▸ getStringsByLocale(languageCode?
): Promise
<any
>
Returns translation strings from json-based files for a given language
Parameters
Name | Type | Description |
---|---|---|
languageCode? | string | Language Code |
Returns
Promise
<any
>
Defined in
Content Management Methods
getContent
▸ getContent(): Promise
<{ [languageCode: string]
: string
[]; }>
List distribution's files content
Returns
Promise
<{ [languageCode: string]
: string
[]; }>
Defined in
getFileTranslations
▸ getFileTranslations(file
): Promise
<any
>
Returns translations for a specific file (content)
Parameters
Name | Type | Description |
---|---|---|
file | string | file content path |
Returns
Promise
<any
>
Defined in
getLanguageContent
▸ getLanguageContent(languageCode?
): Promise
<string
[]>
List distribution's files content for a specific language
Parameters
Name | Type | Description |
---|---|---|
languageCode? | string | Language Code |
Returns
Promise
<string
[]>
Defined in
getLanguageTranslations
▸ getLanguageTranslations(languageCode?
): Promise
<LanguageTranslations
[]>
Returns translations for each file in the distribution for a given language
Parameters
Name | Type | Description |
---|---|---|
languageCode? | string | Language Code |
Returns
Promise
<LanguageTranslations
[]>
Defined in
getTranslations
▸ getTranslations(): Promise
<Translations
>
Returns all translations per each language code
Returns
Promise
<Translations
>
Defined in
Helper Methods
clearStringsCache
▸ clearStringsCache(): void
Clear the translation string cache
Returns
void
Defined in
getCurrentLocale
▸ getCurrentLocale(): undefined
| string
Get the current locale
Returns
undefined
| string
Defined in
getHash
▸ getHash(): string
Get the distribution hash
Returns
string
Defined in
getManifestTimestamp
▸ getManifestTimestamp(): Promise
<number
>
Get manifest timestamp of distribution
Returns
Promise
<number
>
Defined in
listLanguages
▸ listLanguages(): Promise
<string
[]>
List Crowdin project language codes
Returns
Promise
<string
[]>
Defined in
setCurrentLocale
▸ setCurrentLocale(languageCode?
): void
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
Name | Type | Description |
---|---|---|
languageCode? | string | Language Code |
Returns
void