1

angular v9アプリを異なるロケール構成で提供しようとすると、ng build --localize期待どおりに動作している間、デフォルト言語が常に表示されます。

node --max_old_space_size=4096 ./node_modules/.bin/ng serve -c=dev,sv --project=my-project-name

angular.json:

   {
    "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
    "version": 1,
    "cli": {
        "packageManager": "npm"
    },
    "newProjectRoot": "projects",
    "projects": {
        "my-project-name": {
            "root": "apps/my-project-name/",
            "sourceRoot": "apps/my-project-name/src/",
            "projectType": "application",
            "i18n": {
                "sourceLocale": "en",
                "locales": {
                    "sv": "i18n/messages.sv.xlf",
                }
            },
            "architect": {
                "build": {
                    "builder": "@angular-devkit/build-angular:browser",
                    "options": {... // other options},
                    "configurations": {
                        "dev": {
                            "fileReplacements": [
                                {
                                    "replace": "apps/my-project-name/src/environments/environment.ts",
                                    "with": "apps/my-project-name/src/environments/environment.dev.ts"
                                }
                            ]
                        },
                        //.. omitted config for staging & production.
                        "sv": {
                            "localize": ["sv"]
                        },
                    },
                    "i18nMissingTranslation": "error"
                },
                "serve": {
                    "builder": "@angular-devkit/build-angular:dev-server",
                    "options": {
                        "browserTarget": "my-project-name:build"
                    },
                    "configurations": {
                        "dev": {
                            "browserTarget": "my-project-name:build:dev"
                        },
                        "sv": {
                            "browserTarget": "my-project-name:build:sv"
                        },
                    }
                },
            }
        }
    }
}




Angular CLI: 9.1.1
Node: 10.19.0
OS: darwin x64

Angular: 9.1.1
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, localize, platform-browser
... platform-browser-dynamic, platform-server, router
... service-worker
Ivy Workspace: Yes

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.901.1
@angular-devkit/build-angular      0.901.1
@angular-devkit/build-optimizer    0.901.1
@angular-devkit/build-webpack      0.901.1
@angular-devkit/core               9.1.1
@angular-devkit/schematics         9.1.1
@angular/cdk                       9.2.1
@angular/flex-layout               9.0.0-beta.29
@angular/material                  9.2.1
@angular/material-moment-adapter   9.2.1
@ngtools/webpack                   9.1.1
@schematics/angular                9.1.0
@schematics/update                 0.901.1
rxjs                               6.5.5
typescript                         3.8.3
webpack                            4.42.0

何が欠けているのか正確にはわかりません。助けていただければ幸いです。ありがとうございます。

4

0 に答える 0