Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i18n with mustache [like: {{_i}}..{{/i}}]? #24

Closed
marcinkoziej opened this issue Aug 26, 2011 · 3 comments
Closed

i18n with mustache [like: {{_i}}..{{/i}}]? #24

marcinkoziej opened this issue Aug 26, 2011 · 3 comments

Comments

@marcinkoziej
Copy link

Hello.
What's the preferred strategy to i18nalize a mustache template?

Twitter's fork of Mustache.js uses {{_i}} {{/i}} sections to callout to gettext.

Will this be ported to main mustache spec? Or should One just provide a lambda and use it like {{#i}}Some text{{/i}} ?

@pvande
Copy link
Contributor

pvande commented Aug 26, 2011

Lambdas are definitely the preferred method for this at this time.

Various implementations offer tricks to help you with this, as well.

In the Ruby version of Mustache, you can add methods to the Mustache class (or any subclass thereof), and they will be immediately available when rendering any instance.

Milk gives you the Milk.helpers object, which can be used to introduce globally available data and functions. http://bit.ly/pZS5M3

Internationalizing interpolated data can also be done, though it's not universally supported. http://bit.ly/pZgdAq

@spullara
Copy link
Collaborator

I have two different kinds of lambdas in my implementation, ones that take template text and return template text and ones that take output text and return output text. It appears that the current spec module only supports the first case.

@jgonggrijp
Copy link
Member

Closing this as the question seems to have been answered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants