https://github.com/andreasnicolaou/locale-translator
Translate any locale with the provided pipe or service.
https://github.com/andreasnicolaou/locale-translator
locales locales-translation
Last synced: 14 days ago
JSON representation
Translate any locale with the provided pipe or service.
- Host: GitHub
- URL: https://github.com/andreasnicolaou/locale-translator
- Owner: andreasnicolaou
- Created: 2020-02-25T18:39:13.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2025-03-06T23:16:54.000Z (about 2 months ago)
- Last Synced: 2025-04-05T22:32:51.711Z (23 days ago)
- Topics: locales, locales-translation
- Language: TypeScript
- Homepage:
- Size: 30.3 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-angular - locale-translator - Translate any locale with the provided pipe or service. (Table of contents / Angular)
- fucking-awesome-angular - locale-translator - Translate any locale with the provided pipe or service. (Table of contents / Angular)
README
# locale-translator
Translate any locale with the provided pipe or service.
[](https://www.npmjs.com/package/@andreasnicolaou/locale-translator)
## Installation
```shell
npm install @andreasnicolaou/locale-translator
```#### Import `LocaleTranslationsModule` into your app's root module
```typescriptimport { LocaleTranslationsModule } from '@andreasnicolaou/locale-translator';
@NgModule({
...
imports: [
LocaleTranslationsModule
],
...
})
export class AppModule { }```
If you only want to use only the service just import
```typescript
import { LocaleTranslationsService } from '@andreasnicolaou/locale-translator';...
export class MyComponent {
constructor(private readonly localeTranslationsService: LocaleTranslationsService) {
const locale: LangTrans = this.localeTranslationsService.getLanguage('en');
console.log(locale) // Logs out name and nativeName
}
}
```### Example of pipe
#### Pipe will always return the locale name, if you want the native name just add translateLocale:true
```html
{{ 'en' | translateLocale }}
``````html
{{ 'en' | translateLocale:true }}
```## Contribution
- **Having an issue**? or looking for support? [Open an issue](https://github.com/andreasnicolaou/locale-translator/issues/new) 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: