Ján*_*ert 0 internationalization angular-i18n ngx-translate angular
我正在使用 Angular 7。我需要翻译带有变量的文本。假设我想将其翻译成德语。由于语言属性,单词(变量)需要改变位置。
例子:
CN: 以 Robert 身份登录。
DE:罗伯特·安格梅尔代特。
无法决定如何正确处理这种情况。有人可以用一个简单的例子来回答我吗?感谢您的反馈意见。
通常,我处理这样的翻译:
在组件中:
{{'仪表板' | 翻译}}
i18n DE.json:
“仪表板”:“Armaturenbrett”
我需要翻译这样的字符串:
描述:“{{example.asd@qwe.com}} 用户通过 {{deviceType}} 为 {{company}} 上传 {{fileType}}{{fileName}}。”
摘要:“天数:{{daysNumber}};距离:{{distanceCount}}”
小智 5
我不确定我是否正确理解了您的问题。\n这是您的意图吗?
\n\nEn.json:
\n\n"description" : "{{email}} user uploads {{fileType}}{{fileName}} for {{company}} via {{deviceType}}"\nRun Code Online (Sandbox Code Playgroud)\n\nKo.json:
\n\n"description" : "{{email}} \xec\x82\xac\xec\x9a\xa9\xec\x9e\x90\xea\xb0\x80 {{deviceType}}\xec\x9d\x84 \xed\x86\xb5\xed\x95\xb4 {{company}}\xec\x97\x90 \xeb\x8c\x80\xed\x95\x9c {{fileType}} {{fileName}}\xec\x9d\x84 \xec\x97\x85\xeb\xa1\x9c\xeb\x93\x9c\xed\x95\xa9\xeb\x8b\x88\xeb\x8b\xa4"\nRun Code Online (Sandbox Code Playgroud)\n\n网页:
\n\n<span>{{\'description\' | translate : {email : \'example@example.com\', deviceType: \'exampleDevice\', company: \'exampleCompany\', fileType: \'.exe\', fileName: \'exampleName\' } }}</span>\nRun Code Online (Sandbox Code Playgroud)\n
| 归档时间: |
|
| 查看次数: |
2454 次 |
| 最近记录: |