english words as keys, so english is base ISSUES • you want to change one translation and you have to find all keys occurrences • same keys could have different translations • translators want to have one place to rule all translations • pluralisation, can be even multiple numbers in one string
• ngettext function for pluralisation • xgettext utility for extracting keys from your files • support contextual translation • you should pass static string to ngettext function • xgettext utility extracts all keys from source files to one .po file
loading and parsing .po files in browser (gettext-js) • xgettext does not support ES6 • you should write gettext(‘’) function in sources • there are many solutions for loading .json and provide localisation function (angular- gettext, angular-translate, react-intl, i18next)
all localised string from templates and components to .pot file with all keys included (angular-gettext-cli, or grunt, or gulp, or webpack) • open .pot with localise.biz online editor • edit translations • export nl.po or directly to .js/.json • compile to js (angular-gettext-cli, or grunt, or gulp, or webpack, https://localise.biz/free/ converter/po-to-json) • put your .pot and .po files to git • include .js file with localised string and use it with your instrument for localisations