1

I have the following markup in a template:

<p class="form-action-title"><i class="icon-edit"></i> {{t generic.title.edit}} ...</p>

And this is rendered as:

<p class="form-action-title"><i class="icon-edit"></i> <span id="i18n-14">Editar</span> ...</p>

I would like to completely remove the <span> for the translated text (it messes-up my styling). I have tried with:

{{t generic.title.edit tagName=""}}

But has no effect. The strange thing is that, according to the documentation, the following {{t}}:

{{#view Em.Button titleTranslation="button.add_user.title">
  {{t button.add_user.text}}
{{/view}}

Renders no <span>:

<button title="Add a user">
  Add
</button>

(I haven't tried this, I just trust the docs)

What can I do to get rid of the <span>?

4

1 回答 1

2

两种选择:

补丁源:https ://github.com/jamesarosen/ember-i18n/blob/master/lib/i18n.js#L133和https://github.com/jamesarosen/ember-i18n/blob/master/lib/ i18n.js#L170

或者创建自己的简单助手:

Ember.Handlebars.registerHelper('i18n', function(key) {
  return new Handlebars.SafeString(Ember.I18n.t(key))
});

接着

{{i18n generic.title.edit}}

希望能帮助到你。

于 2013-08-15T10:18:17.490 回答