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

Internationalisation with Jade template engine? #445

Closed
frenchbread opened this issue Feb 10, 2016 · 4 comments
Closed

Internationalisation with Jade template engine? #445

frenchbread opened this issue Feb 10, 2016 · 4 comments
Projects

Comments

@frenchbread
Copy link

Is it possible to have a kraken app that uses Jade as a template engine and at the same time contains internationalisation?

@grawk
Copy link
Member

grawk commented Feb 10, 2016

Yes you should be able to do this. Are you thinking a single set of jade templates which would draw content from any of multiple locale directories? That would be analogous to all our current examples (which use dust).

You can use bundalo to convert the locale-appropriate properties file into JSON which you can then put into the view model prior to res.render.

I don't have a lot of experience with Jade, but what I have is on the server-side. If you don't plan to render Jade templates on the client (not sure if anybody does that) then the above high-level approach should work.

I'd be happy to work with you on this.

@frenchbread
Copy link
Author

That would be analogous to all our current examples (which use dust).

Sounds cool, but the issue it that since syntax is a bit different, I am not really sure how to set up config files and grab i18n values inside .jade file. (not familiar with dust)

Could you note, what changes should I add to kraken-example-with-i18n in order to have it all set up?

@grawk
Copy link
Member

grawk commented Feb 10, 2016

I'd like to do that. But I probably can't do so terribly quickly. As a small tidbit in the meantime, we are using bundalo here to grab the correct locale content, and we include the content in the data model in res.render. It would be the same mechanism you'd want to use for Jade. Then in the template, you access the view model just as you always would.

@frenchbread
Copy link
Author

Ah, I see. Thanks. I'll try it.

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

No branches or pull requests

2 participants