angular7 l10n多语言编译

时间:2019-03-09 16:26:48

标签: angular compilation multilingual

我紧跟本文,以“ aot”(更好的性能)实现多语言 https://angular-templates.io/tutorials/about/angular-internationalization-i18n-multi-language-app

但是当我尝试ng运行CXR-WebViews:build:production-en时,出现编译错误。如果我使用ng服务,它仍然可以正确编译。

  1. 错误:

    10%构建4/4模块0个活动警告:无法解析C:/cxr/CXR-WebViews/src/app/dbModels/ProductGroupEx.ts中的ProductGroupEx的所有参数:(?)。这将成为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中的错误

  2. 错误:

    src \ app \ fields \ trading-zone \ enterprise.component.ts.EnterpriseDrop.html(1,12)中的

    ERROR ::属性“ data”受保护,并且只能在类“ 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)::属性“ data”受保护,并且只能在类“ DropDownComponent”及其子类中访问。 src \ app \ fields \ trading-zone \ region.component.ts.RegionDrop.html(1,44)::属性'model2'受保护,并且只能在类'DropDownComponent'及其子类中访问。

它不以某种方式扩展类的正确性。为什么是这样?它不认为我需要发布所有其他类,因为它是编译错误。

angular.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"
}

0 个答案:

没有答案