Comments (6)
Couldn't you use the {{t}}
helper within your content?
{{#view MyView}}
{{t blah}}
{{/view}}
from ember-i18n.
From what I've seen you cannot concatenate strings to pass into Handlebars,
but I need to dynamically generate the key based on an attribute of my
view. Therefore, I need to pass it using nameBinding
and let the
valueTranslation
live in my view. But then I get a value
attribute in
the DOM, which I absolutely do not want.
On Wed, Feb 20, 2013 at 3:07 PM, Nathan Rapheld [email protected]:
Couldn't you use the {{t}} helper within your content?
{{#view MyView}}
{{t blah}}
{{/view}}—
Reply to this email directly or view it on GitHubhttps://github.com//issues/40#issuecomment-13853345.
from ember-i18n.
If you need dynamic keys, you'll have to do that in the view. I'm not 100% clear about what you're trying to accomplish, but hopefully this example is relevant:
I18n:
Em.I18n.Translations = {
translation.token.alpha: "ay",
translation.token.beta: "bee",
translation.token.gamma: "gee",
};
View:
var MyView = Ember.extend({
foobarBinding: 'controller.someValue',
myTranslatedString: function() {
return I18n.t('translation.token.%@'.fmt(this.get('foobar')));
}.property('foobar')
});
Template:
{{#view MyView}}
{{view.myTranslatedString}}
{{/view}}
from ember-i18n.
If you want the translated text to show up as the <div>
's content, you want the t
helper:
from ember-i18n.
@joefiorini Can you share how you've solved the dynamic keys thing pls?
I have the same issue.
from ember-i18n.
I'm actually not using the plugin anymore. The project I was using it on
got canned. If we revisit it and I figure it out I'll be sure to post
something here.
On Mon, Jul 1, 2013 at 9:23 AM, Thomas [email protected] wrote:
@joefiorini https://github.com/joefiorini Can you share how you've
solved the dynamic keys thing pls?
I have the same issue.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/40#issuecomment-20281113
.
from ember-i18n.
Related Issues (20)
- Adding a `scope` option HOT 3
- Compatibility with fastboot?
- helper creates Ember.Object.extend().create() HOT 3
- emberGetownerPolyfill issue in i18n service HOT 4
- Refactor test helpers
- Passing in multiple translation keys (perhaps to Safely concat them together?) HOT 11
- Setting locale as described fails HOT 2
- switching language locally, not globally HOT 2
- require in get-locales clashes with other locally defined requires HOT 10
- Quest: intent to deprecate HOT 18
- Issue using ember-i18n in qunit 4.2.1 and ember-cli version 2.18.2 HOT 12
- Pluralized do not behave always the same way HOT 7
- Call a translation key dynamically HOT 2
- Getting a language value from locale in a template HOT 4
- Dynamic update of <html lang="en"> with FastBoot support HOT 2
- Interpolating quotes HOT 2
- ;import Service from "ember-i18n/service"; HOT 2
- Babel error HOT 1
- undefined is not an object (evaluating 'this.get('i18n').t') HOT 1
- _locale Computed property is not called more than once HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ember-i18n.