├── tutorial.png ├── ngx-translate-demo-standalone-icu ├── src │ ├── styles.scss │ ├── main.ts │ ├── index.html │ └── app │ │ ├── app.scss │ │ ├── app.ts │ │ ├── app.config.ts │ │ └── app.html ├── public │ ├── favicon.ico │ └── i18n │ │ ├── en.json │ │ └── de.json ├── .vscode │ ├── extensions.json │ ├── launch.json │ └── tasks.json ├── .editorconfig ├── tsconfig.spec.json ├── tsconfig.app.json ├── .gitignore ├── tsconfig.json ├── eslint.config.js ├── package.json ├── README.md ├── angular.json └── translations.babel ├── ngx-translate-demo-standalone ├── src │ ├── styles.scss │ ├── main.ts │ ├── index.html │ └── app │ │ ├── app.scss │ │ ├── app.html │ │ ├── static-translation-loader.ts │ │ ├── app.config.ts │ │ ├── app.spec.ts │ │ └── app.ts ├── public │ ├── favicon.ico │ └── i18n │ │ ├── en.json │ │ └── de.json ├── .vscode │ ├── extensions.json │ ├── launch.json │ └── tasks.json ├── .editorconfig ├── tsconfig.spec.json ├── tsconfig.app.json ├── .gitignore ├── tsconfig.json ├── eslint.config.js ├── package.json ├── README.md ├── angular.json └── translations.babel ├── .editorconfig ├── .gitignore └── README.md /tutorial.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeAndWeb/ngx-translate-demo/HEAD/tutorial.png -------------------------------------------------------------------------------- /ngx-translate-demo-standalone-icu/src/styles.scss: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | -------------------------------------------------------------------------------- /ngx-translate-demo-standalone/src/styles.scss: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | -------------------------------------------------------------------------------- /ngx-translate-demo-standalone/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeAndWeb/ngx-translate-demo/HEAD/ngx-translate-demo-standalone/public/favicon.ico -------------------------------------------------------------------------------- /ngx-translate-demo-standalone-icu/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeAndWeb/ngx-translate-demo/HEAD/ngx-translate-demo-standalone-icu/public/favicon.ico -------------------------------------------------------------------------------- /ngx-translate-demo-standalone-icu/.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=827846 3 | "recommendations": ["angular.ng-template"] 4 | } 5 | -------------------------------------------------------------------------------- /ngx-translate-demo-standalone/.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=827846 3 | "recommendations": ["angular.ng-template"] 4 | } 5 | -------------------------------------------------------------------------------- /ngx-translate-demo-standalone/src/main.ts: -------------------------------------------------------------------------------- 1 | import { bootstrapApplication } from '@angular/platform-browser'; 2 | import { appConfig } from './app/app.config'; 3 | import { App } from './app/app'; 4 | 5 | bootstrapApplication(App, appConfig) 6 | .catch((err) => console.error(err)); 7 | -------------------------------------------------------------------------------- /ngx-translate-demo-standalone-icu/src/main.ts: -------------------------------------------------------------------------------- 1 | import { bootstrapApplication } from '@angular/platform-browser'; 2 | import { appConfig } from './app/app.config'; 3 | import { App } from './app/app'; 4 | 5 | bootstrapApplication(App, appConfig) 6 | .catch((err) => console.error(err)); 7 | -------------------------------------------------------------------------------- /ngx-translate-demo-standalone-icu/public/i18n/en.json: -------------------------------------------------------------------------------- 1 | { 2 | "icu": { 3 | "pluralization": "There {count, plural, =0{is no apple} one{is one apple} other{there are several apples}}.", 4 | "select": "{gender, select, male{He uses} female{She uses} other{They use }} {product}" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /ngx-translate-demo-standalone-icu/public/i18n/de.json: -------------------------------------------------------------------------------- 1 | { 2 | "icu": { 3 | "pluralization": "Da {count, plural, =0{ist kein Apfel} one{ist ein Apfel} other{sind mehrere Äpfel}}.", 4 | "select": "{gender, select, male{Er verwendet} female{Sie verwendet} other{Sie verwenden }} {product}." 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | max_line_length = off 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /ngx-translate-demo-standalone/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | TranslationDemoStandalone 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /ngx-translate-demo-standalone-icu/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | TranslationDemoStandalone 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /ngx-translate-demo-standalone/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see https://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.ts] 12 | quote_type = single 13 | ij_typescript_use_double_quotes = false 14 | 15 | [*.md] 16 | max_line_length = off 17 | trim_trailing_whitespace = false 18 | -------------------------------------------------------------------------------- /ngx-translate-demo-standalone-icu/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see https://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.ts] 12 | quote_type = single 13 | ij_typescript_use_double_quotes = false 14 | 15 | [*.md] 16 | max_line_length = off 17 | trim_trailing_whitespace = false 18 | -------------------------------------------------------------------------------- /ngx-translate-demo-standalone/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */ 2 | /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */ 3 | { 4 | "extends": "./tsconfig.json", 5 | "compilerOptions": { 6 | "outDir": "./out-tsc/spec", 7 | "types": [ 8 | "jasmine" 9 | ] 10 | }, 11 | "include": [ 12 | "src/**/*.ts" 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /ngx-translate-demo-standalone-icu/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */ 2 | /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */ 3 | { 4 | "extends": "./tsconfig.json", 5 | "compilerOptions": { 6 | "outDir": "./out-tsc/spec", 7 | "types": [ 8 | "jasmine" 9 | ] 10 | }, 11 | "include": [ 12 | "src/**/*.ts" 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /ngx-translate-demo-standalone/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */ 2 | /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */ 3 | { 4 | "extends": "./tsconfig.json", 5 | "compilerOptions": { 6 | "outDir": "./out-tsc/app", 7 | "types": [] 8 | }, 9 | "include": [ 10 | "src/**/*.ts" 11 | ], 12 | "exclude": [ 13 | "src/**/*.spec.ts" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /ngx-translate-demo-standalone-icu/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */ 2 | /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */ 3 | { 4 | "extends": "./tsconfig.json", 5 | "compilerOptions": { 6 | "outDir": "./out-tsc/app", 7 | "types": [] 8 | }, 9 | "include": [ 10 | "src/**/*.ts" 11 | ], 12 | "exclude": [ 13 | "src/**/*.spec.ts" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /ngx-translate-demo-standalone/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 3 | "version": "0.2.0", 4 | "configurations": [ 5 | { 6 | "name": "ng serve", 7 | "type": "chrome", 8 | "request": "launch", 9 | "preLaunchTask": "npm: start", 10 | "url": "http://localhost:4200/" 11 | }, 12 | { 13 | "name": "ng test", 14 | "type": "chrome", 15 | "request": "launch", 16 | "preLaunchTask": "npm: test", 17 | "url": "http://localhost:9876/debug.html" 18 | } 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /ngx-translate-demo-standalone-icu/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 3 | "version": "0.2.0", 4 | "configurations": [ 5 | { 6 | "name": "ng serve", 7 | "type": "chrome", 8 | "request": "launch", 9 | "preLaunchTask": "npm: start", 10 | "url": "http://localhost:4200/" 11 | }, 12 | { 13 | "name": "ng test", 14 | "type": "chrome", 15 | "request": "launch", 16 | "preLaunchTask": "npm: test", 17 | "url": "http://localhost:9876/debug.html" 18 | } 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /ngx-translate-demo-standalone/public/i18n/en.json: -------------------------------------------------------------------------------- 1 | { 2 | "demo.interpolation.attribute-with-parameters": "Attribute with parameter: Hello {{name}}!", 3 | "demo.interpolation.id-as-content-with-parameters": "ID as content with parameter: Hello {{name}}!", 4 | "demo.interpolation.instant": "Instant with parameter: Hello {{name}}!", 5 | "demo.interpolation.pipe-with-parameters": "Pipe with parameter: Hello {{name}}!", 6 | "demo.simple.text-as-attribute": "A simple text passing the ID as attribute.", 7 | "demo.simple.text-as-content": "A simple test using the ID as content.", 8 | "demo.simple.text-with-pipe": "A simple text using the pipe.", 9 | "demo.title": "Translation Demo" 10 | } 11 | -------------------------------------------------------------------------------- /ngx-translate-demo-standalone/public/i18n/de.json: -------------------------------------------------------------------------------- 1 | { 2 | "demo.interpolation.attribute-with-parameters": "Attribut mit Parameter: Hallo {{name}}!", 3 | "demo.interpolation.id-as-content-with-parameters": "ID als Inhalt mit Parameter: Hallo {{name}}!", 4 | "demo.interpolation.instant": "Instant mit Parameter: Hallo {{name}}!", 5 | "demo.interpolation.pipe-with-parameters": "Pipe mit Parameter: Hallo {{name}}!", 6 | "demo.simple.text-as-attribute": "Ein einfacher Text, der die ID als Attribut enthält.", 7 | "demo.simple.text-as-content": "Ein einfacher Test mit der ID als Inhalt.", 8 | "demo.simple.text-with-pipe": "Ein einfacher Text unter Verwendung der Pipe.", 9 | "demo.title": "Übersetzungs Demo" 10 | } 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /dist-server 6 | /tmp 7 | /out-tsc 8 | 9 | # dependencies 10 | /node_modules 11 | 12 | # IDEs and editors 13 | /.idea 14 | .project 15 | .classpath 16 | .c9/ 17 | *.launch 18 | .settings/ 19 | *.sublime-workspace 20 | 21 | # IDE - VSCode 22 | .vscode/* 23 | !.vscode/settings.json 24 | !.vscode/tasks.json 25 | !.vscode/launch.json 26 | !.vscode/extensions.json 27 | 28 | # misc 29 | /.sass-cache 30 | /connect.lock 31 | /coverage 32 | /libpeerconnection.log 33 | npm-debug.log 34 | yarn-error.log 35 | testem.log 36 | /typings 37 | 38 | # e2e 39 | /e2e/*.js 40 | /e2e/*.map 41 | 42 | # System Files 43 | .DS_Store 44 | Thumbs.db 45 | 46 | -------------------------------------------------------------------------------- /ngx-translate-demo-standalone/src/app/app.scss: -------------------------------------------------------------------------------- 1 | div { 2 | font-family: Arial, Helvetica, sans-serif; 3 | margin: 0; 4 | padding: 1rem 2rem; 5 | } 6 | 7 | p, .translated { 8 | background-color: #d4f3ff; 9 | padding: 0.5rem 1rem; 10 | } 11 | 12 | button { 13 | background-color: #008CBA; 14 | border: none; 15 | color: white; 16 | padding: 0.25rem 0.5rem; 17 | text-align: center; 18 | text-decoration: none; 19 | display: inline-block; 20 | font-size: 16px; 21 | margin-left: 1rem; 22 | border-radius: 0.5rem; 23 | transition: background-color 0.3s ease; 24 | 25 | &:hover { 26 | background-color: #005f73; 27 | } 28 | } 29 | 30 | .title { 31 | background-color: #bde8f8; 32 | padding: 0.5rem 2rem 1.5rem 2rem; 33 | position: sticky; 34 | top: 0; 35 | z-index: 1000; 36 | } -------------------------------------------------------------------------------- /ngx-translate-demo-standalone-icu/src/app/app.scss: -------------------------------------------------------------------------------- 1 | div { 2 | font-family: Arial, Helvetica, sans-serif; 3 | margin: 0; 4 | padding: 1rem 2rem; 5 | } 6 | 7 | p, .translated { 8 | background-color: #d4f3ff; 9 | padding: 0.5rem 1rem; 10 | } 11 | 12 | button { 13 | background-color: #008CBA; 14 | border: none; 15 | color: white; 16 | padding: 0.25rem 0.5rem; 17 | text-align: center; 18 | text-decoration: none; 19 | display: inline-block; 20 | font-size: 16px; 21 | margin-left: 1rem; 22 | border-radius: 0.5rem; 23 | transition: background-color 0.3s ease; 24 | 25 | &:hover { 26 | background-color: #005f73; 27 | } 28 | } 29 | 30 | .title { 31 | background-color: #bde8f8; 32 | padding: 0.5rem 2rem 1.5rem 2rem; 33 | position: sticky; 34 | top: 0; 35 | z-index: 1000; 36 | } -------------------------------------------------------------------------------- /ngx-translate-demo-standalone/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://docs.github.com/get-started/getting-started-with-git/ignoring-files for more about ignoring files. 2 | 3 | # Compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | /bazel-out 8 | 9 | # Node 10 | /node_modules 11 | npm-debug.log 12 | yarn-error.log 13 | 14 | # IDEs and editors 15 | .idea/ 16 | .project 17 | .classpath 18 | .c9/ 19 | *.launch 20 | .settings/ 21 | *.sublime-workspace 22 | 23 | # Visual Studio Code 24 | .vscode/* 25 | !.vscode/settings.json 26 | !.vscode/tasks.json 27 | !.vscode/launch.json 28 | !.vscode/extensions.json 29 | .history/* 30 | 31 | # Miscellaneous 32 | /.angular/cache 33 | .sass-cache/ 34 | /connect.lock 35 | /coverage 36 | /libpeerconnection.log 37 | testem.log 38 | /typings 39 | 40 | # System files 41 | .DS_Store 42 | Thumbs.db 43 | -------------------------------------------------------------------------------- /ngx-translate-demo-standalone-icu/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://docs.github.com/get-started/getting-started-with-git/ignoring-files for more about ignoring files. 2 | 3 | # Compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | /bazel-out 8 | 9 | # Node 10 | /node_modules 11 | npm-debug.log 12 | yarn-error.log 13 | 14 | # IDEs and editors 15 | .idea/ 16 | .project 17 | .classpath 18 | .c9/ 19 | *.launch 20 | .settings/ 21 | *.sublime-workspace 22 | 23 | # Visual Studio Code 24 | .vscode/* 25 | !.vscode/settings.json 26 | !.vscode/tasks.json 27 | !.vscode/launch.json 28 | !.vscode/extensions.json 29 | .history/* 30 | 31 | # Miscellaneous 32 | /.angular/cache 33 | .sass-cache/ 34 | /connect.lock 35 | /coverage 36 | /libpeerconnection.log 37 | testem.log 38 | /typings 39 | 40 | # System files 41 | .DS_Store 42 | Thumbs.db 43 | -------------------------------------------------------------------------------- /ngx-translate-demo-standalone/src/app/app.html: -------------------------------------------------------------------------------- 1 |
2 | 3 |

{{ 'demo.title' | translate }}

4 | 5 | Switch languages at runtime: 6 | 7 | 8 | 9 |
10 |
11 | 12 |

Simple translations without parameters

13 | 14 |

{{ 'demo.simple.text-with-pipe' | translate }}

15 |

16 |

demo.simple.text-as-content

17 | 18 | 19 |

Translations with parameters

20 | 21 |

{{ 'demo.interpolation.pipe-with-parameters' | translate:{name} }}

22 |

23 |

demo.interpolation.id-as-content-with-parameters

24 | 25 |
26 | -------------------------------------------------------------------------------- /ngx-translate-demo-standalone/src/app/static-translation-loader.ts: -------------------------------------------------------------------------------- 1 | import {TranslateLoader, TranslationObject} from "@ngx-translate/core"; 2 | import {Observable, of} from "rxjs"; 3 | 4 | import * as TranslationsDE from "../../public/i18n/de.json"; 5 | import * as TranslationsEN from "../../public/i18n/en.json"; 6 | 7 | 8 | const TRANSLATIONS: Record = { 9 | en: TranslationsEN, 10 | de: TranslationsDE 11 | }; 12 | 13 | 14 | export class StaticTranslationLoader implements TranslateLoader 15 | { 16 | public getTranslation(lang: string): Observable 17 | { 18 | const translation = TRANSLATIONS[lang]; 19 | if (translation) 20 | { 21 | return of(translation); 22 | } 23 | else 24 | { 25 | console.error(`Unknown language: ${lang}`); 26 | return of({}); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /ngx-translate-demo-standalone-icu/src/app/app.ts: -------------------------------------------------------------------------------- 1 | import {Component, inject, signal} from "@angular/core"; 2 | import {_, TranslateDirective, TranslatePipe, TranslateService} from "@ngx-translate/core"; 3 | import {FormsModule} from "@angular/forms"; 4 | 5 | type Gender = 'male'|'female'|'other'; 6 | 7 | @Component({ 8 | selector: 'app-root', 9 | imports: [TranslateDirective, TranslatePipe, FormsModule], 10 | templateUrl: './app.html', 11 | styleUrl: './app.scss' 12 | }) 13 | export class App { 14 | public count = signal(0); 15 | public gender = signal('other'); 16 | 17 | private translate = inject(TranslateService); 18 | 19 | useLanguage(language: string) { 20 | this.translate.use(language); 21 | } 22 | 23 | onGenderChange(event: Event) { 24 | this.gender.set((event.target as HTMLSelectElement).value as Gender); 25 | } 26 | 27 | onCountChange(event: Event) 28 | { 29 | this.count.set(parseInt((event.target as HTMLSelectElement).value)); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /ngx-translate-demo-standalone/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | // For more information, visit: https://go.microsoft.com/fwlink/?LinkId=733558 3 | "version": "2.0.0", 4 | "tasks": [ 5 | { 6 | "type": "npm", 7 | "script": "start", 8 | "isBackground": true, 9 | "problemMatcher": { 10 | "owner": "typescript", 11 | "pattern": "$tsc", 12 | "background": { 13 | "activeOnStart": true, 14 | "beginsPattern": { 15 | "regexp": "(.*?)" 16 | }, 17 | "endsPattern": { 18 | "regexp": "bundle generation complete" 19 | } 20 | } 21 | } 22 | }, 23 | { 24 | "type": "npm", 25 | "script": "test", 26 | "isBackground": true, 27 | "problemMatcher": { 28 | "owner": "typescript", 29 | "pattern": "$tsc", 30 | "background": { 31 | "activeOnStart": true, 32 | "beginsPattern": { 33 | "regexp": "(.*?)" 34 | }, 35 | "endsPattern": { 36 | "regexp": "bundle generation complete" 37 | } 38 | } 39 | } 40 | } 41 | ] 42 | } 43 | -------------------------------------------------------------------------------- /ngx-translate-demo-standalone-icu/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | // For more information, visit: https://go.microsoft.com/fwlink/?LinkId=733558 3 | "version": "2.0.0", 4 | "tasks": [ 5 | { 6 | "type": "npm", 7 | "script": "start", 8 | "isBackground": true, 9 | "problemMatcher": { 10 | "owner": "typescript", 11 | "pattern": "$tsc", 12 | "background": { 13 | "activeOnStart": true, 14 | "beginsPattern": { 15 | "regexp": "(.*?)" 16 | }, 17 | "endsPattern": { 18 | "regexp": "bundle generation complete" 19 | } 20 | } 21 | } 22 | }, 23 | { 24 | "type": "npm", 25 | "script": "test", 26 | "isBackground": true, 27 | "problemMatcher": { 28 | "owner": "typescript", 29 | "pattern": "$tsc", 30 | "background": { 31 | "activeOnStart": true, 32 | "beginsPattern": { 33 | "regexp": "(.*?)" 34 | }, 35 | "endsPattern": { 36 | "regexp": "bundle generation complete" 37 | } 38 | } 39 | } 40 | } 41 | ] 42 | } 43 | -------------------------------------------------------------------------------- /ngx-translate-demo-standalone/src/app/app.config.ts: -------------------------------------------------------------------------------- 1 | import { 2 | ApplicationConfig, 3 | inject, 4 | provideAppInitializer, 5 | provideBrowserGlobalErrorListeners, 6 | provideZoneChangeDetection 7 | } from "@angular/core"; 8 | import {provideHttpClient} from "@angular/common/http"; 9 | import {provideTranslateService, TranslateService} from "@ngx-translate/core"; 10 | import {provideTranslateHttpLoader} from "@ngx-translate/http-loader"; 11 | 12 | 13 | export const appConfig: ApplicationConfig = { 14 | providers: [ 15 | provideBrowserGlobalErrorListeners(), 16 | provideZoneChangeDetection({eventCoalescing: true}), 17 | provideHttpClient(), 18 | provideTranslateService({ 19 | lang: "en", 20 | fallbackLang: "en", 21 | loader: provideTranslateHttpLoader({ 22 | prefix: "/i18n/", 23 | suffix: ".json" 24 | }) 25 | }), 26 | provideAppInitializer(() => 27 | { 28 | const translate = inject(TranslateService); 29 | translate.use(translate.getBrowserLang() || "en"); 30 | }) 31 | ] 32 | }; 33 | -------------------------------------------------------------------------------- /ngx-translate-demo-standalone/tsconfig.json: -------------------------------------------------------------------------------- 1 | /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */ 2 | /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */ 3 | { 4 | "compileOnSave": false, 5 | "compilerOptions": { 6 | "strict": true, 7 | "noImplicitOverride": true, 8 | "noPropertyAccessFromIndexSignature": true, 9 | "noImplicitReturns": true, 10 | "noFallthroughCasesInSwitch": true, 11 | "skipLibCheck": true, 12 | "isolatedModules": true, 13 | "experimentalDecorators": true, 14 | "importHelpers": true, 15 | "target": "ES2022", 16 | "module": "preserve" 17 | }, 18 | "angularCompilerOptions": { 19 | "enableI18nLegacyMessageIdFormat": false, 20 | "strictInjectionParameters": true, 21 | "strictInputAccessModifiers": true, 22 | "typeCheckHostBindings": true, 23 | "strictTemplates": true 24 | }, 25 | "files": [], 26 | "references": [ 27 | { 28 | "path": "./tsconfig.app.json" 29 | }, 30 | { 31 | "path": "./tsconfig.spec.json" 32 | } 33 | ] 34 | } 35 | -------------------------------------------------------------------------------- /ngx-translate-demo-standalone-icu/tsconfig.json: -------------------------------------------------------------------------------- 1 | /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */ 2 | /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */ 3 | { 4 | "compileOnSave": false, 5 | "compilerOptions": { 6 | "strict": true, 7 | "noImplicitOverride": true, 8 | "noPropertyAccessFromIndexSignature": true, 9 | "noImplicitReturns": true, 10 | "noFallthroughCasesInSwitch": true, 11 | "skipLibCheck": true, 12 | "isolatedModules": true, 13 | "experimentalDecorators": true, 14 | "importHelpers": true, 15 | "target": "ES2022", 16 | "module": "preserve" 17 | }, 18 | "angularCompilerOptions": { 19 | "enableI18nLegacyMessageIdFormat": false, 20 | "strictInjectionParameters": true, 21 | "strictInputAccessModifiers": true, 22 | "typeCheckHostBindings": true, 23 | "strictTemplates": true 24 | }, 25 | "files": [], 26 | "references": [ 27 | { 28 | "path": "./tsconfig.app.json" 29 | }, 30 | { 31 | "path": "./tsconfig.spec.json" 32 | } 33 | ] 34 | } 35 | -------------------------------------------------------------------------------- /ngx-translate-demo-standalone/eslint.config.js: -------------------------------------------------------------------------------- 1 | // @ts-check 2 | const eslint = require("@eslint/js"); 3 | const tseslint = require("typescript-eslint"); 4 | const angular = require("angular-eslint"); 5 | 6 | module.exports = tseslint.config( 7 | { 8 | files: ["**/*.ts"], 9 | extends: [ 10 | eslint.configs.recommended, 11 | ...tseslint.configs.recommended, 12 | ...tseslint.configs.stylistic, 13 | ...angular.configs.tsRecommended, 14 | ], 15 | processor: angular.processInlineTemplates, 16 | rules: { 17 | "@angular-eslint/directive-selector": [ 18 | "error", 19 | { 20 | type: "attribute", 21 | prefix: "app", 22 | style: "camelCase", 23 | }, 24 | ], 25 | "@angular-eslint/component-selector": [ 26 | "error", 27 | { 28 | type: "element", 29 | prefix: "app", 30 | style: "kebab-case", 31 | }, 32 | ], 33 | }, 34 | }, 35 | { 36 | files: ["**/*.html"], 37 | extends: [ 38 | ...angular.configs.templateRecommended, 39 | ...angular.configs.templateAccessibility, 40 | ], 41 | rules: {}, 42 | } 43 | ); 44 | -------------------------------------------------------------------------------- /ngx-translate-demo-standalone-icu/eslint.config.js: -------------------------------------------------------------------------------- 1 | // @ts-check 2 | const eslint = require("@eslint/js"); 3 | const tseslint = require("typescript-eslint"); 4 | const angular = require("angular-eslint"); 5 | 6 | module.exports = tseslint.config( 7 | { 8 | files: ["**/*.ts"], 9 | extends: [ 10 | eslint.configs.recommended, 11 | ...tseslint.configs.recommended, 12 | ...tseslint.configs.stylistic, 13 | ...angular.configs.tsRecommended, 14 | ], 15 | processor: angular.processInlineTemplates, 16 | rules: { 17 | "@angular-eslint/directive-selector": [ 18 | "error", 19 | { 20 | type: "attribute", 21 | prefix: "app", 22 | style: "camelCase", 23 | }, 24 | ], 25 | "@angular-eslint/component-selector": [ 26 | "error", 27 | { 28 | type: "element", 29 | prefix: "app", 30 | style: "kebab-case", 31 | }, 32 | ], 33 | }, 34 | }, 35 | { 36 | files: ["**/*.html"], 37 | extends: [ 38 | ...angular.configs.templateRecommended, 39 | ...angular.configs.templateAccessibility, 40 | ], 41 | rules: {}, 42 | } 43 | ); 44 | -------------------------------------------------------------------------------- /ngx-translate-demo-standalone-icu/src/app/app.config.ts: -------------------------------------------------------------------------------- 1 | import { 2 | ApplicationConfig, inject, 3 | provideAppInitializer, 4 | provideBrowserGlobalErrorListeners, 5 | provideZoneChangeDetection 6 | } from "@angular/core"; 7 | import {provideHttpClient} from "@angular/common/http"; 8 | import {provideTranslateService, TranslateCompiler, TranslateService} from "@ngx-translate/core"; 9 | import {provideTranslateHttpLoader} from "@ngx-translate/http-loader"; 10 | import { TranslateMessageFormatCompiler, MESSAGE_FORMAT_CONFIG } from "ngx-translate-messageformat-compiler"; 11 | 12 | export const appConfig: ApplicationConfig = { 13 | providers: [ 14 | provideBrowserGlobalErrorListeners(), 15 | provideZoneChangeDetection({ eventCoalescing: true }), 16 | provideHttpClient(), 17 | provideTranslateService({ 18 | lang: 'en', 19 | fallbackLang: 'en', 20 | loader: provideTranslateHttpLoader({ 21 | prefix: '/i18n/', 22 | suffix: '.json' 23 | }), 24 | compiler: { 25 | provide: TranslateCompiler, 26 | useClass: TranslateMessageFormatCompiler, 27 | }, 28 | }), 29 | provideAppInitializer(() => { 30 | const translate = inject(TranslateService); 31 | translate.addLangs(["de", "en"]); 32 | }), 33 | ] 34 | }; 35 | -------------------------------------------------------------------------------- /ngx-translate-demo-standalone-icu/src/app/app.html: -------------------------------------------------------------------------------- 1 |
2 |

ngx-translate message format compiler demo

3 | 4 | Switch languages at runtime: 5 | 6 | 7 |
8 | 9 |
10 |

Pluralization

11 | 12 | 13 | 18 | 19 |

icu.pluralization

20 |

{{'icu.pluralization' | translate:{ count } }}

21 | 22 |

Selection

23 | 24 | 25 | 30 | 31 |

icu.select

32 |

{{'icu.select' | translate:{ gender, 'product': 'BabelEdit' } }}

33 |
34 | -------------------------------------------------------------------------------- /ngx-translate-demo-standalone/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ngx-translate-demo-standalone", 3 | "version": "0.0.0", 4 | "scripts": { 5 | "ng": "ng", 6 | "start": "ng serve", 7 | "build": "ng build", 8 | "watch": "ng build --watch --configuration development", 9 | "test": "ng test", 10 | "lint": "ng lint" 11 | }, 12 | "prettier": { 13 | "overrides": [ 14 | { 15 | "files": "*.html", 16 | "options": { 17 | "parser": "angular" 18 | } 19 | } 20 | ] 21 | }, 22 | "private": true, 23 | "dependencies": { 24 | "@angular/common": "^20.1.0", 25 | "@angular/compiler": "^20.1.0", 26 | "@angular/core": "^20.1.0", 27 | "@angular/forms": "^20.1.0", 28 | "@angular/platform-browser": "^20.1.0", 29 | "@angular/router": "^20.1.0", 30 | "@ngx-translate/core": "^17.0.0", 31 | "@ngx-translate/http-loader": "^17.0.0", 32 | "rxjs": "~7.8.0", 33 | "tslib": "^2.3.0", 34 | "zone.js": "~0.15.0" 35 | }, 36 | "devDependencies": { 37 | "@angular/build": "^20.1.3", 38 | "@angular/cli": "^20.1.3", 39 | "@angular/compiler-cli": "^20.1.0", 40 | "@types/jasmine": "~5.1.0", 41 | "angular-eslint": "20.1.1", 42 | "eslint": "^9.29.0", 43 | "jasmine-core": "~5.8.0", 44 | "karma": "~6.4.0", 45 | "karma-chrome-launcher": "~3.2.0", 46 | "karma-coverage": "~2.2.0", 47 | "karma-jasmine": "~5.1.0", 48 | "karma-jasmine-html-reporter": "~2.1.0", 49 | "typescript": "~5.8.2", 50 | "typescript-eslint": "8.34.1" 51 | } 52 | } -------------------------------------------------------------------------------- /ngx-translate-demo-standalone-icu/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ngx-translate-demo-standalone", 3 | "version": "0.0.0", 4 | "scripts": { 5 | "ng": "ng", 6 | "start": "ng serve", 7 | "build": "ng build", 8 | "watch": "ng build --watch --configuration development", 9 | "test": "ng test", 10 | "lint": "ng lint" 11 | }, 12 | "prettier": { 13 | "overrides": [ 14 | { 15 | "files": "*.html", 16 | "options": { 17 | "parser": "angular" 18 | } 19 | } 20 | ] 21 | }, 22 | "private": true, 23 | "dependencies": { 24 | "@angular/common": "^20.1.0", 25 | "@angular/compiler": "^20.1.0", 26 | "@angular/core": "^20.1.0", 27 | "@angular/forms": "^20.1.0", 28 | "@angular/platform-browser": "^20.1.0", 29 | "@angular/router": "^20.1.0", 30 | "@ngx-translate/core": "^17.0.0", 31 | "@ngx-translate/http-loader": "^17.0.0", 32 | "rxjs": "~7.8.0", 33 | "tslib": "^2.3.0", 34 | "zone.js": "~0.15.0" 35 | }, 36 | "devDependencies": { 37 | "@angular/build": "^20.1.3", 38 | "@angular/cli": "^20.1.3", 39 | "@angular/compiler-cli": "^20.1.0", 40 | "@types/jasmine": "~5.1.0", 41 | "angular-eslint": "20.1.1", 42 | "eslint": "^9.29.0", 43 | "jasmine-core": "~5.8.0", 44 | "karma": "~6.4.0", 45 | "karma-chrome-launcher": "~3.2.0", 46 | "karma-coverage": "~2.2.0", 47 | "karma-jasmine": "~5.1.0", 48 | "karma-jasmine-html-reporter": "~2.1.0", 49 | "typescript": "~5.8.2", 50 | "typescript-eslint": "8.34.1" 51 | } 52 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # How to translate your Angular application 2 | 3 | 4 | Tutorial Image 5 | 6 | 7 | Simple 3 demo projects for Angular and ngx-translate. 8 | 9 | - **ngx-translate-demo-standalone** - uses standalone components 10 | - **ngx-translate-demo-standalone** - uses standalone modules and the ngx-translate-messageformat-compiler plugin to use ICU formatted translation messages 11 | - **ngx-translate-demo-ngmodules** - uses ngModules (app.module.ts) 12 | 13 | Read the tutorial [How to translate your Angular app with ngx-translate](https://www.codeandweb.com/babeledit/tutorials/how-to-translate-your-angular-app-with-ngx-translate) for more information about how to use ngx-translate, ngx-translate-extract and BabelEdit. 14 | 15 | The repository also contains demo projects working with Angular 20. 16 | 17 | The demo is also available for older Angular versions from 5-19: Please check the branches. 18 | 19 | Tutorials for the older version of Angular: 20 | 21 | * [How to translate your Angular 8-16 app with ngx-translate](https://www.codeandweb.com/babeledit/tutorials/how-to-translate-your-angular8-16-app-with-ngx-translate) 22 | * [How to translate your Angular 7 app with ngx-translate](https://www.codeandweb.com/babeledit/tutorials/how-to-translate-your-angular7-app-with-ngx-translate) 23 | * [How to translate your Angular 5/6 app with ngx-translate](https://www.codeandweb.com/babeledit/tutorials/how-to-translate-your-angular6-app-with-ngx-translate) 24 | 25 | -------------------------------------------------------------------------------- /ngx-translate-demo-standalone-icu/README.md: -------------------------------------------------------------------------------- 1 | # NgxTranslateDemoStandalone 2 | 3 | This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 20.1.3. 4 | 5 | ## Development server 6 | 7 | To start a local development server, run: 8 | 9 | ```bash 10 | ng serve 11 | ``` 12 | 13 | Once the server is running, open your browser and navigate to `http://localhost:4200/`. The application will automatically reload whenever you modify any of the source files. 14 | 15 | ## Code scaffolding 16 | 17 | Angular CLI includes powerful code scaffolding tools. To generate a new component, run: 18 | 19 | ```bash 20 | ng generate component component-name 21 | ``` 22 | 23 | For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run: 24 | 25 | ```bash 26 | ng generate --help 27 | ``` 28 | 29 | ## Building 30 | 31 | To build the project run: 32 | 33 | ```bash 34 | ng build 35 | ``` 36 | 37 | This will compile your project and store the build artifacts in the `dist/` directory. By default, the production build optimizes your application for performance and speed. 38 | 39 | ## Running unit tests 40 | 41 | To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command: 42 | 43 | ```bash 44 | ng test 45 | ``` 46 | 47 | ## Running end-to-end tests 48 | 49 | For end-to-end (e2e) testing, run: 50 | 51 | ```bash 52 | ng e2e 53 | ``` 54 | 55 | Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs. 56 | 57 | ## Additional Resources 58 | 59 | For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page. 60 | -------------------------------------------------------------------------------- /ngx-translate-demo-standalone/README.md: -------------------------------------------------------------------------------- 1 | # NgxTranslateDemoStandalone 2 | 3 | This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 20.1.3. 4 | 5 | ## Development server 6 | 7 | To start a local development server, run: 8 | 9 | ```bash 10 | ng serve 11 | ``` 12 | 13 | Once the server is running, open your browser and navigate to `http://localhost:4200/`. The application will automatically reload whenever you modify any of the source files. 14 | 15 | ## Code scaffolding 16 | 17 | Angular CLI includes powerful code scaffolding tools. To generate a new component, run: 18 | 19 | ```bash 20 | ng generate component component-name 21 | ``` 22 | 23 | For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run: 24 | 25 | ```bash 26 | ng generate --help 27 | ``` 28 | 29 | ## Building 30 | 31 | To build the project run: 32 | 33 | ```bash 34 | ng build 35 | ``` 36 | 37 | This will compile your project and store the build artifacts in the `dist/` directory. By default, the production build optimizes your application for performance and speed. 38 | 39 | ## Running unit tests 40 | 41 | To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command: 42 | 43 | ```bash 44 | ng test 45 | ``` 46 | 47 | ## Running end-to-end tests 48 | 49 | For end-to-end (e2e) testing, run: 50 | 51 | ```bash 52 | ng e2e 53 | ``` 54 | 55 | Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs. 56 | 57 | ## Additional Resources 58 | 59 | For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page. 60 | -------------------------------------------------------------------------------- /ngx-translate-demo-standalone/src/app/app.spec.ts: -------------------------------------------------------------------------------- 1 | import {TestBed} from "@angular/core/testing"; 2 | import {App} from "./app"; 3 | import {provideTranslateLoader, provideTranslateService, TranslateService} from "@ngx-translate/core"; 4 | import {StaticTranslationLoader} from "./static-translation-loader"; 5 | 6 | 7 | describe("App", () => 8 | { 9 | beforeEach(async () => 10 | { 11 | await TestBed.configureTestingModule({ 12 | imports: [App], 13 | providers: [ 14 | provideTranslateService({ 15 | loader: provideTranslateLoader(StaticTranslationLoader), 16 | lang: "en" 17 | }) 18 | ] 19 | }).compileComponents(); 20 | }); 21 | 22 | it("should create the app", () => 23 | { 24 | const fixture = TestBed.createComponent(App); 25 | const app = fixture.componentInstance; 26 | expect(app).toBeTruthy(); 27 | }); 28 | 29 | it("should render title in english (default)", () => 30 | { 31 | const fixture = TestBed.createComponent(App); 32 | fixture.detectChanges(); 33 | const compiled = fixture.nativeElement as HTMLElement; 34 | expect(compiled.querySelector("h1")?.textContent).toContain("Translation Demo"); 35 | }); 36 | 37 | it("should render title in german", () => 38 | { 39 | const fixture = TestBed.createComponent(App); 40 | 41 | const translateService = TestBed.inject(TranslateService); 42 | translateService.use("de"); 43 | 44 | fixture.detectChanges(); 45 | const compiled = fixture.nativeElement as HTMLElement; 46 | expect(compiled.querySelector("h1")?.textContent).toContain("Übersetzungs Demo"); 47 | }); 48 | 49 | }); 50 | -------------------------------------------------------------------------------- /ngx-translate-demo-standalone/src/app/app.ts: -------------------------------------------------------------------------------- 1 | import {Component, inject, OnDestroy, OnInit} from "@angular/core"; 2 | import {Subscription} from "rxjs"; 3 | import {_, TranslateDirective, TranslatePipe, TranslateService} from "@ngx-translate/core"; 4 | 5 | 6 | @Component({ 7 | selector: "app-root", 8 | imports: [ 9 | TranslatePipe, 10 | TranslateDirective 11 | ], 12 | templateUrl: "./app.html", 13 | styleUrl: "./app.scss" 14 | }) 15 | export class App implements OnInit, OnDestroy 16 | { 17 | private translate = inject(TranslateService); 18 | name = "Andreas"; 19 | 20 | private subscription?: Subscription; 21 | 22 | ngOnInit(): void 23 | { 24 | this.translate.get(_("demo.interpolation.instant"), {name: "John"}) 25 | .subscribe((text: string) => 26 | { 27 | console.log(`using get(): ${text}`); 28 | }); 29 | 30 | const text2 = this.translate.instant(_("demo.interpolation.instant"), {name: "John"}); 31 | console.log(`using instant() too early: ${text2}`); 32 | 33 | this.translate.use(this.translate.getCurrentLang()) 34 | .subscribe(() => 35 | { 36 | // instant can be used after the language is loaded 37 | // we wait for it by setting the current language again 38 | // the observable emits as soon as the language is loaded 39 | const text2 = this.translate.instant(_("demo.interpolation.instant"), {name: "John"}); 40 | console.log(`using instant() after loading is done: ${text2}`); 41 | }); 42 | 43 | this.subscription = this.translate.stream(_("demo.interpolation.instant"), {name: "John"}) 44 | .subscribe((text: string) => 45 | { 46 | console.log(`using stream(): ${text}`); 47 | }); 48 | } 49 | 50 | ngOnDestroy(): void 51 | { 52 | this.subscription?.unsubscribe(); 53 | } 54 | 55 | useLanguage(language: string): void 56 | { 57 | this.translate.use(language); 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /ngx-translate-demo-standalone-icu/angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "ngx-translate-demo-standalone": { 7 | "projectType": "application", 8 | "schematics": { 9 | "@schematics/angular:component": { 10 | "style": "scss" 11 | } 12 | }, 13 | "root": "", 14 | "sourceRoot": "src", 15 | "prefix": "app", 16 | "architect": { 17 | "build": { 18 | "builder": "@angular/build:application", 19 | "options": { 20 | "browser": "src/main.ts", 21 | "polyfills": [ 22 | "zone.js" 23 | ], 24 | "tsConfig": "tsconfig.app.json", 25 | "inlineStyleLanguage": "scss", 26 | "assets": [ 27 | { 28 | "glob": "**/*", 29 | "input": "public" 30 | } 31 | ], 32 | "styles": [ 33 | "src/styles.scss" 34 | ] 35 | }, 36 | "configurations": { 37 | "production": { 38 | "budgets": [ 39 | { 40 | "type": "initial", 41 | "maximumWarning": "500kB", 42 | "maximumError": "1MB" 43 | }, 44 | { 45 | "type": "anyComponentStyle", 46 | "maximumWarning": "4kB", 47 | "maximumError": "8kB" 48 | } 49 | ], 50 | "outputHashing": "all" 51 | }, 52 | "development": { 53 | "optimization": false, 54 | "extractLicenses": false, 55 | "sourceMap": true 56 | } 57 | }, 58 | "defaultConfiguration": "production" 59 | }, 60 | "serve": { 61 | "builder": "@angular/build:dev-server", 62 | "configurations": { 63 | "production": { 64 | "buildTarget": "ngx-translate-demo-standalone:build:production" 65 | }, 66 | "development": { 67 | "buildTarget": "ngx-translate-demo-standalone:build:development" 68 | } 69 | }, 70 | "defaultConfiguration": "development" 71 | }, 72 | "extract-i18n": { 73 | "builder": "@angular/build:extract-i18n" 74 | }, 75 | "test": { 76 | "builder": "@angular/build:karma", 77 | "options": { 78 | "polyfills": [ 79 | "zone.js", 80 | "zone.js/testing" 81 | ], 82 | "tsConfig": "tsconfig.spec.json", 83 | "inlineStyleLanguage": "scss", 84 | "assets": [ 85 | { 86 | "glob": "**/*", 87 | "input": "public" 88 | } 89 | ], 90 | "styles": [ 91 | "src/styles.scss" 92 | ] 93 | } 94 | }, 95 | "lint": { 96 | "builder": "@angular-eslint/builder:lint", 97 | "options": { 98 | "lintFilePatterns": [ 99 | "src/**/*.ts", 100 | "src/**/*.html" 101 | ] 102 | } 103 | } 104 | } 105 | } 106 | }, 107 | "cli": { 108 | "schematicCollections": [ 109 | "angular-eslint" 110 | ] 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /ngx-translate-demo-standalone/angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "ngx-translate-demo-standalone": { 7 | "projectType": "application", 8 | "schematics": { 9 | "@schematics/angular:component": { 10 | "style": "scss" 11 | } 12 | }, 13 | "root": "", 14 | "sourceRoot": "src", 15 | "prefix": "app", 16 | "architect": { 17 | "build": { 18 | "builder": "@angular/build:application", 19 | "options": { 20 | "browser": "src/main.ts", 21 | "polyfills": [ 22 | "zone.js" 23 | ], 24 | "tsConfig": "tsconfig.app.json", 25 | "inlineStyleLanguage": "scss", 26 | "assets": [ 27 | { 28 | "glob": "**/*", 29 | "input": "public" 30 | } 31 | ], 32 | "styles": [ 33 | "src/styles.scss" 34 | ] 35 | }, 36 | "configurations": { 37 | "production": { 38 | "budgets": [ 39 | { 40 | "type": "initial", 41 | "maximumWarning": "500kB", 42 | "maximumError": "1MB" 43 | }, 44 | { 45 | "type": "anyComponentStyle", 46 | "maximumWarning": "4kB", 47 | "maximumError": "8kB" 48 | } 49 | ], 50 | "outputHashing": "all" 51 | }, 52 | "development": { 53 | "optimization": false, 54 | "extractLicenses": false, 55 | "sourceMap": true 56 | } 57 | }, 58 | "defaultConfiguration": "production" 59 | }, 60 | "serve": { 61 | "builder": "@angular/build:dev-server", 62 | "configurations": { 63 | "production": { 64 | "buildTarget": "ngx-translate-demo-standalone:build:production" 65 | }, 66 | "development": { 67 | "buildTarget": "ngx-translate-demo-standalone:build:development" 68 | } 69 | }, 70 | "defaultConfiguration": "development" 71 | }, 72 | "extract-i18n": { 73 | "builder": "@angular/build:extract-i18n" 74 | }, 75 | "test": { 76 | "builder": "@angular/build:karma", 77 | "options": { 78 | "polyfills": [ 79 | "zone.js", 80 | "zone.js/testing" 81 | ], 82 | "tsConfig": "tsconfig.spec.json", 83 | "inlineStyleLanguage": "scss", 84 | "assets": [ 85 | { 86 | "glob": "**/*", 87 | "input": "public" 88 | } 89 | ], 90 | "styles": [ 91 | "src/styles.scss" 92 | ] 93 | } 94 | }, 95 | "lint": { 96 | "builder": "@angular-eslint/builder:lint", 97 | "options": { 98 | "lintFilePatterns": [ 99 | "src/**/*.ts", 100 | "src/**/*.html" 101 | ] 102 | } 103 | } 104 | } 105 | } 106 | }, 107 | "cli": { 108 | "schematicCollections": [ 109 | "angular-eslint" 110 | ] 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /ngx-translate-demo-standalone/translations.babel: -------------------------------------------------------------------------------- 1 | 2 | 3 | 12 | 13 | ngx-translate 14 | translations.babel 15 | . 16 | 17 | 18 | 19 | 20 | main 21 | 22 | 23 | demo.interpolation.attribute-with-parameters 24 | 25 | 26 | 27 | 28 | de-DE 29 | false 30 | 31 | 32 | en-US 33 | false 34 | 35 | 36 | 37 | 38 | demo.interpolation.id-as-content-with-parameters 39 | 40 | 41 | 42 | 43 | de-DE 44 | false 45 | 46 | 47 | en-US 48 | false 49 | 50 | 51 | 52 | 53 | demo.interpolation.instant 54 | 55 | 56 | 57 | 58 | de-DE 59 | false 60 | 61 | 62 | en-US 63 | false 64 | 65 | 66 | 67 | 68 | demo.interpolation.pipe-with-parameters 69 | 70 | 71 | 72 | 73 | de-DE 74 | false 75 | 76 | 77 | en-US 78 | false 79 | 80 | 81 | 82 | 83 | demo.simple.text-as-attribute 84 | 85 | 86 | 87 | 88 | de-DE 89 | false 90 | 91 | 92 | en-US 93 | false 94 | 95 | 96 | 97 | 98 | demo.simple.text-as-content 99 | 100 | 101 | 102 | 103 | de-DE 104 | false 105 | 106 | 107 | en-US 108 | false 109 | 110 | 111 | 112 | 113 | demo.simple.text-with-pipe 114 | 115 | 116 | 117 | 118 | de-DE 119 | false 120 | 121 | 122 | en-US 123 | false 124 | 125 | 126 | 127 | 128 | demo.title 129 | 130 | 131 | 132 | 133 | de-DE 134 | false 135 | 136 | 137 | en-US 138 | false 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | false 147 | false 148 | 149 | 150 | de-DE 151 | 152 | 153 | en-US 154 | 155 | 156 | 157 | 158 | main 159 | 160 | 161 | public/i18n/de.json 162 | de-DE 163 | 164 | 165 | public/i18n/en.json 166 | en-US 167 | 168 | 169 | 170 | 171 | 172 | true 173 | alphabetically 174 | 175 | {{'%1' | translate}} 176 | [translate]="'%1'" 177 | _('%1') 178 | 179 | 180 | 181 | default 182 | 183 | 184 | en-US 185 | 186 | tab 187 | namespaced-json 188 | true 189 | 190 | 191 | -------------------------------------------------------------------------------- /ngx-translate-demo-standalone-icu/translations.babel: -------------------------------------------------------------------------------- 1 | 2 | 3 | 12 | 13 | ngx-translate 14 | translations.babel 15 | . 16 | 17 | 18 | 19 | 20 | main 21 | 22 | 23 | demo 24 | 25 | 26 | interpolation 27 | 28 | 29 | attribute-with-parameters 30 | 31 | 32 | 33 | 34 | de-DE 35 | false 36 | 37 | 38 | en-US 39 | false 40 | 41 | 42 | 43 | 44 | id-as-content-with-parameters 45 | 46 | 47 | 48 | 49 | de-DE 50 | false 51 | 52 | 53 | en-US 54 | false 55 | 56 | 57 | 58 | 59 | instant 60 | 61 | 62 | 63 | 64 | de-DE 65 | false 66 | 67 | 68 | en-US 69 | false 70 | 71 | 72 | 73 | 74 | pipe-with-parameters 75 | 76 | 77 | 78 | 79 | de-DE 80 | false 81 | 82 | 83 | en-US 84 | false 85 | 86 | 87 | 88 | 89 | 90 | 91 | simple 92 | 93 | 94 | text-as-attribute 95 | 96 | 97 | 98 | 99 | de-DE 100 | false 101 | 102 | 103 | en-US 104 | false 105 | 106 | 107 | 108 | 109 | text-as-content 110 | 111 | 112 | 113 | 114 | de-DE 115 | false 116 | 117 | 118 | en-US 119 | false 120 | 121 | 122 | 123 | 124 | text-with-pipe 125 | 126 | 127 | 128 | 129 | de-DE 130 | false 131 | 132 | 133 | en-US 134 | false 135 | 136 | 137 | 138 | 139 | 140 | 141 | title 142 | 143 | 144 | 145 | 146 | de-DE 147 | false 148 | 149 | 150 | en-US 151 | false 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | false 162 | false 163 | 164 | 165 | de-DE 166 | 167 | 168 | en-US 169 | 170 | 171 | 172 | 173 | main 174 | 175 | 176 | public/i18n/de.json 177 | de-DE 178 | 179 | 180 | public/i18n/en.json 181 | en-US 182 | 183 | 184 | 185 | 186 | 187 | true 188 | alphabetically 189 | 190 | {{'%1' | translate}} 191 | [translate]="'%1'" 192 | _('%1') 193 | 194 | 195 | 196 | default 197 | 198 | 199 | en-US 200 | 201 | tab 202 | namespaced-json 203 | true 204 | 205 | 206 | --------------------------------------------------------------------------------