liberapay.com
liberapay.com copied to clipboard
Language variants
Our current i18n infrastructure only supports "top-level" languages, it would be great if it also supported "variants" like Brazilian Portuguese, without adding thousands of duplicate lines in the i18n/
directory.
This issue can be split into multiple steps that don't have to be implemented all at once:
- [x] start using geographic locales to get country-specific formatting of variables (dates, numbers, etc.)
- [ ] add a
locale
cookie to allow users to override their browsers'Accept-Language
headers, but make sure the cookie is ignored when there is a language subdomain (e.g.fr.liberapay.com
should always be in French) - [ ] allow users to choose the “European English” locale (
en_150
) - [ ] allow translations to vary by country
Is it hard to change the current code to support variants?
Apache redirections will be needed to redirect the currently translated pt.liberapay.com
to pt_PT.liberapay.com
, the same with Spanish and other translated languages. I'm worried that the URLs look weird.
@RockyTV It's hard to do it without getting thousands of duplicate lines.
@jorgesumle We won't redirect anything, and we probably shouldn't create subdomains like pt-br
or br.pt
.
Why not use ISO 3166-1 alpha-2 country codes for subdomains? It would allow a wider approach for languages.
The website's content varies by language, not by country.
Okay, I don't know how it works at the moment, but couldn't you just use the Accept-Language
HTTP header and set a cookie that defines which language you'd like to use? And if you want to change your language, it will just fetch the value from the cookie, allowing the user to explicitly define which language they want to browse the site in.
EDIT: it would also get rid of the necessity of subdomains for i18n.
We already use the Accept-Language
header.
The subdomains provide public URLs for each version of a page, which allows linking to a specific version and enables proper indexing by search engines.
This issue is not about cookies or subdomains, it's about sharing translations between language variants. The file format we currently use to store translations doesn't support that.
It could be done by having an extra fallback locale. So pt_BZ > pt_PT > en_US