Re:Netflix's gamble pays off as subscriptions soar
by skrebbel on Thursday January 19, 2017 @06:17AM
(#13434879)
Yeah, the weirdest thing is that HTTP Accept-Language has been around for decades and is usually configured correctly (to the OS system language). No idea why people use geolocation for language at all, on the web.
[ Parent
| on HN ]
Re:Netflix's gamble pays off as subscriptions soar
by pjc50 on Thursday January 19, 2017 @07:18AM
(#13435174)
People in English-speaking countries are really bad at thinking about localisation since they're not exposed to these issues personally.
Re:Netflix's gamble pays off as subscriptions soar
by gcp on Thursday January 19, 2017 @08:08AM
(#13435446)
Better hope the Chinese don't take over our economy any time soon, I'm sure their devs have the same view on this.
Re:Netflix's gamble pays off as subscriptions soar
by nkristoffersen on Thursday January 19, 2017 @06:22AM
(#13434901)
Localization is easy with javascript. Just look at navigator.language or navigator.languages[0]
Re:Netflix's gamble pays off as subscriptions soar
by aclsid on Thursday January 19, 2017 @07:23AM
(#13435199)
And I suggest following gettext's lead in this regard, so that on your code you would have something like:
i18nstrings = {'My string':<?= _('My string') ?>, 'Second string':<?= _('Second string') ?>};
then you can just do stuff like elem.innerHTML = i18nstrings['My string'];
Of course, you process the language header in the backend.
I reviewed a couple of i18n libraries for javascript but ended up liking this approach more. It was simple and effective.