aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-06-06 14:33:21 +0200
committerChocobozzz <me@florianbigard.com>2018-06-06 16:48:41 +0200
commitf07d6385b4b46c3254898292a8a53ed415b8d49b (patch)
treedba932058694ede3166ba812d1cbea170344e330
parente945b184a0f29b47c33bbd05578f3493ca9c8e6c (diff)
downloadPeerTube-f07d6385b4b46c3254898292a8a53ed415b8d49b.tar.gz
PeerTube-f07d6385b4b46c3254898292a8a53ed415b8d49b.tar.zst
PeerTube-f07d6385b4b46c3254898292a8a53ed415b8d49b.zip
Rename messages locale to angular
-rw-r--r--client/src/app/app.module.ts4
-rw-r--r--client/src/locale/source/angular_en_US.xml (renamed from client/src/locale/source/messages_en_US.xml)0
-rw-r--r--client/src/locale/target/angular_fr.xml (renamed from client/src/locale/target/messages_fr.xml)24
-rw-r--r--client/src/main.ts2
-rwxr-xr-xscripts/i18n/create-custom-files.ts23
-rwxr-xr-xscripts/i18n/generate.sh7
-rwxr-xr-xscripts/i18n/pull-hook.sh1
7 files changed, 32 insertions, 29 deletions
diff --git a/client/src/app/app.module.ts b/client/src/app/app.module.ts
index 9992b9c44..e60a74cc0 100644
--- a/client/src/app/app.module.ts
+++ b/client/src/app/app.module.ts
@@ -69,7 +69,7 @@ export function metaFactory (serverService: ServerService): MetaLoader {
69 useFactory: (locale) => { 69 useFactory: (locale) => {
70 // On dev mode, test locales 70 // On dev mode, test locales
71 if (environment.production === false && window.location.search === '?lang=fr') { 71 if (environment.production === false && window.location.search === '?lang=fr') {
72 return require(`raw-loader!../locale/target/messages_fr.xml`) 72 return require(`raw-loader!../locale/target/angular_fr.xml`)
73 } 73 }
74 74
75 const fileLocale = buildFileLocale(locale) 75 const fileLocale = buildFileLocale(locale)
@@ -78,7 +78,7 @@ export function metaFactory (serverService: ServerService): MetaLoader {
78 const defaultFileLocale = buildFileLocale(getDefaultLocale()) 78 const defaultFileLocale = buildFileLocale(getDefaultLocale())
79 if (fileLocale === defaultFileLocale) return '' 79 if (fileLocale === defaultFileLocale) return ''
80 80
81 return require(`raw-loader!../locale/target/messages_${fileLocale}.xml`) 81 return require(`raw-loader!../locale/target/angular_${fileLocale}.xml`)
82 }, 82 },
83 deps: [ LOCALE_ID ] 83 deps: [ LOCALE_ID ]
84 }, 84 },
diff --git a/client/src/locale/source/messages_en_US.xml b/client/src/locale/source/angular_en_US.xml
index 859212ae7..859212ae7 100644
--- a/client/src/locale/source/messages_en_US.xml
+++ b/client/src/locale/source/angular_en_US.xml
diff --git a/client/src/locale/target/messages_fr.xml b/client/src/locale/target/angular_fr.xml
index 04e9d2a1a..7861e4134 100644
--- a/client/src/locale/target/messages_fr.xml
+++ b/client/src/locale/target/angular_fr.xml
@@ -22,7 +22,7 @@
22 </trans-unit> 22 </trans-unit>
23 <trans-unit id="28f86ffd419b869711aa13f5e5ff54be6d70731c"> 23 <trans-unit id="28f86ffd419b869711aa13f5e5ff54be6d70731c">
24 <source>Edit</source> 24 <source>Edit</source>
25 <target>Éditer</target> 25 <target>Modifier</target>
26 <context-group name="null"> 26 <context-group name="null">
27 <context context-type="linenumber">3</context> 27 <context context-type="linenumber">3</context>
28 </context-group> 28 </context-group>
@@ -106,7 +106,7 @@
106 </trans-unit> 106 </trans-unit>
107 <trans-unit id="b87e81682959464211443afc3e23c506865d2eda"> 107 <trans-unit id="b87e81682959464211443afc3e23c506865d2eda">
108 <source>I forgot my password</source> 108 <source>I forgot my password</source>
109 <target>J'ai oublié mon mot de passe</target> 109 <target>J’ai oublié mon mot de passe</target>
110 <context-group name="null"> 110 <context-group name="null">
111 <context context-type="linenumber">42</context> 111 <context context-type="linenumber">42</context>
112 </context-group> 112 </context-group>
@@ -120,14 +120,14 @@
120 </trans-unit> 120 </trans-unit>
121 <trans-unit id="244aae9346da82b0922506c2d2581373a15641cc"> 121 <trans-unit id="244aae9346da82b0922506c2d2581373a15641cc">
122 <source>Email</source> 122 <source>Email</source>
123 <target>Email</target> 123 <target>Courriel</target>
124 <context-group name="null"> 124 <context-group name="null">
125 <context context-type="linenumber">17</context> 125 <context context-type="linenumber">17</context>
126 </context-group> 126 </context-group>
127 </trans-unit> 127 </trans-unit>
128 <trans-unit id="69b6ac577a19acc39fc0c22342092f327fff2529"> 128 <trans-unit id="69b6ac577a19acc39fc0c22342092f327fff2529">
129 <source>Email address</source> 129 <source>Email address</source>
130 <target>Adresse email</target> 130 <target>Courriel</target>
131 <context-group name="null"> 131 <context-group name="null">
132 <context context-type="linenumber">66</context> 132 <context context-type="linenumber">66</context>
133 </context-group> 133 </context-group>
@@ -143,7 +143,7 @@
143 <source> 143 <source>
144 Reset my password 144 Reset my password
145 </source> 145 </source>
146 <target>Remettre à zéro mon mot de passe</target> 146 <target>Réinitialiser mon mot de passe</target>
147 <context-group name="null"> 147 <context-group name="null">
148 <context context-type="linenumber">2</context> 148 <context context-type="linenumber">2</context>
149 </context-group> 149 </context-group>
@@ -313,7 +313,7 @@
313 </trans-unit> 313 </trans-unit>
314 <trans-unit id="6765b4c916060f6bc42d9bb69e80377dbcb5e4e9"> 314 <trans-unit id="6765b4c916060f6bc42d9bb69e80377dbcb5e4e9">
315 <source>Login</source> 315 <source>Login</source>
316 <target>Se connecter</target> 316 <target>Connexion</target>
317 <context-group name="null"> 317 <context-group name="null">
318 <context context-type="linenumber">34</context> 318 <context context-type="linenumber">34</context>
319 </context-group> 319 </context-group>
@@ -1152,7 +1152,7 @@ Quand vous mettrez en ligne une vidéo sur cette chaîne, la vidéo affichera au
1152 </trans-unit> 1152 </trans-unit>
1153 <trans-unit id="739516c2ca75843d5aec9cf0e6b3e4335c4227b9"> 1153 <trans-unit id="739516c2ca75843d5aec9cf0e6b3e4335c4227b9">
1154 <source>Change password</source> 1154 <source>Change password</source>
1155 <target>Changer votre phrase de passe</target> 1155 <target>Changer le mot de passe</target>
1156 <context-group name="null"> 1156 <context-group name="null">
1157 <context context-type="linenumber">19</context> 1157 <context context-type="linenumber">19</context>
1158 </context-group> 1158 </context-group>
@@ -1268,7 +1268,7 @@ Quand vous mettrez en ligne une vidéo sur cette chaîne, la vidéo affichera au
1268 </trans-unit> 1268 </trans-unit>
1269 <trans-unit id="3c78b53bca33467190c0b7a01320bc093a2b1427"> 1269 <trans-unit id="3c78b53bca33467190c0b7a01320bc093a2b1427">
1270 <source>Privacy</source> 1270 <source>Privacy</source>
1271 <target>Visibilité</target> 1271 <target>Confidentialité</target>
1272 <context-group name="null"> 1272 <context-group name="null">
1273 <context context-type="linenumber">86</context> 1273 <context context-type="linenumber">86</context>
1274 </context-group> 1274 </context-group>
@@ -1331,7 +1331,7 @@ Quand vous mettrez en ligne une vidéo sur cette chaîne, la vidéo affichera au
1331 </trans-unit> 1331 </trans-unit>
1332 <trans-unit id="fe46ccaae902ce974e2441abe752399288298619"> 1332 <trans-unit id="fe46ccaae902ce974e2441abe752399288298619">
1333 <source>Language</source> 1333 <source>Language</source>
1334 <target>Langue</target> 1334 <target>Langage</target>
1335 <context-group name="null"> 1335 <context-group name="null">
1336 <context context-type="linenumber">72</context> 1336 <context context-type="linenumber">72</context>
1337 </context-group> 1337 </context-group>
@@ -1633,7 +1633,7 @@ Quand vous mettrez en ligne une vidéo sur cette chaîne, la vidéo affichera au
1633 </trans-unit> 1633 </trans-unit>
1634 <trans-unit id="f0c5f6f270e70cbe063b5368fcf48f9afc1abd9b"> 1634 <trans-unit id="f0c5f6f270e70cbe063b5368fcf48f9afc1abd9b">
1635 <source>Show more</source> 1635 <source>Show more</source>
1636 <target>Montrer plus</target> 1636 <target>Voir plus</target>
1637 <context-group name="null"> 1637 <context-group name="null">
1638 <context context-type="linenumber">112</context> 1638 <context context-type="linenumber">112</context>
1639 </context-group> 1639 </context-group>
@@ -1886,7 +1886,7 @@ Quand vous mettrez en ligne une vidéo sur cette chaîne, la vidéo affichera au
1886 </trans-unit> 1886 </trans-unit>
1887 <trans-unit id="1e035e6ccfab771cad4226b2ad230cb0d4a88cba"> 1887 <trans-unit id="1e035e6ccfab771cad4226b2ad230cb0d4a88cba">
1888 <source>Success</source> 1888 <source>Success</source>
1889 <target>Succès</target> 1889 <target>Réussite</target>
1890 <context-group name="null"> 1890 <context-group name="null">
1891 <context context-type="linenumber">1</context> 1891 <context context-type="linenumber">1</context>
1892 </context-group> 1892 </context-group>
@@ -2882,7 +2882,7 @@ Quand vous mettrez en ligne une vidéo sur cette chaîne, la vidéo affichera au
2882 </trans-unit> 2882 </trans-unit>
2883 <trans-unit id="7e892ba15f2c6c17e83510e273b3e10fc32ea016"> 2883 <trans-unit id="7e892ba15f2c6c17e83510e273b3e10fc32ea016">
2884 <source>Search</source> 2884 <source>Search</source>
2885 <target>Rechercher</target> 2885 <target>Chercher</target>
2886 <context-group name="null"> 2886 <context-group name="null">
2887 <context context-type="linenumber">1</context> 2887 <context context-type="linenumber">1</context>
2888 </context-group> 2888 </context-group>
diff --git a/client/src/main.ts b/client/src/main.ts
index 85c4c0672..19f45a3e3 100644
--- a/client/src/main.ts
+++ b/client/src/main.ts
@@ -12,7 +12,7 @@ if (environment.production) {
12} 12}
13 13
14if (environment.production === false && window.location.search === '?lang=fr') { 14if (environment.production === false && window.location.search === '?lang=fr') {
15 const translations = require(`raw-loader!./locale/target/messages_fr.xml`) 15 const translations = require(`raw-loader!./locale/target/angular_fr.xml`)
16 16
17 providers = [ 17 providers = [
18 { provide: TRANSLATIONS, useValue: translations }, 18 { provide: TRANSLATIONS, useValue: translations },
diff --git a/scripts/i18n/create-custom-files.ts b/scripts/i18n/create-custom-files.ts
index 3895b3b9d..d8a87f291 100755
--- a/scripts/i18n/create-custom-files.ts
+++ b/scripts/i18n/create-custom-files.ts
@@ -30,20 +30,25 @@ for (const sourceObject of [ videojs, playerKeys ]) {
30 Object.keys(sourceObject).forEach(k => obj.resources.namespace1[ k ] = { source: sourceObject[ k ] }) 30 Object.keys(sourceObject).forEach(k => obj.resources.namespace1[ k ] = { source: sourceObject[ k ] })
31} 31}
32 32
33jsToXliff12(obj, (err, res) => { 33saveToXliffFile(playerTarget, obj, err => {
34 if (err) { 34 if (err) {
35 console.error(err) 35 console.error(err)
36 process.exit(-1) 36 process.exit(-1)
37 } 37 }
38 38
39 writeFile(playerTarget, res, err => { 39 process.exit(0)
40 if (err) {
41 console.error(err)
42 process.exit(-1)
43 }
44
45 process.exit(0)
46 })
47}) 40})
48 41
49// Then, the server strings 42// Then, the server strings
43
44function saveToXliffFile (targetPath: string, obj: any, cb: Function) {
45 jsToXliff12(obj, (err, res) => {
46 if (err) return cb(err)
47
48 writeFile(playerTarget, res, err => {
49 if (err) return cb(err)
50
51 return cb(null)
52 })
53 })
54}
diff --git a/scripts/i18n/generate.sh b/scripts/i18n/generate.sh
index 0a5b6dee1..f93d6cc03 100755
--- a/scripts/i18n/generate.sh
+++ b/scripts/i18n/generate.sh
@@ -3,13 +3,12 @@
3set -eu 3set -eu
4 4
5cd client 5cd client
6npm run ng -- xi18n --i18n-locale "en-US" --output-path locale/source --out-file messages_en_US.xml 6npm run ng -- xi18n --i18n-locale "en-US" --output-path locale/source --out-file angular_en_US.xml
7npm run ngx-extractor -- --locale "en-US" -i 'src/**/*.ts' -f xlf -o src/locale/source/messages_en_US.xml 7npm run ngx-extractor -- --locale "en-US" -i 'src/**/*.ts' -f xlf -o src/locale/source/angular_en_US.xml
8 8
9# Zanata does not support inner elements in <source>, so we hack these special elements 9# Zanata does not support inner elements in <source>, so we hack these special elements
10# This regex translate the Angular elements to special entities (that we will reconvert on pull) 10# This regex translate the Angular elements to special entities (that we will reconvert on pull)
11#sed -i 's/<x id=\(.\+\?\)\/>/\&lt;x id=\1\/\&gt;/g' src/locale/source/messages_en_US.xml 11perl -pi -e 's|<x id=(.+?)/>|&lt;x id=\1/&gt;|g' src/locale/source/angular_en_US.xml
12perl -pi -e 's|<x id=(.+?)/>|&lt;x id=\1/&gt;|g' src/locale/source/messages_en_US.xml
13 12
14# Add our strings too 13# Add our strings too
15cd ../ 14cd ../
diff --git a/scripts/i18n/pull-hook.sh b/scripts/i18n/pull-hook.sh
index dec426b88..3d57040cc 100755
--- a/scripts/i18n/pull-hook.sh
+++ b/scripts/i18n/pull-hook.sh
@@ -4,7 +4,6 @@ set -eu
4 4
5# Zanata does not support inner elements in <source>, so we hack these special elements 5# Zanata does not support inner elements in <source>, so we hack these special elements
6# This regex translate the converted elements to initial Angular elements 6# This regex translate the converted elements to initial Angular elements
7#sed -i 's/\&lt;x id=\(.\+\?\)\/\&gt;/<x id=\1\/>/g' client/src/locale/target/*
8 7
9for i in 1 2 3; do 8for i in 1 2 3; do
10 perl -pi -e 's|&lt;x id=(.+?)/&gt;([^"])|<x id=\1/>\2|g' client/src/locale/target/*.xml 9 perl -pi -e 's|&lt;x id=(.+?)/&gt;([^"])|<x id=\1/>\2|g' client/src/locale/target/*.xml