assemble / grunt-assemble-i18n

Assemble middleware for adding i18n support to projects.
24 stars 8 forks source link

i18n helper not accessible in partial #28

Closed ain closed 10 years ago

ain commented 10 years ago

In the partial {{i18n "key"}} will throw up with "The 'language' parameter is not defined", see helpers-i18n.js:28.

Fails to get the language.

jonschlinkert commented 10 years ago

@ain this is a common issue with handlebars, did you search the handlebars documentation?

ain commented 10 years ago

@jonschlinkert I have gone through it, but missed that bit. I'd appreciate a little education for sure so I can be more effective and pushing things forward :)

LaurentGoderre commented 10 years ago

I never found a proper to solution because this is a problem with handlebars, it doesn't provide access to the parent context when changing context. We simply abandon using some helpers because of it. (The problem is with helpers not partials)

jonschlinkert commented 10 years ago

Take a look at these helpers I did. Hopefully it makes sense how I'm using these, I won't have much time to go into detail for a few days.

And they are being used here:

doowb commented 10 years ago

I was reviewing this and I don't think you should be using the i18n helper at all with this plugin. The plugin should be loading in the correct data for the selected language, then you just use the data like in a normal handlebars template: {{description}}.

If there's something else you're trying to do, please re-open this issue. If the issue is for the helper itself, please open the issue on that repo.

ain commented 10 years ago

Thanks @jonschlinkert. @doowb agreed, except that the current implementation of {{de_DE.key}} for instance, is not useful and {{i18n[language].key}} doesn't work. Also, you might need a key from a different language, e.g. to fix it.