Tolgee for Angular provides a simple API to create a multi-lingual Angular application. With Tolgee i18n library for Angular, you can enjoy all Tolgee i18n features.
To see Angular with Tolgee in action, check this example app.
npm i @tolgee/ngx
Get started!
1. Create project in Tolgee platform
Go to Tolgee Cloud app or access your self-hosted instance and create a project. Then obtain your API key.
2. Setup Tolgee integration
Install the npm packages.
npm i @tolgee/ngx
Then import NgxTolgeeModule in your app
import {
DevTools,
NgxTolgeeModule,
Tolgee,
TOLGEE_INSTANCE,
FormatSimple
} from '@tolgee/ngx';
...
@NgModule({
declarations: [
...
],
imports: [
NgxTolgeeModule,
...
],
providers: [
{
provide: TOLGEE_INSTANCE,
useFactory: () => {
return Tolgee()
.use(DevTools())
.use(FormatSimple())
.init({
language: 'en'
apiUrl: environment.tolgeeApiUrl,
apiKey: environment.tolgeeApiKey,
});
},
},
],
...
})
export class AppModule {}
3. Use elements with the "t" attribute to translate
<h1 t key="translate_me" default="Translate me!"></h1>
Now you are able to Alt + Click & translate your texts!