Ng: различия между версиями
Перейти к навигации
Перейти к поиску
Vovan (обсуждение | вклад) |
Vovan (обсуждение | вклад) (→Add i18n) |
||
| Строка 26: | Строка 26: | ||
NOT CMD: | NOT CMD: | ||
| − | [1] In file | + | ===[1] In file=== |
package.json | package.json | ||
| Строка 38: | Строка 38: | ||
"build": "ng build --configuration=production,ru --localize", | "build": "ng build --configuration=production,ru --localize", | ||
| − | [2] In file | + | ===[2] In file=== |
| + | |||
| + | angular.json | ||
| + | |||
| + | between sections | ||
| + | |||
| + | "prefix": "app", | ||
| + | <somwhere in here> <--- , | ||
| + | "architect": {...} | ||
| + | |||
| + | add this section: | ||
| + | |||
| + | <ore> | ||
| + | "i18n": { | ||
| + | "sourceLocale": "en-US", | ||
| + | "locales": { | ||
| + | "en": "src/locale/messages.en.xlf", | ||
| + | "ru": "src/locale/messages.ru.xlf" | ||
| + | } | ||
| + | }, | ||
| + | </pre> | ||
| + | |||
| + | ===[3] In file=== | ||
angular.json | angular.json | ||
| Строка 53: | Строка 75: | ||
"localize": ["en"], | "localize": ["en"], | ||
| + | |||
| + | ===Create dir=== | ||
| + | |||
| + | mkdir src/locale | ||
Версия 19:40, 10 октября 2021
Содержание
NG
fixme...
Prep...
npm install -g @angular/cli
Create new SPA angular app
CMD:
ng new my-super-app
NOT CMD:
? Would you like to add Angular routing? Yes ? Which stylesheet format would you like to use? SCSS
Add i18n
CMD:
npm install --save-deps @angular/localize ngx-i18nsupport
NOT CMD:
[1] In file
package.json
in section
scripts
change build script as:
"build": "ng build --configuration=production,ru --localize",
[2] In file
angular.json
between sections
"prefix": "app",
<somwhere in here> <--- ,
"architect": {...}
add this section:
<ore>
"i18n": {
"sourceLocale": "en-US",
"locales": {
"en": "src/locale/messages.en.xlf",
"ru": "src/locale/messages.ru.xlf"
}
},
[3] In file
angular.json
in setion
projects.my-super-app.architect.build.options
add before section
outputPath
this section:
"localize": ["en"],
Create dir
mkdir src/locale