我想体验 angular i18n ( https://angular.io/guide/i18n#build-from-the-command-line )。我可以使用一种语言环境为我的应用程序提供服务,这没关系。但我无法调试应用程序,因为这是捆绑的。
我正在使用 Angular 12
问题如何在普通开发人员模式下使用国际化(i18n)(没有捆绑应用程序)?或者也许有一个选项可以在没有 i18n 的情况下进行配置,并且只使用 i18n 在生产模式下构建应用程序?
角.json
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"pomodoro-app": {
"projectType": "application",
"schematics": {
"@schematics/angular:component": {
"style": "scss"
},
"@schematics/angular:application": {
"strict": true
}
},
"root": "",
"sourceRoot": "src",
"prefix": "pom",
"i18n": {
"sourceLocale": "en-US",
"locales": {
"pl": {
"translation": "src/locale/messages.pl.xlf"
},
"en": {
"translation": "src/locale/messages.en.xlf"
}
}
},
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"localize": true,
"outputPath": "dist",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"assets": ["src/favicon.ico", "src/assets"],
"styles": ["src/styles/styles.scss"],
"scripts": [],
"aot": true,
"optimization": {
"fonts": false
}
},
"configurations": {
"production": {
"optimization": true,
"sourceMap": false,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{...},
{...}
],
"fileReplacements": [...],
"outputHashing": "all"
},
"development": {
"buildOptimizer": false,
"optimization": false,
"vendorChunk": true,
"extractLicenses": false,
"sourceMap": true,
"namedChunks": true
},
"en": {
"localize": ["en"],
"baseHref": "/en/"
},
"pl": {
"localize": ["pl"],
"baseHref": "/pl/"
}
},
"defaultConfiguration": "production"
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "pomodoro-app:build"
},
"configurations": {
"production": {
"browserTarget": "pomodoro-app:build:production"
},
"en": {
"browserTarget": "pomodoro-app:build:en"
},
"pl": {
"browserTarget": "pomodoro-app:build:pl"
}
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "pomodoro-app:build"
}
},
"test": {...}
}
}
}
},
"defaultProject": "pomodoro-app",
"cli": {
"defaultCollection": "@ngrx/schematics"
}
}
PS我已经检查了文档和现场示例(https://angular.io/generated/live-examples/i18n/stackblitz.html),但我找不到可以帮助我解决这个问题的东西。