diff options
author | Chocobozzz <me@florianbigard.com> | 2020-02-12 11:34:34 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-02-12 14:09:55 +0100 |
commit | 8cc56c7fddb4c9fe3cfe1a19f340fc07dc4cec0f (patch) | |
tree | 88fbda0d3c1b5f34569a877522cfe8d50705388a | |
parent | 3f87a46f1dd01485e4a28422f74c3a1b0f56729f (diff) | |
download | PeerTube-8cc56c7fddb4c9fe3cfe1a19f340fc07dc4cec0f.tar.gz PeerTube-8cc56c7fddb4c9fe3cfe1a19f340fc07dc4cec0f.tar.zst PeerTube-8cc56c7fddb4c9fe3cfe1a19f340fc07dc4cec0f.zip |
Only use basehref
Will allow us to use the localize option
-rw-r--r-- | client/angular.json | 51 | ||||
-rw-r--r-- | client/src/app/app.module.ts | 6 | ||||
-rwxr-xr-x | scripts/build/client.sh | 7 |
3 files changed, 37 insertions, 27 deletions
diff --git a/client/angular.json b/client/angular.json index bf3a860aa..d9cee9bac 100644 --- a/client/angular.json +++ b/client/angular.json | |||
@@ -8,99 +8,102 @@ | |||
8 | "sourceRoot": "src", | 8 | "sourceRoot": "src", |
9 | "projectType": "application", | 9 | "projectType": "application", |
10 | "i18n": { | 10 | "i18n": { |
11 | "sourceLocale": "en", | 11 | "sourceLocale": { |
12 | "code": "en", | ||
13 | "baseHref": "/client/en-US/" | ||
14 | }, | ||
12 | "locales": { | 15 | "locales": { |
13 | "hu": { | 16 | "hu": { |
14 | "translation": "src/locale/angular.hu-HU.xlf", | 17 | "translation": "src/locale/angular.hu-HU.xlf", |
15 | "baseHref": "/" | 18 | "baseHref": "/client/hu-HU/" |
16 | }, | 19 | }, |
17 | "th": { | 20 | "th": { |
18 | "translation": "src/locale/angular.th-TH.xlf", | 21 | "translation": "src/locale/angular.th-TH.xlf", |
19 | "baseHref": "/" | 22 | "baseHref": "/client/th-TH/" |
20 | }, | 23 | }, |
21 | "fi": { | 24 | "fi": { |
22 | "translation": "src/locale/angular.fi-FI.xlf", | 25 | "translation": "src/locale/angular.fi-FI.xlf", |
23 | "baseHref": "/" | 26 | "baseHref": "/client/fi-FI/" |
24 | }, | 27 | }, |
25 | "nl": { | 28 | "nl": { |
26 | "translation": "src/locale/angular.nl-NL.xlf", | 29 | "translation": "src/locale/angular.nl-NL.xlf", |
27 | "baseHref": "/" | 30 | "baseHref": "/client/nl-NL/" |
28 | }, | 31 | }, |
29 | "gd": { | 32 | "gd": { |
30 | "translation": "src/locale/angular.gd.xlf", | 33 | "translation": "src/locale/angular.gd.xlf", |
31 | "baseHref": "/" | 34 | "baseHref": "/client/gd/" |
32 | }, | 35 | }, |
33 | "el": { | 36 | "el": { |
34 | "translation": "src/locale/angular.el-GR.xlf", | 37 | "translation": "src/locale/angular.el-GR.xlf", |
35 | "baseHref": "/" | 38 | "baseHref": "/client/el-GR/" |
36 | }, | 39 | }, |
37 | "es": { | 40 | "es": { |
38 | "translation": "src/locale/angular.es-ES.xlf", | 41 | "translation": "src/locale/angular.es-ES.xlf", |
39 | "baseHref": "/" | 42 | "baseHref": "/client/es-ES/" |
40 | }, | 43 | }, |
41 | "oc": { | 44 | "oc": { |
42 | "translation": "src/locale/angular.oc.xlf", | 45 | "translation": "src/locale/angular.oc.xlf", |
43 | "baseHref": "/" | 46 | "baseHref": "/client/oc/" |
44 | }, | 47 | }, |
45 | "pt": { | 48 | "pt": { |
46 | "translation": "src/locale/angular.pt-BR.xlf", | 49 | "translation": "src/locale/angular.pt-BR.xlf", |
47 | "baseHref": "/" | 50 | "baseHref": "/client/pt-BR/" |
48 | }, | 51 | }, |
49 | "pt-PT": { | 52 | "pt-PT": { |
50 | "translation": "src/locale/angular.pt-PT.xlf", | 53 | "translation": "src/locale/angular.pt-PT.xlf", |
51 | "baseHref": "/" | 54 | "baseHref": "/client/pt-PT/" |
52 | }, | 55 | }, |
53 | "sv": { | 56 | "sv": { |
54 | "translation": "src/locale/angular.sv-SE.xlf", | 57 | "translation": "src/locale/angular.sv-SE.xlf", |
55 | "baseHref": "/" | 58 | "baseHref": "/client/sv-SE/" |
56 | }, | 59 | }, |
57 | "pl": { | 60 | "pl": { |
58 | "translation": "src/locale/angular.pl-PL.xlf", | 61 | "translation": "src/locale/angular.pl-PL.xlf", |
59 | "baseHref": "/" | 62 | "baseHref": "/client/pl-PL/" |
60 | }, | 63 | }, |
61 | "ru": { | 64 | "ru": { |
62 | "translation": "src/locale/angular.ru-RU.xlf", | 65 | "translation": "src/locale/angular.ru-RU.xlf", |
63 | "baseHref": "/" | 66 | "baseHref": "/client/ru-RU/" |
64 | }, | 67 | }, |
65 | "zh-Hans": { | 68 | "zh-Hans": { |
66 | "translation": "src/locale/angular.zh-Hans-CN.xlf", | 69 | "translation": "src/locale/angular.zh-Hans-CN.xlf", |
67 | "baseHref": "/" | 70 | "baseHref": "/client/zh-Hans-CN/" |
68 | }, | 71 | }, |
69 | "zh-Hant": { | 72 | "zh-Hant": { |
70 | "translation": "src/locale/angular.zh-Hant-TW.xlf", | 73 | "translation": "src/locale/angular.zh-Hant-TW.xlf", |
71 | "baseHref": "/" | 74 | "baseHref": "/client/zh-Hant-TW/" |
72 | }, | 75 | }, |
73 | "fr": { | 76 | "fr": { |
74 | "translation": "src/locale/angular.fr-FR.xlf", | 77 | "translation": "src/locale/angular.fr-FR.xlf", |
75 | "baseHref": "/" | 78 | "baseHref": "/client/fr-FR/" |
76 | }, | 79 | }, |
77 | "ja": { | 80 | "ja": { |
78 | "translation": "src/locale/angular.ja-JP.xlf", | 81 | "translation": "src/locale/angular.ja-JP.xlf", |
79 | "baseHref": "/" | 82 | "baseHref": "/client/ja-JP/" |
80 | }, | 83 | }, |
81 | "eu": { | 84 | "eu": { |
82 | "translation": "src/locale/angular.eu-ES.xlf", | 85 | "translation": "src/locale/angular.eu-ES.xlf", |
83 | "baseHref": "/" | 86 | "baseHref": "/client/eu-ES/" |
84 | }, | 87 | }, |
85 | "ca": { | 88 | "ca": { |
86 | "translation": "src/locale/angular.ca-ES.xlf", | 89 | "translation": "src/locale/angular.ca-ES.xlf", |
87 | "baseHref": "/" | 90 | "baseHref": "/client/ca-ES/" |
88 | }, | 91 | }, |
89 | "cs": { | 92 | "cs": { |
90 | "translation": "src/locale/angular.cs-CZ.xlf", | 93 | "translation": "src/locale/angular.cs-CZ.xlf", |
91 | "baseHref": "/" | 94 | "baseHref": "/client/cs-CZ/" |
92 | }, | 95 | }, |
93 | "eo": { | 96 | "eo": { |
94 | "translation": "src/locale/angular.eo.xlf", | 97 | "translation": "src/locale/angular.eo.xlf", |
95 | "baseHref": "/" | 98 | "baseHref": "/client/eo/" |
96 | }, | 99 | }, |
97 | "de": { | 100 | "de": { |
98 | "translation": "src/locale/angular.de-DE.xlf", | 101 | "translation": "src/locale/angular.de-DE.xlf", |
99 | "baseHref": "/" | 102 | "baseHref": "/client/de-DE/" |
100 | }, | 103 | }, |
101 | "it": { | 104 | "it": { |
102 | "translation": "src/locale/angular.it-IT.xlf", | 105 | "translation": "src/locale/angular.it-IT.xlf", |
103 | "baseHref": "/" | 106 | "baseHref": "/client/it-IT/" |
104 | } | 107 | } |
105 | } | 108 | } |
106 | }, | 109 | }, |
diff --git a/client/src/app/app.module.ts b/client/src/app/app.module.ts index 14fdb7588..d11dba34d 100644 --- a/client/src/app/app.module.ts +++ b/client/src/app/app.module.ts | |||
@@ -18,6 +18,7 @@ import { SearchModule } from '@app/search' | |||
18 | import { WelcomeModalComponent } from '@app/modal/welcome-modal.component' | 18 | import { WelcomeModalComponent } from '@app/modal/welcome-modal.component' |
19 | 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' | 20 | import { buildFileLocale, getCompleteLocale, isDefaultLocale } from '@shared/models' |
21 | import { APP_BASE_HREF } from '@angular/common' | ||
21 | 22 | ||
22 | export function metaFactory (serverService: ServerService): MetaLoader { | 23 | export function metaFactory (serverService: ServerService): MetaLoader { |
23 | return new MetaStaticLoader({ | 24 | return new MetaStaticLoader({ |
@@ -68,6 +69,11 @@ export function metaFactory (serverService: ServerService): MetaLoader { | |||
68 | 69 | ||
69 | providers: [ | 70 | providers: [ |
70 | { | 71 | { |
72 | provide: APP_BASE_HREF, | ||
73 | useValue: '/' | ||
74 | }, | ||
75 | |||
76 | { | ||
71 | provide: TRANSLATIONS, | 77 | provide: TRANSLATIONS, |
72 | useFactory: (locale: string) => { | 78 | useFactory: (locale: string) => { |
73 | // Default locale, nothing to translate | 79 | // Default locale, nothing to translate |
diff --git a/scripts/build/client.sh b/scripts/build/client.sh index 99394838a..aa3f89c03 100755 --- a/scripts/build/client.sh +++ b/scripts/build/client.sh | |||
@@ -76,10 +76,11 @@ if [ -z ${1+x} ] || [ "$1" != "--light" ]; then | |||
76 | # TODO: remove when the project will use runtime translations | 76 | # TODO: remove when the project will use runtime translations |
77 | pre_build_hook "$lang" | 77 | pre_build_hook "$lang" |
78 | 78 | ||
79 | npm run ng build -- --output-path "dist/build" --deploy-url "/client/$lang/" --prod --configuration="$lang" | 79 | npm run ng build -- --prod --configuration="$lang" |
80 | 80 | ||
81 | mv "dist/build/$key" "dist/$lang" | 81 | if [ ! "$lang" = "$key" ]; then |
82 | rmdir "dist/build" | 82 | mv "dist/$key" "dist/$lang" |
83 | fi | ||
83 | 84 | ||
84 | # Do not duplicate assets | 85 | # Do not duplicate assets |
85 | rm -r "./dist/$lang/assets" | 86 | rm -r "./dist/$lang/assets" |