带有变量的连接字符串在emblem.js中 [英] Concatenation string with variable in emblem.js

查看:62
本文介绍了带有变量的连接字符串在emblem.js中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 我需要在Emblem.js中传递给具有变量值的i18n helper连接字符串常量> model.items中的每个项目
div
tdict。{{item}}

返回错误

 缺少关键字dict。{{item}}的翻译


解决方案

如果您使用Handlebars 1.3+,可以使用 subexpression 。首先,写一个字符串连接助手:

  Ember.Handlebars.helper('concat',function(a,b){
return a + b;
});

然后使用它(对不起,我不知道徽章,所以我要使用正常的stache语法):

  {{t(concat'dict。'item)}} 


I need in Emblem.js to transmit to i18n helper concatenated string constant with variable value, How can i do it?

each item in model.items
    div
        t "dict.{{item}}"

returns error

Missing translation for key "dict.{{item}}"

解决方案

If you're using Handlebars 1.3+, you can use a subexpression. First, write a string concatenation helper:

Ember.Handlebars.helper('concat', function (a, b) {
    return a + b;
});

Then use it like this (sorry, I don't know Emblem so I'm going to use the normal stache syntax):

{{t (concat 'dict.' item)}}

这篇关于带有变量的连接字符串在emblem.js中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆