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

additional options for translation #4

Open
kof opened this issue May 1, 2011 · 2 comments
Open

additional options for translation #4

kof opened this issue May 1, 2011 · 2 comments

Comments

@kof
Copy link

kof commented May 1, 2011

Sometimes you have a string combined with some html or data which don't have to get into translation.

// template
{{e({ opentag: '<b>' , closetag: '</b>'}) "my template is #opentag nice #closetag"}}

// translation string:
my template is nice

// html output
my template is <b> nice </b>
@ricardobeat
Copy link
Owner

I'd rather use something similar to printf()

{{e("<b>", "</b>") "my template is %s nice %s"}

or extend String.prototype

{{e "my template is %s nice %s".format("<b>", "</b>") }}
// coffescript style:
{{e "my template is #{open} nice #{close}".format({ open: "<b>", close: "</b>"}) }}

@kof
Copy link
Author

kof commented May 2, 2011

the first one is also fine, but extending native prototype is a bad idea, because it will affect the whole env.

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

2 participants