-
Notifications
You must be signed in to change notification settings - Fork 9
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
Multi language support #58
Comments
Yes, though it's kind of the same, here are my 2 cents: We can use a helper function with a string ID parameter, and a javascript object for the translations. var culture = 'String ID (eg. "FR")'; // might want to default this to EN if not auto detected
i18n = function(id){
return translations[culture][id] || id; // we return the string id if no translation was found
}; Our translation object : var translations = {
'FR': {
'some string id': 'corresponding translation',
'some other string id': 'corresponding translation',
...
}
}; We'll probably implement an alias for the i18n function such as On top of this, we'll probably want to implement some proper templating engine for html translations so we don't have to javascript Please note: We need to think about the fact that the meta won't get translated this way, as google robots and social scrappers don't execute JS. |
"JS mumble, template mumble mumble." |
Haha, sure, let's discuss this later :) |
don't reinvent the wheel, use Globalize :) |
We should here discuss how to integrate multi language support in Cryptris.
With my poor programming skills I see two options. Opinions or other suggestions welcomed !
Solution 1:
Replace all literal text by a call to a function translate with the same text (in French) as an argument. The function translate access a table with corresponding translation.
Solution 2:
Replace all literal text by a variable that are defined in a single file, and modify the value of those variable depending on the language.
The text was updated successfully, but these errors were encountered: