问题标签 [ember-i18n]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
ember.js - 翻译内的 Ember i18n 动态链接
我想知道如何将链接传递给{{t}}
助手。我目前正在使用Ember i18n的 v3.0.1。
显然,您不能将链接助手传递给 at 助手(类似于
当然不会工作)。
所以我在想,也许我可以创建一个返回整个链接的自定义道具。但话又说回来,我如何创建该链接?有谁知道与link-to
助手具有相同参数但仅返回链接(在我的情况下为'page'
and model
)的方法?
ember.js - 如何从初始化程序中设置 i18n.locale
我想在 EmberJS 的初始化程序中设置“i18n.locale”。
我通过 Ember-CLI 和 ember-i18n 使用 1.12。
我试过这个
但我收到Assertion Failed: Path 'i18n.locale' must be global if no obj is given.
ember.js - Emberjs ember-i18n 复数不起作用
我的 en/transaltion.js 中有以下内容
hbs有以下
没有显示任何内容,但如果我添加 {{t 'AllDogs.Dogs.one'}} 它即将出现,任何指示都会有所帮助。
ember.js - 如何在浏览器刷新时记住 ember-i18n 语言选择
我首先在我的应用程序控制器中尝试了这样的事情:
但这仅在用户登录时才有效。如果没有,则始终设置为默认值。
然后我在这个答案中尝试了使用初始化器的东西。
如何从 Artych 的初始化程序中设置 i18n.locale
但是我如何记住在浏览器中完成的最后一个选择?
谢谢
ember.js - 如何在 Ember-i18n 中翻译控制器成员数组?
在我的客户控制器中,我定义了一些用于填充选择输入(下拉)选项的常量数组。
正常的解决方案是使用 translationMacro 函数 t() 或 this.get('i18n').t() 围绕翻译键,但它们不能用于对象或数组内部的“this”不会引用控制器的情况.
解决这种情况的最佳做法是什么?
javascript - Configure ember i18n
I'm trying to use the ember addon ember-i18n, i already read all the documentation, but i just can't figure out why is not working.
I have already installed the addon and generated three locations: en-us, pt-BR and es and configure following the instructions in github, but don't seems to work. What could be the problem??
All code:
routes/applications.js:
locales/pt-BR/translations.js:
config/environment.js:
templates/index.js:
output:
ember.js - 在 Mixin 中使用 i18n?
有没有办法在 Mixin 中使用 i18n。我想创建 Mixins 作为我的字段的配置,我需要翻译标签,但据我阅读https://github.com/jamesarosen/ember-i18n/wiki/Doc:-i18n-Service我看不到实现这一点的机会。
ember.js - 在 Ember 中为 ember-i18n 动态渲染组件
首先,ember 的组件助手在这种情况下没有帮助。只有当我知道需要渲染多少个组件以及以什么顺序渲染时,这才会有所帮助。
我需要能够基于类似的字符串呈现组件:
{{user}} has made a bid of {{bid}}
,其中:
{{user}}
并将{{bid}}
替换为组件。- 给定的字符串是未知的,具有未知数量的动态部分表示组件(组件将与给定的字符串一起传入)。
如果这些动态部分是助手,这将很容易 - 但助手只是不会为我的游戏中的某些项目剪掉它。
理想情况下,我可以做这样的事情:
ember 有可能吗?
javascript - Ember-i18n location fallback
I am trying to introduce ember-i18n
into my current project to manage translations across different varieties of english. Specifically, aiming to handle en-US
& general en
words. The issue I am having is that even if I specify the i18n.locale
to be en-US
it still uses the translations form the en/translations.js
file. This is happening even if the defaultLocale
is set to en-US
in the config/environment.js
I have specified two translation files:
with the following contents:
app/locales/en/translations.js
app/locales/en-US/translations.js
Any ideas why the I can't get the location fallback to work as intended?
references:
javascript - Ember.js / Ember-i18n:是否可以从 Handlebars 模板中迭代翻译文件中的属性?
假设我有以下翻译代码:
我想从我的 Handlebars 模板中迭代 languageOptions 中的属性。我也在使用 ember-i18n 插件。有没有办法做一些像我在这里尝试做的事情?(不幸的是,下面的代码不起作用。)