2016-08-01 71 views
0

我如何本地化包含锚链接在烬1.6中的文本?
这里是例子什么我需要本地化:如何本地化烬链中的锚链接

Go to <a {{bind-attr href="https://www.mypage.com"}} target="_blank">To do some staff</a> and give feedback about your expirience. 
(<a href="javascript:;" data-toggle="collapse">help</a>) 

我知道如何signel文本翻译,通过PARAMS等等......但我不能这样做:

  • 翻译Go to
  • 放链接
  • 翻译and give feedback about your expirience.

,因为在一些其他语言句子将有完全不同的构造。

所以我想知道是否有可能翻译所有在OCE并把链接内翻译?或者另一种方法?

+1

请看看https://github.com/jamesarosen/ember-i18n –

回答

0

让我们回答详细的问题,如果有人在相同的情况下找到他们自己。

这里是转换条目:

myTranslationKey: 'Please email us a {{email}} or call us on +111222333.' 

设置变量控制器:

init: function() { 
    this._super.apply(this, arguments); 

    var emailLink = '<a href="mailto:[email protected]?Subject=Message%20del%20subject" target="_top">[email protected]</a>'; 
    var emailHtmlSafe = Ember.String.htmlSafe(emailLink); 
    var translatedValue = I18n.t('myTranslationKey', {email: emailHtmlSafe}); 

    this.set('translatedValue', translatedValue); 
}, 

然后在模板中放:

{{{translatedValue}}}

要知道,你应该把3 x {