相关疑难解决方法(0)

使用@angular/localize 本地化后,如何“提供”原始应用程序?

我正在使用 Angular 的本地化@angular/localize,在配置它以将应用程序翻译成不同的语言后,我尝试使用“ng serve”提供它的默认版本,但出现此错误:

An unhandled exception occurred: The development server only supports localizing a single locale per build.
Run Code Online (Sandbox Code Playgroud)

我基于此尝试使用不同的端口:How to serve different Angular locales during development using ng serve?但无济于事。

对于翻译版本的一切作品用“NG服务--configuration = FR”。构建正常工作,在 dist/App 文件夹中创建“en-US”和“fr”文件夹。

当我在 dev-server 中删除 inlineLocales.size 条件时,一切正常,没有错误:

if (i18n.shouldInline && tsConfig.options.enableIvy !== false) {
    //if (i18n.inlineLocales.size > 1) {
    //    throw new Error('The development server only supports localizing a single locale per build');
    //}
    await setupLocalize(i18n, browserOptions, webpackConfig);
} …
Run Code Online (Sandbox Code Playgroud)

angular-i18n angular angular-localize

7
推荐指数
3
解决办法
2116
查看次数

标签 统计

angular ×1

angular-i18n ×1

angular-localize ×1