Methods
(static) clearCache(endpoint)
Clears the cache.
Parameters:
Name | Type | Description |
---|---|---|
endpoint |
string | specified API non-default endpoint (optional) |
(async, static) getTranslation(codes, endpoint) → {Promise.<any>}
Returns translation i18n data
Parameters:
Name | Type | Description |
---|---|---|
codes |
object | object containing lc and cc |
endpoint |
string | endpoint to fetch data from (optional) |
Returns:
Translation data
- Type
- Promise.<any>
Example
import { TranslationAPI } from '@carbon/ibmdotcom-services';
async function getTranslation() {
const response = await TranslationAPI.getTranslation({
lc: 'en',
cc: 'us',
});
return response;
}