"tog-ccmeonemails": "Send me copies of emails I send to other users",
"tog-diffonly": "Do not show page content below diffs",
"tog-showhiddencats": "Show hidden categories",
- "tog-norollbackdiff": "Omit diff after performing a rollback",
+ "tog-norollbackdiff": "Don't show diff after performing a rollback",
"tog-useeditwarning": "Warn me when I leave an edit page with unsaved changes",
"tog-prefershttps": "Always use a secure connection when logged in",
"underline-always": "Always",
use MediaWiki\Logger\LoggerFactory;
// This endpoint is supposed to be independent of request cookies and other
-// details of the session. Log warnings for violations of the no-session
-// constraint.
-define( 'MW_NO_SESSION', 'warn' );
+// details of the session. Enforce this constraint with respect to session use.
+define( 'MW_NO_SESSION', 1 );
require __DIR__ . '/includes/WebStart.php';
'scripts' => [
'resources/lib/moment/moment.js',
'resources/src/moment-global.js',
- 'resources/src/moment-local-dmy.js',
],
'languageScripts' => [
'af' => 'resources/lib/moment/locale/af.js',
'zh-hans' => 'resources/lib/moment/locale/zh-cn.js',
'zh-hant' => 'resources/lib/moment/locale/zh-tw.js',
],
+ // HACK: skinScripts come after languageScripts, and we need locale overrides to come
+ // after locale definitions
+ 'skinScripts' => [
+ 'default' => [
+ 'resources/src/moment-locale-overrides.js',
+ ],
+ ],
'targets' => [ 'desktop', 'mobile' ],
],
+++ /dev/null
-// 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'
- }
-} );
--- /dev/null
+// 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.
+moment.locale( moment.locale(), {
+ preparse: function ( s ) {
+ var i,
+ table = mw.language.getDigitTransformTable();
+ if ( mw.config.get( 'wgTranslateNumerals' ) ) {
+ for ( i = 0; i < 10; i++ ) {
+ if ( table[ i ] !== undefined ) {
+ s = s.replace( new RegExp( mw.RegExp.escape( table[ i ] ), 'g' ), i );
+ }
+ }
+ }
+ // HACK: momentjs replaces commas in some languages, which is the only other use of preparse
+ // aside from digit transformation. We can only override preparse, not extend it, so we
+ // have to replicate the comma replacement functionality here.
+ if ( [ 'ar', 'ar-sa', 'fa' ].indexOf( mw.config.get( 'wgUserLanguage' ) ) !== -1 ) {
+ s = s.replace( /،/g, ',' );
+ }
+ return s;
+ },
+ postformat: function ( s ) {
+ var i,
+ table = mw.language.getDigitTransformTable();
+ if ( mw.config.get( 'wgTranslateNumerals' ) ) {
+ for ( i = 0; i < 10; i++ ) {
+ if ( table[ i ] !== undefined ) {
+ s = s.replace( new RegExp( mw.RegExp.escape( i ), 'g' ), table[ i ] );
+ }
+ }
+ }
+ // HACK: momentjs replaces commas in some languages, which is the only other use of postformat
+ // aside from digit transformation. We can only override postformat, not extend it, so we
+ // have to replicate the comma replacement functionality here.
+ if ( [ 'ar', 'ar-sa', 'fa' ].indexOf( mw.config.get( 'wgUserLanguage' ) ) !== -1 ) {
+ s = s.replace( /,/g, '،' );
+ }
+ return s;
+ }
+} );