-
-
Notifications
You must be signed in to change notification settings - Fork 709
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 made easier for third party applications. #83
base: master
Are you sure you want to change the base?
Conversation
if you include timeago.js inside a large application that already handles i18n, it's now made easy to give timeago.js your own translator() function. and if you don't, timeago will continue to behave the same way than before.
Yep; at first I renamed it (into "convert()" or something like that), but a colleague suggested me to minify the diff and leave you the discretion to give it the best name ever possible. |
Oh ok, I see what you mean. This is an error; I'll fix that asap, my bad. |
…this pull request: #83 - remove bad usage of global variable stringAndNumber - use a consistent name for the substitute() function which was actully not substituing anything anymore
Sorry, I've been meaning to look into some more standard locale/i18n/translation methods for jQuery as I prepare for a Timeago rewrite. Could you fill me in a little more on the significance of the |
I'm not sure if this is a "convention", but in our case (and I hope several others) it's very convenient: our application (OpenERP) uses a rich javascript web client which implements its own i18n mechanism. The This mechanism is also the reason why the resulting string has to be processed in this order: This way to proceed seems more powerful than translating each bit of the string separately, as can't be sure that every language will use the form "[prefix] words [suffix]", or handle the plural with more fineness than "one or more" [2]. This is made really easy thanks to the Hope that helps ! [1] especially when using systems like transifex ou launchpad rosetta |
@ABourguignon Did you know that Timeago's built-in string settings can either take a string or a function? Does that help you in some way here. You could always assign the same function to different settings if that helps. The Russian translation is a good example of this. |
Yep, I know, but it's too early in the code to produce a proper translation. Once again, the translation function has to be applied on the final string, just before number's substitution. See previous explanations and examples in the linked article. |
if you include timeago.js inside a large application that already handles i18n, it's now made easy to give timeago.js your own translator() function. and if you don't, timeago will continue to behave the same way than before.