From d79cae683e18969d35c71aa760f89fdbb1115721 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bartosz=20Dziewo=C5=84ski?= Date: Tue, 17 May 2016 04:51:25 +0200 Subject: [PATCH] Don't override all Moment locales to English Calling moment.locale() not only defines a locale, it also sets the current one. The call at the top of moment-locale-overrides.js would always set it to English. Follow-up to c81ab8ae5f89056d23a4b0d36066120b9701d07e. Bug: T135462 Change-Id: Ie1b70bc410ff0c436bed5bcbfffb8d4433a1923f --- resources/Resources.php | 1 + resources/src/moment-dmy.js | 16 ++++++++++++++++ resources/src/moment-locale-overrides.js | 15 --------------- 3 files changed, 17 insertions(+), 15 deletions(-) create mode 100644 resources/src/moment-dmy.js diff --git a/resources/Resources.php b/resources/Resources.php index 3fc5801b65..9a5931f5f9 100644 --- a/resources/Resources.php +++ b/resources/Resources.php @@ -756,6 +756,7 @@ return [ 'de' => 'resources/lib/moment/locale/de.js', 'de-at' => 'resources/lib/moment/locale/de-at.js', 'el' => 'resources/lib/moment/locale/el.js', + 'en' => 'resources/src/moment-dmy.js', 'en-au' => 'resources/lib/moment/locale/en-au.js', 'en-ca' => 'resources/lib/moment/locale/en-ca.js', 'en-gb' => 'resources/lib/moment/locale/en-gb.js', diff --git a/resources/src/moment-dmy.js b/resources/src/moment-dmy.js new file mode 100644 index 0000000000..c67b93e976 --- /dev/null +++ b/resources/src/moment-dmy.js @@ -0,0 +1,16 @@ +// Use DMY date format for Moment.js, in accordance with MediaWiki's date formatting routines. +// This affects English only (and languages without localisations, that fall back to English). +// http://momentjs.com/docs/#/customization/long-date-formats/ +/*global moment */ +moment.locale( 'en', { + longDateFormat: { + // Unchanged, but have to be repeated here: + LT: 'h:mm A', + LTS: 'h:mm:ss A', + // Customized: + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY LT', + LLLL: 'dddd, D MMMM YYYY LT' + } +} ); diff --git a/resources/src/moment-locale-overrides.js b/resources/src/moment-locale-overrides.js index d49fcdcb68..9af0598ec1 100644 --- a/resources/src/moment-locale-overrides.js +++ b/resources/src/moment-locale-overrides.js @@ -1,19 +1,4 @@ -// Use DMY date format for Moment.js, in accordance with MediaWiki's date formatting routines. -// This affects English only (and languages without localisations, that fall back to English). -// http://momentjs.com/docs/#/customization/long-date-formats/ /*global moment, mw */ -moment.locale( 'en', { - longDateFormat: { - // Unchanged, but have to be repeated here: - LT: 'h:mm A', - LTS: 'h:mm:ss A', - // Customized: - L: 'DD/MM/YYYY', - LL: 'D MMMM YYYY', - LLL: 'D MMMM YYYY LT', - LLLL: 'dddd, D MMMM YYYY LT' - } -} ); // HACK: Overwrite moment's i18n with MediaWiki's for the current language so that // wgTranslateNumerals is respected. -- 2.20.1