Skip to content

Commit

Permalink
Fix i18n
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Florek committed Feb 28, 2020
1 parent bb1b922 commit d086e20
Show file tree
Hide file tree
Showing 22 changed files with 12,474 additions and 1,993 deletions.
32 changes: 7 additions & 25 deletions aio/scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,31 +29,13 @@ function clean {
}

function build::frontend {
say "\nBuilding frontend for default locale: en"
mkdir -p ${FRONTEND_DIR}/en
${NG_BIN} build --aot --prod --outputPath=${TMP_DIR}/frontend/en

languages=($(find i18n/* -type d|cut -d"/" -f2))
ignores=()
if [[ -f "i18n/locale_not_for_build_local" ]]; then
# Add locales to ignore on local setting file.
ignores=($(cat i18n/locale_not_for_build_local))
fi
for language in "${languages[@]}"; do
if [[ " ${ignores[@]} " =~ " ${language} " ]]; then
say "Skip building locale: ${language}"
continue
fi

mkdir -p ${FRONTEND_DIR}/${language}

say "Building frontend for locale: ${language}"
${NG_BIN} build --aot \
--prod \
--i18nFile=${I18N_DIR}/${language}/messages.${language}.xlf \
--i18nFormat=xlf \
--i18nLocale=${language} --outputPath=${TMP_DIR}/frontend/${language}
done
say "\nBuilding localized frontend"
mkdir -p ${FRONTEND_DIR}
${NG_BIN} build \
--aot \
--prod \
--localize \
--outputPath=${FRONTEND_DIR}
}

function build::backend {
Expand Down
4 changes: 0 additions & 4 deletions aio/tsconfig.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
"target": "es5",
"types": ["node"]
},
"files": [
"../src/app/frontend/index.ts",
"../src/app/frontend/polyfills.ts"
],
"include": [
"../src/app/frontend/**/*"
],
Expand Down
1 change: 0 additions & 1 deletion aio/tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
]
},
"files": [
"../src/app/frontend/index.spec.ts",
"../src/app/frontend/polyfills.ts"
],
"include": [
Expand Down
37 changes: 37 additions & 0 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,42 @@
"root": "",
"sourceRoot": "src",
"projectType": "application",
"i18n": {
"sourceLocale": {
"code": "en",
"baseHref": "/"
},
"locales": {
"de": {
"translation": "i18n/de/messages.de.xlf",
"baseHref": "/"
},
"fr": {
"translation": "i18n/fr/messages.fr.xlf",
"baseHref": "/"
},
"ja": {
"translation": "i18n/ja/messages.ja.xlf",
"baseHref": "/"
},
"ko": {
"translation": "i18n/ko/messages.ko.xlf",
"baseHref": "/"
},
"zh": {
"translation": "i18n/zh/messages.zh.xlf",
"baseHref": "/"
},
"zh-Hans": {
"translation": "i18n/zh-Hans/messages.zh-Hans.xlf",
"baseHref": "/"
},
"zh-Hant": {
"translation": "i18n/zh-Hant/messages.zh-Hant.xlf",
"baseHref": "/"
}
}
},
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
Expand All @@ -17,6 +53,7 @@
"main": "src/app/frontend/index.ts",
"tsConfig": "src/app/frontend/../../../aio/tsconfig.app.json",
"polyfills": "src/app/frontend/polyfills.ts",
"i18nMissingTranslation": "error",
"assets": [
{
"glob": "**/*",
Expand Down
2 changes: 1 addition & 1 deletion i18n/locale_conf.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"translations": [ "de", "en", "fr", "ja", "ko", "zh", "zh-cn", "zh-hk", "zh-sg", "zh-tw" ]}
{"translations": [ "de", "en", "fr", "ja", "ko", "zh", "zh-Hans", "zh-Hant-HK", "zh-Hans-SG", "zh-Hant" ]}
66 changes: 33 additions & 33 deletions i18n/messages.xlf

Large diffs are not rendered by default.

File renamed without changes.
5,234 changes: 5,234 additions & 0 deletions i18n/zh-Hans-SG/messages.zh-Hans-SG.xlf

Large diffs are not rendered by default.

File renamed without changes.
5,234 changes: 5,234 additions & 0 deletions i18n/zh-Hans/messages.zh-Hans.xlf

Large diffs are not rendered by default.

File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file source-language="en" datatype="plaintext" original="ng2.template" target-language="zh-hk">
<file source-language="en" datatype="plaintext" original="ng2.template" target-language="zh-Hant-HK">
<body>
<trans-unit id="70cd6a0cff2699d1c553c292ae76f41bb3b8e0de" datatype="html">
<source>Edit a resource</source>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file source-language="en" datatype="plaintext" original="ng2.template" target-language="zh-tw">
<file source-language="en" datatype="plaintext" original="ng2.template" target-language="zh-Hant">
<body>
<trans-unit id="70cd6a0cff2699d1c553c292ae76f41bb3b8e0de" datatype="html">
<source>Edit a resource</source>
Expand Down
1 change: 0 additions & 1 deletion i18n/zh-cn/messages.zh-cn.xlf

This file was deleted.

1 change: 0 additions & 1 deletion i18n/zh-sg/messages.zh-sg.xlf

This file was deleted.

Loading

0 comments on commit d086e20

Please sign in to comment.