@andreasnicolaou/locale-translator
v1.0.6
Published
Locale Translation
Downloads
10
Readme
locale-translator
Translate any locale with the directive provided or the service
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 :smile: