-
Notifications
You must be signed in to change notification settings - Fork 14
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
Localize dates and numbers #30
Comments
Numbers should be simple using http://babel.pocoo.org/en/latest/numbers.html
Though it doesn't seem to work for shorter numbers:
Do you know how to localize just years (vs. full dates) using
When printing dates I usually use https://en.wikipedia.org/wiki/ISO_8601 instead of localizing; at least in the USA the "normal" local format is ambiguous about month/day coming first. That standard specifies years as being printed as just 4 digits. Adding localization like a period after the year seems reasonable though. |
Unfortunately, I'm not a programmer, so I can't help really help in this case :-(( I don't understand why you think that it does not work for shorter numbers (it looks good to me, it's just one number which does not need a separator anyway):
|
Shouldn't it be "2.", like we would use "Showing {num} out of {num}..." at the bottom of the page? Or maybe I am misunderstanding... is it only ordinals like "1." meaning "first"? In the example of the bottom of the page, "Prikaz rezultata: 1. – 15. od 4,396,586", should the total be "4.396.586" or "4.396.586."? And if we had (hypothetically) paged to late results, would it be ""Prikaz rezultata: 1.000. – 1.015. od 4.396.586"? |
Yes, it's about ordinals. Just as dates and years, ordinals also need the period. "Prikaz rezultata: "Prikaz rezultata: 1. – 15. od 4.396.586" Thousands separator character: If
in order to avoid breaking long numbers due to automatic line wrap and word wrap. |
Finally revisiting this, and maybe I understand better. The ordinal/non-ordinal distinction can be handled in the template, as opposed to trying to get babel's number formatting routine to figure it out. But the separators (etc) are best left to babel. For the year, I can create a template that passes the 4-digit year through with no separator, but allows locale-specific wrapping of the year string; in this case adding a period in the template. I will try to get these changes pushed soon. |
Most of the numbers should be fixed now. I believe that the year display will be fixed once the translation files are pulled from weblate; i'll keep this issue open until I do that (next week?) and confirm. |
Pushed updates, and they look correct to me (from a brief scan). @milotype if you get a chance, please verifiy and close this issue if it looks good. I'll close some time in the next week or two if I don't hear back. Thanks! It was good to learn how to do this correctly, and should improve localization for all users. |
@bnewbold Your changes look good! But I found one more instance of the issue on the homepage (https://scholar-qa.archive.org/). Please see screenshot below. |
Please enable localized forms for dates (in this case year) and numbers.
For instance, Croatian needs a period after the year. Also, a period is used as thousands separator … other languages use different forms …
The text was updated successfully, but these errors were encountered: