angular - angular7 l10n 多语言编译
问题描述
我按照这篇文章用“aot”(更好的性能)来实现多语言 https://angular-templates.io/tutorials/about/angular-internationalization-i18n-multi-language-app
但是当我尝试 ng run CXR-WebViews:build:production-en 我得到编译错误。如果我使用 ng serve 它仍然编译没有错误。
错误:
10% 构建 4/4 模块 0 activeWarning: Can't resolve all parameters for ProductGroupEx in C:/cxr/CXR-WebViews/src/app/dbModels/ProductGroupEx.ts: (?). 这将成为 Angular v6.x 中的错误警告:无法解析 C:/cxr/CXR-WebViews/src/app/dbModels/ProductEx.ts 中 ProductEx 的所有参数:(?)。这将成为 Angular v6.x 中的错误警告:无法解析 C:/cxr/CXR-WebViews/src/app/dbModels/VatEx.ts 中 VatEx 的所有参数:(?)。这将成为 Angular v6.x 中的错误
错误:
src\app\fields\trading-zone\enterprise.component.ts.EnterpriseDrop.html(1,12) 中的错误::属性“数据”受保护,只能在“DropDownComponent”类及其子类中访问。src\app\fields\trading-zone\enterprise.component.ts.EnterpriseDrop.html(1,44): : 属性“model2”受保护,只能在“DropDownComponent”类及其子类中访问。src\app\fields\trading-zone\enterprise.component.ts.EnterpriseDrop.html(1,44): : 属性“model2”受保护,只能在“DropDownComponent”类及其子类中访问。src\app\fields\trading-zone\region.component.ts.RegionDrop.html(1,12): : 属性“数据”受保护,只能在“DropDownComponent”类及其子类中访问。src\app\fields\trading-zone\region.component.ts.RegionDrop。
不知何故,它没有正确地扩展类。为什么是这样?它不认为我需要发布所有其他类,因为它是一个编译错误。
角.json
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"CXR-WebViews": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "app",
"schematics": {
"@schematics/angular:component": {
"style": "sass"
}
},
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/CXR-WebViews",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"node_modules/bootstrap/dist/css/bootstrap.min.css",
"node_modules/@ng-select/ng-select/scss/default.theme.scss",
"src/styles.scss"
],
"scripts": [],
"es5BrowserSupport": true
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
}
]
},
"production-en": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"outputPath": "dist/CXR-WebViews/en/",
"baseHref": "/en/",
"i18nFile": "src/assets/locale/en.lproj/tables.xlf",
"i18nFormat": "xlf",
"i18nLocale": "en",
"i18nMissingTranslation": "error",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
}
]
},
"production-de": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"outputPath": "dist/CXR-WebViews/de/",
"baseHref": "/de/",
"i18nFile": "src/assets/locale/de.lproj/tables.xlf",
"i18nFormat": "xlf",
"i18nLocale": "de",
"i18nMissingTranslation": "error",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
}
]
},
"production-fr": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"outputPath": "dist/CXR-WebViews/fr/",
"baseHref": "/it/",
"i18nFile": "src/assets/locale/fr.lproj/tables.xlf",
"i18nFormat": "xlf",
"i18nLocale": "it",
"i18nMissingTranslation": "error",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
}
]
},
"production-it": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"outputPath": "dist/CXR-WebViews/it/",
"baseHref": "/it/",
"i18nFile": "src/assets/locale/it.lproj/tables.xlf",
"i18nFormat": "xlf",
"i18nLocale": "it",
"i18nMissingTranslation": "error",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
}
]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "CXR-WebViews:build"
},
"configurations": {
"production": {
"browserTarget": "CXR-WebViews:build:production"
},
"en": {
"browserTarget": "CXR-WebViews:build:production-en"
},
"de": {
"browserTarget": "CXR-WebViews:build:production-de"
},
"fr": {
"browserTarget": "CXR-WebViews:build:production-fr"
},
"it": {
"browserTarget": "CXR-WebViews:build:production-it"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "CXR-WebViews:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"karmaConfig": "src/karma.conf.js",
"styles": [
"src/styles.scss"
],
"scripts": [],
"assets": [
"src/favicon.ico",
"src/assets"
]
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
},
"CXR-WebViews-e2e": {
"root": "e2e/",
"projectType": "application",
"prefix": "",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "CXR-WebViews:serve"
},
"configurations": {
"production": {
"devServerTarget": "CXR-WebViews:serve:production"
}
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": "e2e/tsconfig.e2e.json",
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"defaultProject": "CXR-WebViews"
}
解决方案
推荐阅读
- ibm-cloud - IBM Cloud 帐户已停用
- asp.net-web-api2 - AAD 身份验证后,我的 webAPI 在 http 而不是 https 上重定向
- amazon-web-services - 无法恢复 AWS EC2 公共 IP 地址
- powershell - 如何在 Windows Server Core 中设置默认 Powershell 版本
- pandas - 如何根据熊猫的范围进行匹配
- php - Stripe Prebuilt Checkout Session 在 Laravel 8 中返回 404 错误
- python - 是否可以在单行上使用 pandas.replace 函数?
- python - 按随机生成的权重对元组进行排序
- azure - 如何使用 azure 数据工厂将数据从 azure SQL 数据库增量存储到 azure blob 存储,基于某些条件:需要更新日期
- javascript - 我无法获得我想要的对象值