@andreasnicolaou/locale-translator
TypeScript icon, indicating that this package has built-in type declarations

1.0.6 • Public • Published

locale-translator

Translate any locale with the directive provided or the service



npm npm npm



Installation

1. Install via NPM:

npm i --save @andreasnicolaou/locale-translator

3. Import LocaleTranslationsModule into your app's root module

import { LocaleTranslationsModule } from '@andreasnicolaou/locale-translator';

@NgModule({
  ...
  imports: [
    LocaleTranslationsModule
  ],
  ...
})
export class AppModule { }

If you only want to use only the service just import

import { LocaleTranslationsService } from '@andreasnicolaou/locale-translator';

...

export class MyService {

  constructor(private locale: LocaleTranslationsService) {
    this.locale.updateLocale('en', { name: 'English', nativeName: 'Engish'})
    let locale: LangTrans  = this.locale.getLanguage('en');
    console.log(locale) // name,nativeName

  }

}



Example of pipe

Pipe will always return the locale name, if you want the native name just add translateLocale:true

    <a>{{'en' | translateLocale}}</a>

Contribution

  • Having an issue? or looking for support? Open an issue and we will get you the help you need.
  • Got a new feature or a bug fix? Fork the repo, make your changes, and submit a pull request.

Support this project

If you find this project useful, please star the repo to let people know that it's reliable. Also, share it with friends and colleagues that might find this useful as well. Thank you 😄

Readme

Keywords

none

Package Sidebar

Install

npm i @andreasnicolaou/locale-translator

Weekly Downloads

2

Version

1.0.6

License

MIT

Unpacked Size

426 kB

Total Files

32

Last publish

Collaborators

  • nteris