当使用来自“@ $localize /localize/”和"ng serve configuration=de“的时,我得到以下信息:

当使用"ng服务“运行该项目时,它的工作非常完美。
在app.component.ts中
public product: TabDefinition = { name: $localize`Products`, route: "/products" };在Polyfills.ts中
import "@angular/localize/init";
import { loadTranslations } from "@angular/localize";
loadTranslations({
"6707361102856436710": "Produkte",
});发布于 2020-03-17 14:57:52
我所做的就是制作一个TranslationComponent,只要您在模板中指定id,并且在$localize调用中它将正确映射
<p i18n="@@pending-changes">You have unsaved changes are you sure you want to navigate?</p>return confirm($localize`:@@pending-changes:You have unsaved changes are you sure you want to navigate?`); <trans-unit id="pending-changes" datatype="html">
<source>You have unsaved changes are you sure you want to navigate?</source>
<target state="translated">Vous avez des modifications non enregistrées, êtes-vous sûr de vouloir naviguer?</target>
<context-group purpose="location">
<context context-type="sourcefile">src/app/shared/component/translations/translations.component.html</context>
<context context-type="linenumber">1</context>
</context-group>
</trans-unit>干杯

发布于 2020-02-11 11:12:44
你加这个了吗?
import '@angular/localize/init'; 你的polyfills.ts文件?
可能是路径问题。试试这个:
import '../node_modules/@angular/localize/init';https://stackoverflow.com/questions/60167454
复制相似问题