From 5b06989c66ae9f81a141a6938b8b5514cacfa049 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20B=C3=B6sch-Plepelits?= Date: Wed, 15 Jan 2020 10:11:58 +0100 Subject: [PATCH] Create locales `nb` and `tr` and add documentation how to add locales --- README.md | 15 +++++++++++++++ locales/nb.js | 7 +++++++ locales/tr.js | 7 +++++++ 3 files changed, 29 insertions(+) create mode 100644 locales/nb.js create mode 100644 locales/tr.js diff --git a/README.md b/README.md index da5e7595..256ae41f 100644 --- a/README.md +++ b/README.md @@ -138,3 +138,18 @@ With the function `register_hook` you can hook into several functions. The follo * `show-popup`: called when a popup is being displayed. Parameters: data (see properties in doc/TwigJS.md), category, dom, callback. * `options_save`: called when options are saved. Parameters: options (the new object), old_options (before save) * `initFinish`: called when the app initialization finishes + +### New locale +* Add language code to the `$languages` array in conf.php (and conf.php-dist) +* Create file `locales/CODE.js` with: +```js +global.locale = { + id: 'CODE', + moment: require('moment'), + // replace 'en' by 'CODE', when a translation for date-format has been submitted + osmDateFormatTemplates: require('openstreetmap-date-format/templates/en') +} + +require('moment/locale/CODE') +``` +* Run `npm run build-locales` diff --git a/locales/nb.js b/locales/nb.js new file mode 100644 index 00000000..ed4f4fd3 --- /dev/null +++ b/locales/nb.js @@ -0,0 +1,7 @@ +global.locale = { + id: 'nb', + moment: require('moment'), + osmDateFormatTemplates: require('openstreetmap-date-format/templates/en') +} + +require('moment/locale/nb') diff --git a/locales/tr.js b/locales/tr.js new file mode 100644 index 00000000..401d074b --- /dev/null +++ b/locales/tr.js @@ -0,0 +1,7 @@ +global.locale = { + id: 'tr', + moment: require('moment'), + osmDateFormatTemplates: require('openstreetmap-date-format/templates/en') +} + +require('moment/locale/tr')