Skip to content

Latest commit

 

History

History
94 lines (75 loc) · 2.04 KB

README.md

File metadata and controls

94 lines (75 loc) · 2.04 KB

JioTranslate for Angular
The JioTranslate i18n SDK for Angular

What's JioTranslate for Angular?

Angular integration library of JioTranslate. With this package. It's super simple to add i18n to your Angular app!

Installation

npm install @jiotranslate/ngx-beta

Then use the library in your app.module.ts. You have to add NgxJioTranslateModule to your imports section and add factory provider for JIOTRANSLATE_INSTANCE token returning your JioTranslate instance.

...
import {
  DevTools,
  NgxJioTranslateModule,
  JioTranslate,
  JIOTRANSLATE_INSTANCE,
  FormatSimple
} from '@jiotranslate/ngx-beta';
...
@NgModule({
  declarations: [
    ...
  ],
  imports: [
    NgxJioTranslateModule,
    ...
  ],
  providers: [
    {
      provide: JIOTRANSLATE_INSTANCE,
      useFactory: () => {
        return JioTranslate()
          .use(DevTools())
          .use(FormatSimple())
          .init({
            language: 'en'

            // for development
            apiUrl: environment.jiotranslateApiUrl,
            apiKey: environment.jiotranslateApiKey,

            // for production
            staticData: {
              ...
            }
          });
      },
    },
  ],
  bootstrap: [AppComponent],
})
export class AppModule {}

Usage

Translating using pipe:

<h1>{{"hello_world" | jiotms}}</h1>

Or using jio-tms attribute

<h1 jio-tms key="providing_default_values"></h1>

Prerequisites

  1. An existing Angular project
  2. An API key obtained from JioTranslate Platform.

Why use JioTranslate?

It saves you a significant amount of time on localization tasks. It also ensures your software is perfectly translated.

Features

  • Comprehensive localization solution tailored for your JavaScript application 🙌
  • Seamless localization right from the start 🎉
  • Translation management system 🎈