jal-translate
TypeScript icon, indicating that this package has built-in type declarations

0.0.11 • Public • Published

Installing Translate

The easiest way is to use the Angular CLI to automatically install Translate into your project

ng add jal-translate

Then it should be setup automatically

Manual Installation

If you are unable to use the automatic method above, follow these steps.

Install Translate packages through npm:

npm install jal-translate

Import the TranslateModule into your Angular application's module. Your application's main module might look like this:

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { TranslateModule } from 'jal-translate';
import { AppComponent } from './app.component';

@NgModule({
    imports: [
        BrowserModule,
        TranslateModule.forRoot({ configuration: { }})
        ....
     ],
     declarations: [ AppComponent ],
     bootstrap: [ AppComponent ]
})
export class AppModule {    }

Generate Translation files

You can use the ng generate command to create language files

ng generate jal-translate:language translations\en

The above command would generate the file translations\en.language.ts with some example boiler plate code for setting up your translations.

You would then need to add this language to the configuration in the module.

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { AppComponent } from './app.component';
import { TranslateModule } from 'jal-translate';
import { LANG_EN_NAME } from './translations/en.language';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    TranslateModule.forRoot({ configuration: { en: LANG_EN_NAME }})
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

Readme

Keywords

none

Package Sidebar

Install

npm i jal-translate

Weekly Downloads

1

Version

0.0.11

License

none

Unpacked Size

92.5 kB

Total Files

49

Last publish

Collaborators

  • jdwyer