大佬教程收集整理的这篇文章主要介绍了使用角度平移的多重化的AngularJS平移,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
例如,我有变量peopleCount.
> peopleCount = 1翻译应该是:english:{{peopleCount}}此人喜欢这个立陶宛语:{{peopleCount}} zmogus tai megsta
>如果peopleCount超过1英文翻译将是:{{peopleCount}}这样的人.
但对于立陶宛语翻译:
>如果peopleCount介于2和9之间,或任何以这些数字结尾的数字,除了以第4个规则中提供的数字结尾的数字(例如:225,249,210< ---这些是正确的数字.并且不正确的数字:215,250 ...).它将是{{peopleCount}} zmones tai megsta
>如果计数在10到20或30之间,40或任何其他以零或150或90结尾的数字,那将是{{peopleCount}} zmoniu tai megsta
我该如何做到这一点?
安装
您可以通过bower安装此软件包:
$bower install angular-translate-interpolation-messageformat
之后,按顺序包含messageformat和angular-translate-interpolation-messageformat的必要脚本:
<script src="path/to/messageformat.js"></script> <script src="path/to/angular-translate-interpolation-messageformat.js"></script>
最后在你的config函数中调用$translateProvider中的usemessageformatInterpolation函数:
$translateProvider.usemessageformatInterpolation();
将angular-translate-interpolation-messageformat安装到您的应用程序后,您可以使用它.
例如,您可以为@L_607_18@“PEOPLE”创建英语本地化,如下所示:
{ "PEOPLE" : "{peopleCount,plural,one {There is one man (in lithuanian)} few {# zmones tai megsta} other {# zmoniu tai megsta}}" }
而不是像你这样在你的HTML中使用它:
<span translate="PEOPLE" translate-values="{peopleCount: 12}" translate-interpolation="messageformat"></span>
以上是大佬教程为你收集整理的使用角度平移的多重化的AngularJS平移全部内容,希望文章能够帮你解决使用角度平移的多重化的AngularJS平移所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。