Step 1: Setup
Set up the Angular application with a few lines of code. TL8 requires a few very simple changes in your code to enable the super power.
TL8 requires your application to use Ngx-translate. This is how it can modify the translations directly from the running application, inside the TL8 app.
Learn moreSetup your Angular application in a few minutes
1. Add TL8 to your project
npm install --save tl8
2. Add the TL8 module to your application, ideally where you include the TranslateModule of ngx-translate.
import { TL8Module } from 'tl8';
@NgModule({
...
imports: [
...
TranslateModule.forRoot(...),
TL8Module.forRoot({
langs: [
{ lang: 'en', label: 'English' },
{ lang: 'fr', label: 'French' },
{ lang: 'de', label: 'German' },
]
}),
...
],
...
})
export class SharedModule { }
3. Enable all translations through the TL8 pipe
Everywhere you use the translate pipe from ngx-translate, replace it with the tl8 pipe.
'some.key' | tl8