Configuring translations for SPEAK 3 components
Version: 9.0
Sitecore provides translations for the SPEAK 3 components. To make the component library use these translations, you must specify some configuration settings.
You must use a set of keys and values that the SPEAK 3 component library expects and supports.
For example, in a JSON format:
RequestResponse
{
"ADD_TO_FAVORITES": "Add to favorites",
"BACK": "back",
"LOG_OUT": "Log out",
"REMOVE_FROM_FAVORITES": "Remove from favorites"
}
The Integrate SPEAK 3 applications with Sitecore topic describes the recommended configuration.
Configuration
The SPEAK 3 components expect applications to provide an Observable object with translations by using an Angular InjectionToken. The ng-sc npm package can provide this Observable object, as in the following example.
In app.module.ts:
RequestResponse
import { SciBclDictionaryFactory, SciBclDictionaryModule, SciBclDictionaryService } from '@speak/ng-sc/bcl-dictionary';
import { DICTIONARY } from '@speak/ng-bcl';
...
imports: [
SciBclDictionaryModule
],
providers: [
{ provide: DICTIONARY, useFactory: SciBclDictionaryFactory, deps:[SciBclDictionaryService] }
]
...