Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Netflix's gamble pays off as subscriptions soar. Parent comment
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.
There are no comments on this comment yet.
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.