helpers / handlebars-helpers

188 handlebars helpers in ~20 categories. Can be used with Assemble, Ghost, YUI, express.js etc.
http://assemble.io/helpers/
MIT License
2.22k stars 364 forks source link

Feature: support for nesting in i18n #122

Open ain opened 10 years ago

ain commented 10 years ago

As part of the assemble-contrib-i18n I came across a problem: {{i18n "test.string"}} fails to parse from a following translation file:

test:
  string: "something"

Apparently the helper does not support nested structures. If all is flat, it works.

jonschlinkert commented 10 years ago

I think this helper needs to be reworked so that it doesn't expect a string. Seems like it should work with whatever is on the context, right?

ain commented 10 years ago

It can expect a string, but then it has to parse it, e.g. the dot-notation.

jonschlinkert commented 10 years ago

is there an advantage to doing it that way versus just taking a property from the context?

ain commented 10 years ago

i18n[language].key.subkey is currently not working and there's sometimes a case where you need to go after either another language or a nested property.

I'm currently looking into it already. How do I get the global context of Assemble from inside i18n module? en_GB.something.something works nicely, but it needs to be brought under the i18n umbrella as you suggested in assemble/assemble-contrib-i18n#12. It is really a necessity.