diff --git a/integration/cli-hello-world-ivy-i18n/angular.json b/integration/cli-hello-world-ivy-i18n/angular.json index b378f28c323de..a1fa39bef1a05 100644 --- a/integration/cli-hello-world-ivy-i18n/angular.json +++ b/integration/cli-hello-world-ivy-i18n/angular.json @@ -4,6 +4,13 @@ "newProjectRoot": "projects", "projects": { "cli-hello-world-ivy-i18n": { + "i18n": { + "locales": { + "fr": "src/locales/messages.fr.json", + "de": "src/locales/messages.de.json" + }, + "sourceLocale": "en" + }, "projectType": "application", "schematics": {}, "root": "", @@ -33,6 +40,7 @@ "tsConfig": "tsconfig.view-engine.json" }, "production": { + "localize": false, // TODO: enable when CLI supports inlining the locale "fileReplacements": [ { "replace": "src/environments/environment.ts", diff --git a/integration/cli-hello-world-ivy-i18n/e2e/de/app.e2e-spec.ts b/integration/cli-hello-world-ivy-i18n/e2e/de/app.e2e-spec.ts index 01e204429a037..0bc71b5b29ad3 100644 --- a/integration/cli-hello-world-ivy-i18n/e2e/de/app.e2e-spec.ts +++ b/integration/cli-hello-world-ivy-i18n/e2e/de/app.e2e-spec.ts @@ -14,4 +14,13 @@ describe('cli-hello-world-ivy App', () => { it('should display welcome message', () => { expect(page.getParagraph('message')).toEqual('Willkommen in der i18n App. (inline)'); }); + + it('should display the locale', () => { expect(page.getParagraph('locale')).toEqual('de'); }); + + // TODO : Re-enable when CLI translation inlining supports locale inlining (and so we can use it + // to load the correct locale data) + xit('the date pipe should show the localized month', () => { + page.navigateTo(); + expect(page.getParagraph('date')).toEqual('Januar'); + }); }); diff --git a/integration/cli-hello-world-ivy-i18n/e2e/en/app.e2e-spec.ts b/integration/cli-hello-world-ivy-i18n/e2e/en/app.e2e-spec.ts index 6e2d8873480b1..b7935f18cb957 100644 --- a/integration/cli-hello-world-ivy-i18n/e2e/en/app.e2e-spec.ts +++ b/integration/cli-hello-world-ivy-i18n/e2e/en/app.e2e-spec.ts @@ -12,4 +12,11 @@ describe('cli-hello-world-ivy App', () => { it('should display welcome message', () => { expect(page.getParagraph('message')).toEqual('Welcome to the i18n app.'); }); + + it('should display the locale', () => { expect(page.getParagraph('locale')).toEqual('en-US'); }); + + it('the date pipe should show the localized month', () => { + page.navigateTo(); + expect(page.getParagraph('date')).toEqual('January'); + }); }); diff --git a/integration/cli-hello-world-ivy-i18n/e2e/fr/app.e2e-spec.ts b/integration/cli-hello-world-ivy-i18n/e2e/fr/app.e2e-spec.ts index 92ef7023b8799..795b80e169e9f 100644 --- a/integration/cli-hello-world-ivy-i18n/e2e/fr/app.e2e-spec.ts +++ b/integration/cli-hello-world-ivy-i18n/e2e/fr/app.e2e-spec.ts @@ -13,4 +13,11 @@ describe('cli-hello-world-ivy App', () => { it('should display welcome message', () => { expect(page.getParagraph('message')).toEqual('Bienvenue sur l\'application i18n. (inline)'); }); + + it('should display the locale', () => { expect(page.getParagraph('locale')).toEqual('fr'); }); + + it('the date pipe should show the localized month', () => { + page.navigateTo(); + expect(page.getParagraph('date')).toEqual('janvier'); + }); }); diff --git a/integration/cli-hello-world-ivy-i18n/e2e/legacy/app.e2e-spec.ts b/integration/cli-hello-world-ivy-i18n/e2e/legacy/app.e2e-spec.ts index 0cebeb71abb0f..f6d0ef2441e6b 100644 --- a/integration/cli-hello-world-ivy-i18n/e2e/legacy/app.e2e-spec.ts +++ b/integration/cli-hello-world-ivy-i18n/e2e/legacy/app.e2e-spec.ts @@ -15,4 +15,6 @@ describe('cli-hello-world-ivy App', () => { // See "translated:legacy:extract-and-update" in package.json. expect(page.getParagraph('message')).toEqual('Welcome to the i18n app.'); }); + + it('should display the locale', () => { expect(page.getParagraph('locale')).toEqual('fr'); }); }); diff --git a/integration/cli-hello-world-ivy-i18n/e2e/runtime/app.e2e-spec.ts b/integration/cli-hello-world-ivy-i18n/e2e/runtime/app.e2e-spec.ts index ee4bd999a4f0e..9ba4217c404e5 100644 --- a/integration/cli-hello-world-ivy-i18n/e2e/runtime/app.e2e-spec.ts +++ b/integration/cli-hello-world-ivy-i18n/e2e/runtime/app.e2e-spec.ts @@ -19,4 +19,11 @@ describe('cli-hello-world-ivy App', () => { page.navigateTo(); expect(page.getParagraph('pipe')).toEqual('100 % awesome'); }); + + it('should display the locale', () => { expect(page.getParagraph('locale')).toEqual('fr'); }); + + it('the date pipe should show the localized month', () => { + page.navigateTo(); + expect(page.getParagraph('date')).toEqual('janvier'); + }); }); diff --git a/integration/cli-hello-world-ivy-i18n/package.json b/integration/cli-hello-world-ivy-i18n/package.json index 89b17898dd6ae..b1225ffb7952e 100644 --- a/integration/cli-hello-world-ivy-i18n/package.json +++ b/integration/cli-hello-world-ivy-i18n/package.json @@ -13,18 +13,13 @@ "pretest": "ng version", "test": "ng test && yarn e2e --configuration=ci && yarn e2e --configuration=ci-production && yarn translated:test && yarn translated:legacy:test", "translate": "localize-translate -r \"dist/\" -s \"**/*\" -l \"en-US\" -t \"src/locales/messages.*\" -o \"../tmp/translations/{{LOCALE}}\"", - "translated:test": "yarn build && yarn translate && yarn translated:fr:e2e && yarn translated:de:e2e && yarn translated:en:e2e", - "translated:fr:serve": "serve ../tmp/translations/fr --listen 4200", "translated:fr:e2e": "npm-run-all -p -r translated:fr:serve \"ng e2e --configuration=translated-fr\"", - "translated:de:serve": "serve ../tmp/translations/de --listen 4200", "translated:de:e2e": "npm-run-all -p -r translated:de:serve \"ng e2e --configuration=translated-de\"", - "translated:en:serve": "serve ../tmp/translations/en-US --listen 4200", "translated:en:e2e": "npm-run-all -p -r translated:en:serve \"ng e2e --configuration=translated-en\"", - "translated:legacy:test": "yarn translated:legacy:extract-and-update && ng build --configuration=translated-legacy && yarn translated:legacy:translate && yarn translated:legacy:e2e", "translated:legacy:extract-and-update": "ng xi18n && sed -i.bak -e 's/source>/target>'/ -e 's/Hello/Bonjour/' -e 's/source-language=\"en-US\"/source-language=\"en-US\" target-language=\"legacy\"/' ../tmp/legacy-locales/messages.legacy.xlf", "translated:legacy:translate": "localize-translate -r \"dist/\" -s \"**/*\" -t \"../tmp/legacy-locales/messages.legacy.xlf\" -o \"../tmp/translations/{{LOCALE}}\"", @@ -50,8 +45,8 @@ "zone.js": "file:../../node_modules/zone.js" }, "devDependencies": { - "@angular-devkit/build-angular": "0.900.0-next.12", - "@angular/cli": "file:../../node_modules/@angular/cli", + "@angular-devkit/build-angular": "^0.900.0-next.14", + "@angular/cli": "^9.0.0-next.14", "@angular/compiler-cli": "file:../../dist/packages-dist/compiler-cli", "@angular/language-service": "file:../../dist/packages-dist/language-service", "@types/jasmine": "~3.4.0", diff --git a/integration/cli-hello-world-ivy-i18n/src/app/app.component.html b/integration/cli-hello-world-ivy-i18n/src/app/app.component.html index e91a085d47249..7bee9429e1695 100644 --- a/integration/cli-hello-world-ivy-i18n/src/app/app.component.html +++ b/integration/cli-hello-world-ivy-i18n/src/app/app.component.html @@ -7,7 +7,9 @@

{{ message }}

Angular Logo +

{{ locale }}

{{ 1 | percent }} awesome

+

{{ jan | date : 'LLLL' }}

Here are some links to help you start: