Siebrand has uploaded a new change for review. https://gerrit.wikimedia.org/r/123527
Change subject: Migrate to JSON i18n ...................................................................... Migrate to JSON i18n Procedure per https://www.mediawiki.org/wiki/Manual:GenerateJsonI18n.php with shim. Change-Id: Id52eb1877430516809b025bee3c458281257eba5 --- M NSFileRepo.i18n.php M NSFileRepo.php A i18n/imgauth/en.json A i18n/imgauth/qqq.json R i18n/nsfilerepo/ar.json R i18n/nsfilerepo/ast.json R i18n/nsfilerepo/be-tarask.json R i18n/nsfilerepo/br.json R i18n/nsfilerepo/bs.json R i18n/nsfilerepo/ca.json R i18n/nsfilerepo/de.json R i18n/nsfilerepo/dsb.json R i18n/nsfilerepo/el.json R i18n/nsfilerepo/en.json R i18n/nsfilerepo/es.json R i18n/nsfilerepo/fa.json R i18n/nsfilerepo/fi.json R i18n/nsfilerepo/fr.json R i18n/nsfilerepo/frp.json R i18n/nsfilerepo/gl.json R i18n/nsfilerepo/gsw.json R i18n/nsfilerepo/he.json R i18n/nsfilerepo/hil.json R i18n/nsfilerepo/hsb.json R i18n/nsfilerepo/hu.json R i18n/nsfilerepo/ia.json R i18n/nsfilerepo/id.json R i18n/nsfilerepo/it.json R i18n/nsfilerepo/ja.json R i18n/nsfilerepo/ko.json R i18n/nsfilerepo/ksh.json R i18n/nsfilerepo/lb.json R i18n/nsfilerepo/mk.json R i18n/nsfilerepo/ml.json R i18n/nsfilerepo/ms.json R i18n/nsfilerepo/nb.json R i18n/nsfilerepo/nl.json R i18n/nsfilerepo/oc.json R i18n/nsfilerepo/pl.json R i18n/nsfilerepo/pms.json R i18n/nsfilerepo/pt-br.json R i18n/nsfilerepo/pt.json R i18n/nsfilerepo/qqq.json R i18n/nsfilerepo/roa-tara.json R i18n/nsfilerepo/ru.json R i18n/nsfilerepo/sk.json R i18n/nsfilerepo/sv.json R i18n/nsfilerepo/ta.json R i18n/nsfilerepo/tl.json R i18n/nsfilerepo/tr.json R i18n/nsfilerepo/uk.json R i18n/nsfilerepo/vi.json R i18n/nsfilerepo/zh-hans.json R i18n/nsfilerepo/zh-hant.json M img_auth.i18n.php 55 files changed, 65 insertions(+), 42 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/NSFileRepo refs/changes/27/123527/1 diff --git a/NSFileRepo.i18n.php b/NSFileRepo.i18n.php index eeb2776..0f21166 100644 --- a/NSFileRepo.i18n.php +++ b/NSFileRepo.i18n.php @@ -14,7 +14,7 @@ $GLOBALS['wgHooks']['LocalisationCacheRecache'][] = function ( $cache, $code, &$cachedData ) { $codeSequence = array_merge( array( $code ), $cachedData['fallbackSequence'] ); foreach ( $codeSequence as $csCode ) { - $fileName = __DIR__ . "/i18n/$csCode.json"; + $fileName = __DIR__ . "/i18n/nsfilerepo/$csCode.json"; if ( is_readable( $fileName ) ) { $data = FormatJson::decode( file_get_contents( $fileName ), true ); foreach ( array_keys( $data ) as $key ) { diff --git a/NSFileRepo.php b/NSFileRepo.php index ba51aa3..b9ed2eb 100644 --- a/NSFileRepo.php +++ b/NSFileRepo.php @@ -35,8 +35,9 @@ $dir = dirname( __FILE__ ) . '/'; # Internationalisation file -$wgMessagesDirs['NSFileRepo'] = __DIR__ . '/i18n'; +$wgMessagesDirs['NSFileRepo'] = __DIR__ . '/i18n/nsfilerepo'; $wgExtensionMessagesFiles['NSFileRepo'] = $dir . 'NSFileRepo.i18n.php'; +$wgMessagesDirs['img_auth'] = __DIR__ . '/i18n/imgauth'; $wgExtensionMessagesFiles['img_auth'] = $dir . 'img_auth.i18n.php'; $wgExtensionFunctions[] = 'NSFileRepoSetup'; diff --git a/i18n/imgauth/en.json b/i18n/imgauth/en.json new file mode 100644 index 0000000..00ee046 --- /dev/null +++ b/i18n/imgauth/en.json @@ -0,0 +1,18 @@ +{ + "@metadata": { + "authors": [ + "Jack D. Pond" + ] + }, + "img-auth-desc": "Image authorisation script", + "img-auth-accessdenied": "Access Denied", + "img-auth-nopathinfo": "Missing PATH_INFO. Your server is not set up to pass this information - may be CGI-based and can't support img_auth. See `Image Authorization` on MediaWiki.", + "img-auth-notindir": "Requested path not in upload directory.", + "img-auth-badtitle": "Unable to construct a valid Title from `$1`.", + "img-auth-nologinnWL": "Not logged in and `$1` not in whitelist.", + "img-auth-nofile": "`$1` does not exist.", + "img-auth-isdir": "`$1` is a directory.", + "img-auth-streaming": "Streaming `$1`.", + "img-auth-public": "The function of img_auth.php is to output files from a private wiki. This wiki is configured as a public wiki. For optimal security, img_auth.php is disabled for this case.", + "img-auth-noread": "User does not have access to read `$1`." +} diff --git a/i18n/imgauth/qqq.json b/i18n/imgauth/qqq.json new file mode 100644 index 0000000..19f1ac8 --- /dev/null +++ b/i18n/imgauth/qqq.json @@ -0,0 +1,18 @@ +{ + "@metadata": { + "authors": [ + "Jack D. Pond" + ] + }, + "img-auth-desc": "[[Image Authorization]] script, see http://www.mediawiki.org/wiki/Manual:Image_Authorization", + "img-auth-accessdenied": "[[Image Authorization]] Access Denied", + "img-auth-nopathinfo": "[[Image Authorization]] Missing PATH_INFO - see english description", + "img-auth-notindir": "[[Image Authorization]] when the specified path is not in upload directory.", + "img-auth-badtitle": "[[Image Authorization]] bad title, parameter `$1` is the invalid title", + "img-auth-nologinnWL": "[[Image Authorization]] logged in and file not whitelisted. Parameter `$1` is the file not in whitelist.", + "img-auth-nofile": "[[Image Authorization]] non existent file, parameter `$1` is the file that does not exist.", + "img-auth-isdir": "[[Image Authorization]] trying to access a directory instead of a file, parameter`$1` is the directory.", + "img-auth-streaming": "[[Image Authorization]] is now streaming file specified by parameter `$1`.", + "img-auth-public": "[[Image Authorization]] an error message when the admin has configured the wiki to be a public wiki, but is using img_auth script - normally this is a configuration error, except when special restriction extensions are used", + "img-auth-noread": "[[Image Authorization]] User does not have access to read file, parameter `$1` is the file" +} diff --git a/i18n/ar.json b/i18n/nsfilerepo/ar.json similarity index 100% rename from i18n/ar.json rename to i18n/nsfilerepo/ar.json diff --git a/i18n/ast.json b/i18n/nsfilerepo/ast.json similarity index 100% rename from i18n/ast.json rename to i18n/nsfilerepo/ast.json diff --git a/i18n/be-tarask.json b/i18n/nsfilerepo/be-tarask.json similarity index 100% rename from i18n/be-tarask.json rename to i18n/nsfilerepo/be-tarask.json diff --git a/i18n/br.json b/i18n/nsfilerepo/br.json similarity index 100% rename from i18n/br.json rename to i18n/nsfilerepo/br.json diff --git a/i18n/bs.json b/i18n/nsfilerepo/bs.json similarity index 100% rename from i18n/bs.json rename to i18n/nsfilerepo/bs.json diff --git a/i18n/ca.json b/i18n/nsfilerepo/ca.json similarity index 100% rename from i18n/ca.json rename to i18n/nsfilerepo/ca.json diff --git a/i18n/de.json b/i18n/nsfilerepo/de.json similarity index 100% rename from i18n/de.json rename to i18n/nsfilerepo/de.json diff --git a/i18n/dsb.json b/i18n/nsfilerepo/dsb.json similarity index 100% rename from i18n/dsb.json rename to i18n/nsfilerepo/dsb.json diff --git a/i18n/el.json b/i18n/nsfilerepo/el.json similarity index 100% rename from i18n/el.json rename to i18n/nsfilerepo/el.json diff --git a/i18n/en.json b/i18n/nsfilerepo/en.json similarity index 100% rename from i18n/en.json rename to i18n/nsfilerepo/en.json diff --git a/i18n/es.json b/i18n/nsfilerepo/es.json similarity index 100% rename from i18n/es.json rename to i18n/nsfilerepo/es.json diff --git a/i18n/fa.json b/i18n/nsfilerepo/fa.json similarity index 100% rename from i18n/fa.json rename to i18n/nsfilerepo/fa.json diff --git a/i18n/fi.json b/i18n/nsfilerepo/fi.json similarity index 100% rename from i18n/fi.json rename to i18n/nsfilerepo/fi.json diff --git a/i18n/fr.json b/i18n/nsfilerepo/fr.json similarity index 100% rename from i18n/fr.json rename to i18n/nsfilerepo/fr.json diff --git a/i18n/frp.json b/i18n/nsfilerepo/frp.json similarity index 100% rename from i18n/frp.json rename to i18n/nsfilerepo/frp.json diff --git a/i18n/gl.json b/i18n/nsfilerepo/gl.json similarity index 100% rename from i18n/gl.json rename to i18n/nsfilerepo/gl.json diff --git a/i18n/gsw.json b/i18n/nsfilerepo/gsw.json similarity index 100% rename from i18n/gsw.json rename to i18n/nsfilerepo/gsw.json diff --git a/i18n/he.json b/i18n/nsfilerepo/he.json similarity index 100% rename from i18n/he.json rename to i18n/nsfilerepo/he.json diff --git a/i18n/hil.json b/i18n/nsfilerepo/hil.json similarity index 100% rename from i18n/hil.json rename to i18n/nsfilerepo/hil.json diff --git a/i18n/hsb.json b/i18n/nsfilerepo/hsb.json similarity index 100% rename from i18n/hsb.json rename to i18n/nsfilerepo/hsb.json diff --git a/i18n/hu.json b/i18n/nsfilerepo/hu.json similarity index 100% rename from i18n/hu.json rename to i18n/nsfilerepo/hu.json diff --git a/i18n/ia.json b/i18n/nsfilerepo/ia.json similarity index 100% rename from i18n/ia.json rename to i18n/nsfilerepo/ia.json diff --git a/i18n/id.json b/i18n/nsfilerepo/id.json similarity index 100% rename from i18n/id.json rename to i18n/nsfilerepo/id.json diff --git a/i18n/it.json b/i18n/nsfilerepo/it.json similarity index 100% rename from i18n/it.json rename to i18n/nsfilerepo/it.json diff --git a/i18n/ja.json b/i18n/nsfilerepo/ja.json similarity index 100% rename from i18n/ja.json rename to i18n/nsfilerepo/ja.json diff --git a/i18n/ko.json b/i18n/nsfilerepo/ko.json similarity index 100% rename from i18n/ko.json rename to i18n/nsfilerepo/ko.json diff --git a/i18n/ksh.json b/i18n/nsfilerepo/ksh.json similarity index 100% rename from i18n/ksh.json rename to i18n/nsfilerepo/ksh.json diff --git a/i18n/lb.json b/i18n/nsfilerepo/lb.json similarity index 100% rename from i18n/lb.json rename to i18n/nsfilerepo/lb.json diff --git a/i18n/mk.json b/i18n/nsfilerepo/mk.json similarity index 100% rename from i18n/mk.json rename to i18n/nsfilerepo/mk.json diff --git a/i18n/ml.json b/i18n/nsfilerepo/ml.json similarity index 100% rename from i18n/ml.json rename to i18n/nsfilerepo/ml.json diff --git a/i18n/ms.json b/i18n/nsfilerepo/ms.json similarity index 100% rename from i18n/ms.json rename to i18n/nsfilerepo/ms.json diff --git a/i18n/nb.json b/i18n/nsfilerepo/nb.json similarity index 100% rename from i18n/nb.json rename to i18n/nsfilerepo/nb.json diff --git a/i18n/nl.json b/i18n/nsfilerepo/nl.json similarity index 100% rename from i18n/nl.json rename to i18n/nsfilerepo/nl.json diff --git a/i18n/oc.json b/i18n/nsfilerepo/oc.json similarity index 100% rename from i18n/oc.json rename to i18n/nsfilerepo/oc.json diff --git a/i18n/pl.json b/i18n/nsfilerepo/pl.json similarity index 100% rename from i18n/pl.json rename to i18n/nsfilerepo/pl.json diff --git a/i18n/pms.json b/i18n/nsfilerepo/pms.json similarity index 100% rename from i18n/pms.json rename to i18n/nsfilerepo/pms.json diff --git a/i18n/pt-br.json b/i18n/nsfilerepo/pt-br.json similarity index 100% rename from i18n/pt-br.json rename to i18n/nsfilerepo/pt-br.json diff --git a/i18n/pt.json b/i18n/nsfilerepo/pt.json similarity index 100% rename from i18n/pt.json rename to i18n/nsfilerepo/pt.json diff --git a/i18n/qqq.json b/i18n/nsfilerepo/qqq.json similarity index 100% rename from i18n/qqq.json rename to i18n/nsfilerepo/qqq.json diff --git a/i18n/roa-tara.json b/i18n/nsfilerepo/roa-tara.json similarity index 100% rename from i18n/roa-tara.json rename to i18n/nsfilerepo/roa-tara.json diff --git a/i18n/ru.json b/i18n/nsfilerepo/ru.json similarity index 100% rename from i18n/ru.json rename to i18n/nsfilerepo/ru.json diff --git a/i18n/sk.json b/i18n/nsfilerepo/sk.json similarity index 100% rename from i18n/sk.json rename to i18n/nsfilerepo/sk.json diff --git a/i18n/sv.json b/i18n/nsfilerepo/sv.json similarity index 100% rename from i18n/sv.json rename to i18n/nsfilerepo/sv.json diff --git a/i18n/ta.json b/i18n/nsfilerepo/ta.json similarity index 100% rename from i18n/ta.json rename to i18n/nsfilerepo/ta.json diff --git a/i18n/tl.json b/i18n/nsfilerepo/tl.json similarity index 100% rename from i18n/tl.json rename to i18n/nsfilerepo/tl.json diff --git a/i18n/tr.json b/i18n/nsfilerepo/tr.json similarity index 100% rename from i18n/tr.json rename to i18n/nsfilerepo/tr.json diff --git a/i18n/uk.json b/i18n/nsfilerepo/uk.json similarity index 100% rename from i18n/uk.json rename to i18n/nsfilerepo/uk.json diff --git a/i18n/vi.json b/i18n/nsfilerepo/vi.json similarity index 100% rename from i18n/vi.json rename to i18n/nsfilerepo/vi.json diff --git a/i18n/zh-hans.json b/i18n/nsfilerepo/zh-hans.json similarity index 100% rename from i18n/zh-hans.json rename to i18n/nsfilerepo/zh-hans.json diff --git a/i18n/zh-hant.json b/i18n/nsfilerepo/zh-hant.json similarity index 100% rename from i18n/zh-hant.json rename to i18n/nsfilerepo/zh-hant.json diff --git a/img_auth.i18n.php b/img_auth.i18n.php index d3bd73c..98d9e44 100644 --- a/img_auth.i18n.php +++ b/img_auth.i18n.php @@ -1,45 +1,31 @@ <?php /** - * Internationalisation file for img_auth script - * This information is only needed if running in version prior to 1.16, otherwise messages are already included in core messages + * This is a backwards-compatibility shim, generated by: + * https://git.wikimedia.org/blob/mediawiki%2Fcore.git/HEAD/maintenance%2FgenerateJsonI18n.php * - * @file - * @ingroup Extensions -*/ - + * Beginning with MediaWiki 1.23, translation strings are stored in json files, + * and the EXTENSION.i18n.php file only exists to provide compatibility with + * older releases of MediaWiki. For more information about this migration, see: + * https://www.mediawiki.org/wiki/Requests_for_comment/Localisation_format + * + * This shim maintains compatibility back to MediaWiki 1.17. + */ $messages = array(); +$GLOBALS['wgHooks']['LocalisationCacheRecache'][] = function ( $cache, $code, &$cachedData ) { + $codeSequence = array_merge( array( $code ), $cachedData['fallbackSequence'] ); + foreach ( $codeSequence as $csCode ) { + $fileName = __DIR__ . "/i18n/imgauth/$csCode.json"; + if ( is_readable( $fileName ) ) { + $data = FormatJson::decode( file_get_contents( $fileName ), true ); + foreach ( array_keys( $data ) as $key ) { + if ( $key === '' || $key[0] === '@' ) { + unset( $data[$key] ); + } + } + $cachedData['messages'] = array_merge( $data, $cachedData['messages'] ); + } -/** English - * @author Jack D. Pond - */ -$messages['en'] = array( -#img_auth script messages -'img-auth-desc' => 'Image authorisation script', -'img-auth-accessdenied' => "Access Denied", -'img-auth-nopathinfo' => "Missing PATH_INFO. Your server is not set up to pass this information - may be CGI-based and can't support img_auth. See `Image Authorization` on MediaWiki.", -'img-auth-notindir' => "Requested path not in upload directory.", -'img-auth-badtitle' => "Unable to construct a valid Title from `$1`.", -'img-auth-nologinnWL' => "Not logged in and `$1` not in whitelist.", -'img-auth-nofile' => "`$1` does not exist.", -'img-auth-isdir' => "`$1` is a directory.", -'img-auth-streaming' => "Streaming `$1`.", -'img-auth-public' => "The function of img_auth.php is to output files from a private wiki. This wiki is configured as a public wiki. For optimal security, img_auth.php is disabled for this case.", -'img-auth-noread' => "User does not have access to read `$1`.", -); - -/** Message documentation (Message documentation) - * @author Jack D. Pond - */ -$messages['qqq'] = array( -'img-auth-desc' => '[[Image Authorization]] script, see http://www.mediawiki.org/wiki/Manual:Image_Authorization', -'img-auth-accessdenied' => "[[Image Authorization]] Access Denied", -'img-auth-nopathinfo' => "[[Image Authorization]] Missing PATH_INFO - see english description", -'img-auth-notindir' => "[[Image Authorization]] when the specified path is not in upload directory.", -'img-auth-badtitle' => "[[Image Authorization]] bad title, parameter `$1` is the invalid title", -'img-auth-nologinnWL' => "[[Image Authorization]] logged in and file not whitelisted. Parameter `$1` is the file not in whitelist.", -'img-auth-nofile' => "[[Image Authorization]] non existent file, parameter `$1` is the file that does not exist.", -'img-auth-isdir' => "[[Image Authorization]] trying to access a directory instead of a file, parameter`$1` is the directory.", -'img-auth-streaming' => "[[Image Authorization]] is now streaming file specified by parameter `$1`.", -'img-auth-public' => "[[Image Authorization]] an error message when the admin has configured the wiki to be a public wiki, but is using img_auth script - normally this is a configuration error, except when special restriction extensions are used", -'img-auth-noread' => "[[Image Authorization]] User does not have access to read file, parameter `$1` is the file", -); \ No newline at end of file + $cachedData['deps'][] = new FileDependency( $fileName ); + } + return true; +}; -- To view, visit https://gerrit.wikimedia.org/r/123527 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id52eb1877430516809b025bee3c458281257eba5 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/NSFileRepo Gerrit-Branch: master Gerrit-Owner: Siebrand <[email protected]> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
