Skip to content

Celtian/ngx-translate-version

Repository files navigation

NgxTranslateVersion

npm version Package License NPM Downloads Snyk stars forks HitCount

Angular module that provides version to your language files

Angular 17 compatible

Here's the demo

Install

  1. Use yarn (or npm) to install the package
yarn add ngx-translate-version
  1. Add provideTranslateVersion into your config
import { NgxAppVersionModule } from 'ngx-app-version';

export const appConfig: ApplicationConfig = {
  providers: [
    // ...
    provideTranslateVersion(routes, {
      defaultLanguage: 'en',
      version: '1.0.0',
      pathLocales: 'assets/locales.json',
      pathI18n: (lang) => `assets/i18n/${lang}.json`
    })
  ]
};

or module

  import { NgxAppVersionModule } from 'ngx-app-version';

  @NgModule({
   // ...
   providers: [
     // ...
     provideTranslateVersion(routes, {
       defaultLanguage: 'en',
       version: '1.0.0',
       pathLocales: 'assets/locales.json',
       pathI18n: (lang) => `assets/i18n/${lang}.json`
     })
   ]
  })

Options

Option Type Default Description
defaultLanguage string en Default language of your appliceation
version string 0.0.0 Version of your application
pathLocales string assets/locales.json Path to file with locales
pathI18n (lang: string) => string (lang) => assets/i18n/${lang}.json Path to faile with translations

Compatibility

Angular ngx-translate-version Install
17 2.x yarn add ngx-translate-version
16 1.x yarn add ngx-translate-version@1
15 0.x yarn add ngx-translate-version@0

Peer Dependencies

  "@angular/common": ">=17",
  "@angular/core": ">=17",
  "@gilsdav/ngx-translate-router-http-loader": ">=2",
  "@gilsdav/ngx-translate-router": ">=7",
  "@ngx-translate/core": ">=15",
  "@ngx-translate/http-loader": ">=8"

License

Copyright © 2023 - 2024 Dominik Hladik

All contents are licensed under the MIT license.