diff options
author | Chocobozzz <me@florianbigard.com> | 2020-02-07 15:51:19 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-02-10 16:39:28 +0100 |
commit | 361dcebc75dea74947b6c3aafd9d7d720c054b01 (patch) | |
tree | 5edf2a0d871097ba7da2b974b8ccdef9c6b73261 | |
parent | f77eb73b5e02bed9e223dafc1c203ceb7c05b6e5 (diff) | |
download | PeerTube-361dcebc75dea74947b6c3aafd9d7d720c054b01.tar.gz PeerTube-361dcebc75dea74947b6c3aafd9d7d720c054b01.tar.zst PeerTube-361dcebc75dea74947b6c3aafd9d7d720c054b01.zip |
Support i18n build
-rw-r--r-- | client/angular.json | 167 | ||||
-rw-r--r-- | client/package.json | 2 | ||||
-rw-r--r-- | client/src/app/app.module.ts | 13 | ||||
-rw-r--r-- | client/src/environments/environment.ts | 3 | ||||
-rw-r--r-- | client/src/main.ts | 28 | ||||
-rw-r--r-- | client/tsconfig.app.json | 5 | ||||
-rw-r--r-- | client/yarn.lock | 54 | ||||
-rwxr-xr-x | scripts/build/client.sh | 40 | ||||
-rwxr-xr-x | scripts/dev/client.sh | 2 |
9 files changed, 264 insertions, 50 deletions
diff --git a/client/angular.json b/client/angular.json index f3f146bcb..bf3a860aa 100644 --- a/client/angular.json +++ b/client/angular.json | |||
@@ -7,12 +7,108 @@ | |||
7 | "root": "", | 7 | "root": "", |
8 | "sourceRoot": "src", | 8 | "sourceRoot": "src", |
9 | "projectType": "application", | 9 | "projectType": "application", |
10 | "i18n": { | ||
11 | "sourceLocale": "en", | ||
12 | "locales": { | ||
13 | "hu": { | ||
14 | "translation": "src/locale/angular.hu-HU.xlf", | ||
15 | "baseHref": "/" | ||
16 | }, | ||
17 | "th": { | ||
18 | "translation": "src/locale/angular.th-TH.xlf", | ||
19 | "baseHref": "/" | ||
20 | }, | ||
21 | "fi": { | ||
22 | "translation": "src/locale/angular.fi-FI.xlf", | ||
23 | "baseHref": "/" | ||
24 | }, | ||
25 | "nl": { | ||
26 | "translation": "src/locale/angular.nl-NL.xlf", | ||
27 | "baseHref": "/" | ||
28 | }, | ||
29 | "gd": { | ||
30 | "translation": "src/locale/angular.gd.xlf", | ||
31 | "baseHref": "/" | ||
32 | }, | ||
33 | "el": { | ||
34 | "translation": "src/locale/angular.el-GR.xlf", | ||
35 | "baseHref": "/" | ||
36 | }, | ||
37 | "es": { | ||
38 | "translation": "src/locale/angular.es-ES.xlf", | ||
39 | "baseHref": "/" | ||
40 | }, | ||
41 | "oc": { | ||
42 | "translation": "src/locale/angular.oc.xlf", | ||
43 | "baseHref": "/" | ||
44 | }, | ||
45 | "pt": { | ||
46 | "translation": "src/locale/angular.pt-BR.xlf", | ||
47 | "baseHref": "/" | ||
48 | }, | ||
49 | "pt-PT": { | ||
50 | "translation": "src/locale/angular.pt-PT.xlf", | ||
51 | "baseHref": "/" | ||
52 | }, | ||
53 | "sv": { | ||
54 | "translation": "src/locale/angular.sv-SE.xlf", | ||
55 | "baseHref": "/" | ||
56 | }, | ||
57 | "pl": { | ||
58 | "translation": "src/locale/angular.pl-PL.xlf", | ||
59 | "baseHref": "/" | ||
60 | }, | ||
61 | "ru": { | ||
62 | "translation": "src/locale/angular.ru-RU.xlf", | ||
63 | "baseHref": "/" | ||
64 | }, | ||
65 | "zh-Hans": { | ||
66 | "translation": "src/locale/angular.zh-Hans-CN.xlf", | ||
67 | "baseHref": "/" | ||
68 | }, | ||
69 | "zh-Hant": { | ||
70 | "translation": "src/locale/angular.zh-Hant-TW.xlf", | ||
71 | "baseHref": "/" | ||
72 | }, | ||
73 | "fr": { | ||
74 | "translation": "src/locale/angular.fr-FR.xlf", | ||
75 | "baseHref": "/" | ||
76 | }, | ||
77 | "ja": { | ||
78 | "translation": "src/locale/angular.ja-JP.xlf", | ||
79 | "baseHref": "/" | ||
80 | }, | ||
81 | "eu": { | ||
82 | "translation": "src/locale/angular.eu-ES.xlf", | ||
83 | "baseHref": "/" | ||
84 | }, | ||
85 | "ca": { | ||
86 | "translation": "src/locale/angular.ca-ES.xlf", | ||
87 | "baseHref": "/" | ||
88 | }, | ||
89 | "cs": { | ||
90 | "translation": "src/locale/angular.cs-CZ.xlf", | ||
91 | "baseHref": "/" | ||
92 | }, | ||
93 | "eo": { | ||
94 | "translation": "src/locale/angular.eo.xlf", | ||
95 | "baseHref": "/" | ||
96 | }, | ||
97 | "de": { | ||
98 | "translation": "src/locale/angular.de-DE.xlf", | ||
99 | "baseHref": "/" | ||
100 | }, | ||
101 | "it": { | ||
102 | "translation": "src/locale/angular.it-IT.xlf", | ||
103 | "baseHref": "/" | ||
104 | } | ||
105 | } | ||
106 | }, | ||
10 | "architect": { | 107 | "architect": { |
11 | "build": { | 108 | "build": { |
12 | "builder": "@angular-devkit/build-angular:browser", | 109 | "builder": "@angular-devkit/build-angular:browser", |
13 | "options": { | 110 | "options": { |
14 | "aot": true, | 111 | "aot": true, |
15 | "deployUrl": "client/", | ||
16 | "outputPath": "dist", | 112 | "outputPath": "dist", |
17 | "index": "src/index.html", | 113 | "index": "src/index.html", |
18 | "main": "src/main.ts", | 114 | "main": "src/main.ts", |
@@ -91,6 +187,75 @@ | |||
91 | "with": "src/environments/environment.e2e.ts" | 187 | "with": "src/environments/environment.e2e.ts" |
92 | } | 188 | } |
93 | ] | 189 | ] |
190 | }, | ||
191 | "hu-HU": { | ||
192 | "localize": [ "hu" ] | ||
193 | }, | ||
194 | "th-TH": { | ||
195 | "localize": [ "th" ] | ||
196 | }, | ||
197 | "fi-FI": { | ||
198 | "localize": [ "fi" ] | ||
199 | }, | ||
200 | "nl-NL": { | ||
201 | "localize": [ "nl" ] | ||
202 | }, | ||
203 | "gd": { | ||
204 | "localize": [ "gd" ] | ||
205 | }, | ||
206 | "el-GR": { | ||
207 | "localize": [ "el" ] | ||
208 | }, | ||
209 | "es-ES": { | ||
210 | "localize": [ "es" ] | ||
211 | }, | ||
212 | "oc": { | ||
213 | "localize": [ "oc" ] | ||
214 | }, | ||
215 | "pt-BR": { | ||
216 | "localize": [ "pt" ] | ||
217 | }, | ||
218 | "pt-PT": { | ||
219 | "localize": [ "pt-PT" ] | ||
220 | }, | ||
221 | "sv-SE": { | ||
222 | "localize": [ "sv" ] | ||
223 | }, | ||
224 | "pl-PL": { | ||
225 | "localize": [ "pl" ] | ||
226 | }, | ||
227 | "ru-RU": { | ||
228 | "localize": [ "ru" ] | ||
229 | }, | ||
230 | "zh-Hans-CN": { | ||
231 | "localize": [ "zh-Hans" ] | ||
232 | }, | ||
233 | "zh-Hant-TW": { | ||
234 | "localize": [ "zh-Hant" ] | ||
235 | }, | ||
236 | "fr-FR": { | ||
237 | "localize": [ "fr" ] | ||
238 | }, | ||
239 | "ja-JP": { | ||
240 | "localize": [ "ja" ] | ||
241 | }, | ||
242 | "eu-ES": { | ||
243 | "localize": [ "eu" ] | ||
244 | }, | ||
245 | "ca-ES": { | ||
246 | "localize": [ "ca" ] | ||
247 | }, | ||
248 | "cs-CZ": { | ||
249 | "localize": [ "cs" ] | ||
250 | }, | ||
251 | "eo": { | ||
252 | "localize": [ "eo" ] | ||
253 | }, | ||
254 | "de-DE": { | ||
255 | "localize": [ "de" ] | ||
256 | }, | ||
257 | "it-IT": { | ||
258 | "localize": [ "it" ] | ||
94 | } | 259 | } |
95 | } | 260 | } |
96 | }, | 261 | }, |
diff --git a/client/package.json b/client/package.json index de5c0182b..9da34e4e8 100644 --- a/client/package.json +++ b/client/package.json | |||
@@ -48,6 +48,8 @@ | |||
48 | "@angular/router": "~9.0.0", | 48 | "@angular/router": "~9.0.0", |
49 | "@angular/service-worker": "~9.0.0", | 49 | "@angular/service-worker": "~9.0.0", |
50 | "@angularclass/hmr": "^2.1.3", | 50 | "@angularclass/hmr": "^2.1.3", |
51 | "@locl/cli": "^0.0.1-beta.5", | ||
52 | "@locl/core": "^0.0.1-beta.2", | ||
51 | "@neos21/bootstrap3-glyphicons": "^1.0.1", | 53 | "@neos21/bootstrap3-glyphicons": "^1.0.1", |
52 | "@ng-bootstrap/ng-bootstrap": "^5.2.1", | 54 | "@ng-bootstrap/ng-bootstrap": "^5.2.1", |
53 | "@ngx-i18nsupport/ngx-i18nsupport": "^1.1.6", | 55 | "@ngx-i18nsupport/ngx-i18nsupport": "^1.1.6", |
diff --git a/client/src/app/app.module.ts b/client/src/app/app.module.ts index 62915ec54..14fdb7588 100644 --- a/client/src/app/app.module.ts +++ b/client/src/app/app.module.ts | |||
@@ -4,7 +4,6 @@ import { ServerService } from '@app/core' | |||
4 | import { ResetPasswordModule } from '@app/reset-password' | 4 | import { ResetPasswordModule } from '@app/reset-password' |
5 | 5 | ||
6 | import { MetaLoader, MetaModule, MetaStaticLoader, PageTitlePositioning } from '@ngx-meta/core' | 6 | import { MetaLoader, MetaModule, MetaStaticLoader, PageTitlePositioning } from '@ngx-meta/core' |
7 | import { ClipboardModule } from 'ngx-clipboard' | ||
8 | import 'focus-visible' | 7 | import 'focus-visible' |
9 | 8 | ||
10 | import { AppRoutingModule } from './app-routing.module' | 9 | import { AppRoutingModule } from './app-routing.module' |
@@ -15,11 +14,10 @@ import { LoginModule } from './login' | |||
15 | import { AvatarNotificationComponent, LanguageChooserComponent, MenuComponent } from './menu' | 14 | import { AvatarNotificationComponent, LanguageChooserComponent, MenuComponent } from './menu' |
16 | import { SharedModule } from './shared' | 15 | import { SharedModule } from './shared' |
17 | import { VideosModule } from './videos' | 16 | import { VideosModule } from './videos' |
18 | import { buildFileLocale, getCompleteLocale, isDefaultLocale } from '../../../shared/models/i18n' | ||
19 | import { getDevLocale, isOnDevLocale } from '@app/shared/i18n/i18n-utils' | ||
20 | import { SearchModule } from '@app/search' | 17 | import { SearchModule } from '@app/search' |
21 | import { WelcomeModalComponent } from '@app/modal/welcome-modal.component' | 18 | import { WelcomeModalComponent } from '@app/modal/welcome-modal.component' |
22 | import { InstanceConfigWarningModalComponent } from '@app/modal/instance-config-warning-modal.component' | 19 | import { InstanceConfigWarningModalComponent } from '@app/modal/instance-config-warning-modal.component' |
20 | import { buildFileLocale, getCompleteLocale, isDefaultLocale } from '@shared/models' | ||
23 | 21 | ||
24 | export function metaFactory (serverService: ServerService): MetaLoader { | 22 | export function metaFactory (serverService: ServerService): MetaLoader { |
25 | return new MetaStaticLoader({ | 23 | return new MetaStaticLoader({ |
@@ -67,17 +65,12 @@ export function metaFactory (serverService: ServerService): MetaLoader { | |||
67 | 65 | ||
68 | AppRoutingModule // Put it after all the module because it has the 404 route | 66 | AppRoutingModule // Put it after all the module because it has the 404 route |
69 | ], | 67 | ], |
68 | |||
70 | providers: [ | 69 | providers: [ |
71 | { | 70 | { |
72 | provide: TRANSLATIONS, | 71 | provide: TRANSLATIONS, |
73 | useFactory: (locale: string) => { | 72 | useFactory: (locale: string) => { |
74 | // On dev mode, test localization | 73 | // Default locale, nothing to translate |
75 | if (isOnDevLocale()) { | ||
76 | locale = buildFileLocale(getDevLocale()) | ||
77 | return require(`raw-loader!../locale/angular.${locale}.xlf`) | ||
78 | } | ||
79 | |||
80 | // Default locale, nothing to translate | ||
81 | const completeLocale = getCompleteLocale(locale) | 74 | const completeLocale = getCompleteLocale(locale) |
82 | if (isDefaultLocale(completeLocale)) return '' | 75 | if (isDefaultLocale(completeLocale)) return '' |
83 | 76 | ||
diff --git a/client/src/environments/environment.ts b/client/src/environments/environment.ts index 1ea483554..b6bc784b5 100644 --- a/client/src/environments/environment.ts +++ b/client/src/environments/environment.ts | |||
@@ -6,8 +6,7 @@ | |||
6 | // | 6 | // |
7 | // In order to load these polyfills early enough (before app code), polyfill.ts imports this file to | 7 | // In order to load these polyfills early enough (before app code), polyfill.ts imports this file to |
8 | // to change the order in the final bundle. | 8 | // to change the order in the final bundle. |
9 | import 'core-js/es6/reflect' | 9 | import 'core-js/features/reflect' |
10 | import 'core-js/es7/reflect' | ||
11 | 10 | ||
12 | export const environment = { | 11 | export const environment = { |
13 | production: false, | 12 | production: false, |
diff --git a/client/src/main.ts b/client/src/main.ts index 2b65072ad..3fb9b346e 100644 --- a/client/src/main.ts +++ b/client/src/main.ts | |||
@@ -1,31 +1,17 @@ | |||
1 | import { enableProdMode, TRANSLATIONS, TRANSLATIONS_FORMAT } from '@angular/core' | 1 | import { enableProdMode } from '@angular/core' |
2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic' | 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic' |
3 | 3 | ||
4 | import { AppModule } from './app/app.module' | 4 | import { AppModule } from './app/app.module' |
5 | import { environment } from './environments/environment' | 5 | import { environment } from './environments/environment' |
6 | 6 | ||
7 | import { hmrBootstrap } from './hmr' | 7 | import { hmrBootstrap } from './hmr' |
8 | import { getDevLocale, isOnDevLocale } from '@app/shared/i18n/i18n-utils' | ||
9 | import { buildFileLocale } from '../../shared' | ||
10 | 8 | ||
11 | let providers: any[] = [] | ||
12 | if (environment.production) { | 9 | if (environment.production) { |
13 | enableProdMode() | 10 | enableProdMode() |
14 | } | 11 | } |
15 | 12 | ||
16 | // Template translation, should be in the bootstrap step | ||
17 | if (isOnDevLocale()) { | ||
18 | const locale = buildFileLocale(getDevLocale()) | ||
19 | const translations = require(`raw-loader!./locale/angular.${locale}.xlf`) | ||
20 | |||
21 | providers = [ | ||
22 | { provide: TRANSLATIONS, useValue: translations }, | ||
23 | { provide: TRANSLATIONS_FORMAT, useValue: 'xlf' } | ||
24 | ] | ||
25 | } | ||
26 | |||
27 | const bootstrap = () => platformBrowserDynamic() | 13 | const bootstrap = () => platformBrowserDynamic() |
28 | .bootstrapModule(AppModule, { providers }) | 14 | .bootstrapModule(AppModule) |
29 | .then(bootstrapModule => { | 15 | .then(bootstrapModule => { |
30 | // TODO: Uncomment and remove unregistration when https://github.com/angular/angular/issues/21191 is fixed | 16 | // TODO: Uncomment and remove unregistration when https://github.com/angular/angular/issues/21191 is fixed |
31 | // TODO: Remove when https://github.com/angular/angular-cli/issues/8779 is fixed? | 17 | // TODO: Remove when https://github.com/angular/angular-cli/issues/8779 is fixed? |
@@ -36,11 +22,11 @@ const bootstrap = () => platformBrowserDynamic() | |||
36 | 22 | ||
37 | if (navigator.serviceWorker && typeof navigator.serviceWorker.getRegistrations === 'function') { | 23 | if (navigator.serviceWorker && typeof navigator.serviceWorker.getRegistrations === 'function') { |
38 | navigator.serviceWorker.getRegistrations() | 24 | navigator.serviceWorker.getRegistrations() |
39 | .then(registrations => { | 25 | .then(registrations => { |
40 | for (const registration of registrations) { | 26 | for (const registration of registrations) { |
41 | registration.unregister() | 27 | registration.unregister() |
42 | } | 28 | } |
43 | }) | 29 | }) |
44 | } | 30 | } |
45 | 31 | ||
46 | return bootstrapModule | 32 | return bootstrapModule |
diff --git a/client/tsconfig.app.json b/client/tsconfig.app.json index 225555bfc..d7f69a98e 100644 --- a/client/tsconfig.app.json +++ b/client/tsconfig.app.json | |||
@@ -12,12 +12,11 @@ | |||
12 | ] | 12 | ] |
13 | }, | 13 | }, |
14 | "files": [ | 14 | "files": [ |
15 | "src/main.ts", | ||
16 | "src/polyfills.ts" | 15 | "src/polyfills.ts" |
17 | ], | 16 | ], |
18 | "include": [ | 17 | "include": [ |
18 | "src/main*.ts", | ||
19 | "src/**/*.d.ts", | 19 | "src/**/*.d.ts", |
20 | "src/shims/*.ts", | 20 | "src/shims/*.ts" |
21 | "../shared/models" | ||
22 | ] | 21 | ] |
23 | } | 22 | } |
diff --git a/client/yarn.lock b/client/yarn.lock index 536bd1f99..a891b4dbd 100644 --- a/client/yarn.lock +++ b/client/yarn.lock | |||
@@ -286,7 +286,7 @@ | |||
286 | semver "^5.4.1" | 286 | semver "^5.4.1" |
287 | source-map "^0.5.0" | 287 | source-map "^0.5.0" |
288 | 288 | ||
289 | "@babel/core@^7.7.5": | 289 | "@babel/core@^7.6.4", "@babel/core@^7.7.5": |
290 | version "7.8.4" | 290 | version "7.8.4" |
291 | resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.8.4.tgz#d496799e5c12195b3602d0fddd77294e3e38e80e" | 291 | resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.8.4.tgz#d496799e5c12195b3602d0fddd77294e3e38e80e" |
292 | integrity sha512-0LiLrB2PwrVI+a2/IEskBopDYSd8BCb3rOvH7D5tzoWd696TBEduBvuLVm4Nx6rltrLZqvI3MCalB2K2aVzQjA== | 292 | integrity sha512-0LiLrB2PwrVI+a2/IEskBopDYSd8BCb3rOvH7D5tzoWd696TBEduBvuLVm4Nx6rltrLZqvI3MCalB2K2aVzQjA== |
@@ -1031,6 +1031,22 @@ | |||
1031 | resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.2.tgz#26520bf09abe4a5644cd5414e37125a8954241dd" | 1031 | resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.2.tgz#26520bf09abe4a5644cd5414e37125a8954241dd" |
1032 | integrity sha512-tsAQNx32a8CoFhjhijUIhI4kccIAgmGhy8LZMZgGfmXcpMbPRUqn5LWmgRttILi6yeGmBJd2xsPkFMs0PzgPCw== | 1032 | integrity sha512-tsAQNx32a8CoFhjhijUIhI4kccIAgmGhy8LZMZgGfmXcpMbPRUqn5LWmgRttILi6yeGmBJd2xsPkFMs0PzgPCw== |
1033 | 1033 | ||
1034 | "@locl/cli@^0.0.1-beta.5": | ||
1035 | version "0.0.1-beta.5" | ||
1036 | resolved "https://registry.yarnpkg.com/@locl/cli/-/cli-0.0.1-beta.5.tgz#9e9d970b4db6282ecda76503d525ffa9aa276a0d" | ||
1037 | integrity sha512-eF2WN61aZaojHODo/NsO1ndeH0+7tQhUH0KYmfubjRPSQwsh1trMDKIKHkzZYQQQBNOzCZOGzZHnK7EaWwWkow== | ||
1038 | dependencies: | ||
1039 | "@babel/core" "^7.6.4" | ||
1040 | chalk "^3.0.0" | ||
1041 | find-up "^4.1.0" | ||
1042 | glob "^7.1.2" | ||
1043 | yargs "^13.1.0" | ||
1044 | |||
1045 | "@locl/core@^0.0.1-beta.2": | ||
1046 | version "0.0.1-beta.2" | ||
1047 | resolved "https://registry.yarnpkg.com/@locl/core/-/core-0.0.1-beta.2.tgz#2055bae5e1d276d75a6aeb7e0944c72848c00f65" | ||
1048 | integrity sha512-R33xL9Z/VtXSCh9zv8qiGVV92zOJZJnH7vyXVRxhuFtpt7cL7sKbCNrZc966722Gu0LCpQ9MXERki2bl1vxjkg== | ||
1049 | |||
1034 | "@neos21/bootstrap3-glyphicons@^1.0.1": | 1050 | "@neos21/bootstrap3-glyphicons@^1.0.1": |
1035 | version "1.0.3" | 1051 | version "1.0.3" |
1036 | resolved "https://registry.yarnpkg.com/@neos21/bootstrap3-glyphicons/-/bootstrap3-glyphicons-1.0.3.tgz#58ecfeed21a959875077f190acc191b2d0e60aa6" | 1052 | resolved "https://registry.yarnpkg.com/@neos21/bootstrap3-glyphicons/-/bootstrap3-glyphicons-1.0.3.tgz#58ecfeed21a959875077f190acc191b2d0e60aa6" |
@@ -1149,6 +1165,11 @@ | |||
1149 | dependencies: | 1165 | dependencies: |
1150 | "@types/node" "*" | 1166 | "@types/node" "*" |
1151 | 1167 | ||
1168 | "@types/color-name@^1.1.1": | ||
1169 | version "1.1.1" | ||
1170 | resolved "https://registry.yarnpkg.com/@types/color-name/-/color-name-1.1.1.tgz#1c1261bbeaa10a8055bbc5d8ab84b7b2afc846a0" | ||
1171 | integrity sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ== | ||
1172 | |||
1152 | "@types/core-js@^2.5.2": | 1173 | "@types/core-js@^2.5.2": |
1153 | version "2.5.2" | 1174 | version "2.5.2" |
1154 | resolved "https://registry.yarnpkg.com/@types/core-js/-/core-js-2.5.2.tgz#d4c25420044d4a5b65e00a82fc04b7824b62691f" | 1175 | resolved "https://registry.yarnpkg.com/@types/core-js/-/core-js-2.5.2.tgz#d4c25420044d4a5b65e00a82fc04b7824b62691f" |
@@ -1747,6 +1768,14 @@ ansi-styles@^3.2.0, ansi-styles@^3.2.1: | |||
1747 | dependencies: | 1768 | dependencies: |
1748 | color-convert "^1.9.0" | 1769 | color-convert "^1.9.0" |
1749 | 1770 | ||
1771 | ansi-styles@^4.1.0: | ||
1772 | version "4.2.1" | ||
1773 | resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.2.1.tgz#90ae75c424d008d2624c5bf29ead3177ebfcf359" | ||
1774 | integrity sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA== | ||
1775 | dependencies: | ||
1776 | "@types/color-name" "^1.1.1" | ||
1777 | color-convert "^2.0.1" | ||
1778 | |||
1750 | anymatch@^2.0.0: | 1779 | anymatch@^2.0.0: |
1751 | version "2.0.0" | 1780 | version "2.0.0" |
1752 | resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-2.0.0.tgz#bcb24b4f37934d9aa7ac17b4adaf89e7c76ef2eb" | 1781 | resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-2.0.0.tgz#bcb24b4f37934d9aa7ac17b4adaf89e7c76ef2eb" |
@@ -2650,6 +2679,14 @@ chalk@^1.0.0, chalk@^1.1.1, chalk@^1.1.3: | |||
2650 | strip-ansi "^3.0.0" | 2679 | strip-ansi "^3.0.0" |
2651 | supports-color "^2.0.0" | 2680 | supports-color "^2.0.0" |
2652 | 2681 | ||
2682 | chalk@^3.0.0: | ||
2683 | version "3.0.0" | ||
2684 | resolved "https://registry.yarnpkg.com/chalk/-/chalk-3.0.0.tgz#3f73c2bf526591f574cc492c51e2456349f844e4" | ||
2685 | integrity sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg== | ||
2686 | dependencies: | ||
2687 | ansi-styles "^4.1.0" | ||
2688 | supports-color "^7.1.0" | ||
2689 | |||
2653 | chardet@^0.7.0: | 2690 | chardet@^0.7.0: |
2654 | version "0.7.0" | 2691 | version "0.7.0" |
2655 | resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e" | 2692 | resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e" |
@@ -2918,12 +2955,19 @@ color-convert@^1.9.0, color-convert@^1.9.1, color-convert@^1.9.3: | |||
2918 | dependencies: | 2955 | dependencies: |
2919 | color-name "1.1.3" | 2956 | color-name "1.1.3" |
2920 | 2957 | ||
2958 | color-convert@^2.0.1: | ||
2959 | version "2.0.1" | ||
2960 | resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" | ||
2961 | integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== | ||
2962 | dependencies: | ||
2963 | color-name "~1.1.4" | ||
2964 | |||
2921 | color-name@1.1.3: | 2965 | color-name@1.1.3: |
2922 | version "1.1.3" | 2966 | version "1.1.3" |
2923 | resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" | 2967 | resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" |
2924 | integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= | 2968 | integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= |
2925 | 2969 | ||
2926 | color-name@^1.0.0: | 2970 | color-name@^1.0.0, color-name@~1.1.4: |
2927 | version "1.1.4" | 2971 | version "1.1.4" |
2928 | resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" | 2972 | resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" |
2929 | integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== | 2973 | integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== |
@@ -4747,7 +4791,7 @@ find-up@^3.0.0: | |||
4747 | dependencies: | 4791 | dependencies: |
4748 | locate-path "^3.0.0" | 4792 | locate-path "^3.0.0" |
4749 | 4793 | ||
4750 | find-up@^4.0.0: | 4794 | find-up@^4.0.0, find-up@^4.1.0: |
4751 | version "4.1.0" | 4795 | version "4.1.0" |
4752 | resolved "https://registry.yarnpkg.com/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19" | 4796 | resolved "https://registry.yarnpkg.com/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19" |
4753 | integrity sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw== | 4797 | integrity sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw== |
@@ -10853,7 +10897,7 @@ supports-color@^5.3.0: | |||
10853 | dependencies: | 10897 | dependencies: |
10854 | has-flag "^3.0.0" | 10898 | has-flag "^3.0.0" |
10855 | 10899 | ||
10856 | supports-color@^7.0.0: | 10900 | supports-color@^7.0.0, supports-color@^7.1.0: |
10857 | version "7.1.0" | 10901 | version "7.1.0" |
10858 | resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.1.0.tgz#68e32591df73e25ad1c4b49108a2ec507962bfd1" | 10902 | resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.1.0.tgz#68e32591df73e25ad1c4b49108a2ec507962bfd1" |
10859 | integrity sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g== | 10903 | integrity sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g== |
@@ -12242,7 +12286,7 @@ yargs@13.2.4: | |||
12242 | y18n "^4.0.0" | 12286 | y18n "^4.0.0" |
12243 | yargs-parser "^13.1.0" | 12287 | yargs-parser "^13.1.0" |
12244 | 12288 | ||
12245 | yargs@^13.2.4: | 12289 | yargs@^13.1.0, yargs@^13.2.4: |
12246 | version "13.3.0" | 12290 | version "13.3.0" |
12247 | resolved "https://registry.yarnpkg.com/yargs/-/yargs-13.3.0.tgz#4c657a55e07e5f2cf947f8a366567c04a0dedc83" | 12291 | resolved "https://registry.yarnpkg.com/yargs/-/yargs-13.3.0.tgz#4c657a55e07e5f2cf947f8a366567c04a0dedc83" |
12248 | integrity sha512-2eehun/8ALW8TLoIl7MVaRUrg+yCnenu8B4kBlRxj3GJGDKU1Og7sMXPNm1BYyM1DOJmTZ4YeN/Nwxv+8XJsUA== | 12292 | integrity sha512-2eehun/8ALW8TLoIl7MVaRUrg+yCnenu8B4kBlRxj3GJGDKU1Og7sMXPNm1BYyM1DOJmTZ4YeN/Nwxv+8XJsUA== |
diff --git a/scripts/build/client.sh b/scripts/build/client.sh index ee647bb99..99394838a 100755 --- a/scripts/build/client.sh +++ b/scripts/build/client.sh | |||
@@ -2,6 +2,8 @@ | |||
2 | 2 | ||
3 | set -eu | 3 | set -eu |
4 | 4 | ||
5 | declare -A languages | ||
6 | |||
5 | pre_build_hook () { | 7 | pre_build_hook () { |
6 | mkdir "./src/pending_locale" > /dev/null || true | 8 | mkdir "./src/pending_locale" > /dev/null || true |
7 | mv ./src/locale/angular.*.xlf "./src/pending_locale" | 9 | mv ./src/locale/angular.*.xlf "./src/pending_locale" |
@@ -38,22 +40,46 @@ post_build_hook | |||
38 | # Don't build other languages if --light arg is provided | 40 | # Don't build other languages if --light arg is provided |
39 | if [ -z ${1+x} ] || [ "$1" != "--light" ]; then | 41 | if [ -z ${1+x} ] || [ "$1" != "--light" ]; then |
40 | if [ ! -z ${1+x} ] && [ "$1" == "--light-fr" ]; then | 42 | if [ ! -z ${1+x} ] && [ "$1" == "--light-fr" ]; then |
41 | languages=("fr-FR") | 43 | languages=(["fr"]="fr-FR") |
42 | else | 44 | else |
43 | # Supported languages | 45 | # Supported languages |
44 | languages=( | 46 | languages=( |
45 | "hu-HU" "th-TH" | 47 | ["hu"]="hu-HU" |
46 | "fi-FI" "nl-NL" "gd" "el-GR" "es-ES" "oc" "pt-BR" "pt-PT" "sv-SE" "pl-PL" "ru-RU" "zh-Hans-CN" "zh-Hant-TW" | 48 | ["th"]="th-TH" |
47 | "fr-FR" "ja-JP" "eu-ES" "ca-ES" "cs-CZ" "eo" "de-DE" "it-IT" | 49 | ["fi"]="fi-FI" |
50 | ["nl"]="nl-NL" | ||
51 | ["gd"]="gd" | ||
52 | ["el"]="el-GR" | ||
53 | ["es"]="es-ES" | ||
54 | ["oc"]="oc" | ||
55 | ["pt"]="pt-BR" | ||
56 | ["pt-PT"]="pt-PT" | ||
57 | ["sv"]="sv-SE" | ||
58 | ["pl"]="pl-PL" | ||
59 | ["ru"]="ru-RU" | ||
60 | ["zh-Hans"]="zh-Hans-CN" | ||
61 | ["zh-Hant"]="zh-Hant-TW" | ||
62 | ["fr"]="fr-FR" | ||
63 | ["ja"]="ja-JP" | ||
64 | ["eu"]="eu-ES" | ||
65 | ["ca"]="ca-ES" | ||
66 | ["cs"]="cs-CZ" | ||
67 | ["eo"]="eo" | ||
68 | ["de"]="de-DE" | ||
69 | ["it"]="it-IT" | ||
48 | ) | 70 | ) |
49 | fi | 71 | fi |
50 | 72 | ||
51 | for lang in "${languages[@]}"; do | 73 | for key in "${!languages[@]}"; do |
74 | lang=${languages[$key]} | ||
75 | |||
52 | # TODO: remove when the project will use runtime translations | 76 | # TODO: remove when the project will use runtime translations |
53 | pre_build_hook "$lang" | 77 | pre_build_hook "$lang" |
54 | 78 | ||
55 | npm run ng build -- --prod --i18n-file "./src/locale/angular.$lang.xlf" --i18n-format xlf --i18n-locale "$lang" \ | 79 | npm run ng build -- --output-path "dist/build" --deploy-url "/client/$lang/" --prod --configuration="$lang" |
56 | --output-path "dist/$lang/" --deploy-url "/client/$lang/" | 80 | |
81 | mv "dist/build/$key" "dist/$lang" | ||
82 | rmdir "dist/build" | ||
57 | 83 | ||
58 | # Do not duplicate assets | 84 | # Do not duplicate assets |
59 | rm -r "./dist/$lang/assets" | 85 | rm -r "./dist/$lang/assets" |
diff --git a/scripts/dev/client.sh b/scripts/dev/client.sh index bcb8b88f6..a36a47a34 100755 --- a/scripts/dev/client.sh +++ b/scripts/dev/client.sh | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | set -eu | 3 | set -eu |
4 | 4 | ||
5 | clientCommand="cd client && node node_modules/.bin/ng serve --proxy-config proxy.config.json --hmr --configuration hmr --host 0.0.0.0 --disable-host-check --port 3000" | 5 | clientCommand="cd client && node node_modules/.bin/ng serve --proxy-config proxy.config.json --hmr --configuration hmr,fr --host 0.0.0.0 --disable-host-check --port 3000" |
6 | serverCommand="npm run build:server && NODE_ENV=test node dist/server" | 6 | serverCommand="npm run build:server && NODE_ENV=test node dist/server" |
7 | 7 | ||
8 | if [ ! -z ${1+x} ] && [ "$1" == "--skip-server" ]; then | 8 | if [ ! -z ${1+x} ] && [ "$1" == "--skip-server" ]; then |