【问题标题】:ng-pluralize with yml html translationng-pluralize 与 yml html 翻译
【发布时间】:2015-05-22 16:31:04
【问题描述】:

我正在尝试使用 ng-pluralize 根据 yml 翻译有条件地显示 HTML。不幸的是,ng-pluralize 忽略了 HTML,并显示为插入计数的字符串文字。有没有可能做我想做的事?

HAML

%span(ng-if="user.streak_count" ng-pluralize 
count="user.streak_count" when="{'1': #{t('.one_streak_html')},
'other': #{t('.streak_html')} }")

YML

streak_html: "'<b>{}</b> days in a row'"
one_streak_html: "'<b>{}</b> day in a row'"

显示

<b>2</b> days in a row

【问题讨论】:

  • 你解决了吗?我们在这里遇到了类似的问题。
  • @Robert 我似乎不知道在哪里,但我记得在 repo 中读到了一个未解决的问题,说它目前不受支持。不幸的是,最终得到了更丑陋的东西:(

标签: javascript angularjs yaml angularjs-ng-pluralize


【解决方案1】:

这似乎有点晚了,但如果有人对此仍有问题,我创建了可以解决此问题的指令。可以找到here

你可以看到它在行动here

【讨论】:

    猜你喜欢
    • 2014-02-24
    • 2015-01-31
    • 2016-06-30
    • 1970-01-01
    • 2015-11-17
    • 1970-01-01
    • 1970-01-01
    • 2012-10-22
    • 2023-03-24
    相关资源
    最近更新 更多