-
Notifications
You must be signed in to change notification settings - Fork 51
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 and Mantra #164
Comments
This is a very valid question. I like to start a chapter on the spec. But, I'm quite not sure how to do it since specially I haven't worked with i18n based apps. Looking for some ideas for this. But, we should not break our core principles unless if there's a real reason. So, this is how I think about this.
import {T} from 'my-i18n';
import React from 'react';
const MyClass = () => (
<div>{T('some-text-here')}</div>
); Then we can configure this import {setLang} from 'my-i18n';
FlowRouter('/:lang/:page', function(params) {
setLang(params.lang);
// ... other FR stuff
}); |
This point is definitely a must. Concerning the reactivity, it allows to avoid relying on the router to change the UI language. I would say it is a good thing. What would be great would be to set a Locale field in the The package universe:i18n should allow this but I can't get the other files (besides English) : basically, it inserts a script node in the document head, expecting the translation to be somewhere in the public folder. As far as I can tell, it is not working. Also note the use of a refresh mixin to update React component when locale is changed. |
As we now have access to the npm registry. Is there not a big "standard" node library that we can use for this? Would be great to not depend on a meteor package for this. And it would be a great thing if all mantra fanatics were using the same i18n "standard". So |
i18next would be my first choice, as npm package (I did a bit of naive research). It has a plugin system but out of the box, it is not something you can use with meteor (e.g. xhr requests to load new language files, by plugin). It would require an integration effort, what most of i18n package basically did. That would be great to have a i18next plugin for meteor in mantra flavour, a package or a wrapper npm, but to be honest, I feel that it's out of my league and I don't have enough time to make it. |
Currently, we are moving our issues to Mantra Talk. So, we found a really good question about i18n and a potential solution. |
Since Mantra is supposed to be an architecture suited for large project, I miss a clear guideline on i18n integration. It has been mentioned in 2 issues (#44 and #102) but it does not answer to common/general questions people could have:
The text was updated successfully, but these errors were encountered: