From c689fbb4204e28c3632f2460df73ae1dbc9be203 Mon Sep 17 00:00:00 2001 From: Brad Jorsch Date: Wed, 29 Oct 2014 16:13:29 -0400 Subject: [PATCH] Add i18n for API module help MediaWiki core change I04b1a384 added support for i18n of API module help. This takes advantage of that while still maintaining backwards compatibility with earlier versions of MediaWiki. Once support for MediaWiki before 1.25 is dropped, the methods marked deprecated in this patch may be removed. Change-Id: I67395aff48185f3e09da31b51a08aa2541fe6a17 --- api/ApiLanguageSearch.php | 23 ++++++- api/ApiULSLocalization.php | 21 +++++- i18n/en.json | 134 ++++++++++++++++++++----------------- i18n/qqq.json | 12 +++- 4 files changed, 123 insertions(+), 67 deletions(-) diff --git a/api/ApiLanguageSearch.php b/api/ApiLanguageSearch.php index 05d1c277..d1c4c977 100644 --- a/api/ApiLanguageSearch.php +++ b/api/ApiLanguageSearch.php @@ -49,6 +49,9 @@ class ApiLanguageSearch extends ApiBase { ); } + /** + * @deprecated since MediaWiki core 1.25 + */ public function getParamDescription() { return array( 'search' => 'Search string', @@ -56,10 +59,16 @@ class ApiLanguageSearch extends ApiBase { ); } + /** + * @deprecated since MediaWiki core 1.25 + */ public function getDescription() { return 'Search for language names in any script'; } + /** + * @deprecated since MediaWiki core 1.25 + */ public function getExamples() { return array( 'api.php?action=languagesearch&search=Te', @@ -68,7 +77,17 @@ class ApiLanguageSearch extends ApiBase { ); } - public function getVersion() { - return __CLASS__ . ': ' . ULS_VERSION; + /** + * @see ApiBase::getExamplesMessages() + */ + protected function getExamplesMessages() { + return array( + 'action=languagesearch&search=Te' + => 'apihelp-languagesearch-example-1', + 'action=languagesearch&search=ഫി' + => 'apihelp-languagesearch-example-2', + 'action=languagesearch&search=ഫി&typos=1' + => 'apihelp-languagesearch-example-3', + ); } } diff --git a/api/ApiULSLocalization.php b/api/ApiULSLocalization.php index 40be5132..2699a4d9 100644 --- a/api/ApiULSLocalization.php +++ b/api/ApiULSLocalization.php @@ -54,16 +54,25 @@ class ApiULSLocalization extends ApiBase { ); } + /** + * @deprecated since MediaWiki core 1.25 + */ public function getParamDescription() { return array( 'language' => 'Language string', ); } + /** + * @deprecated since MediaWiki core 1.25 + */ public function getDescription() { return 'Get the localization of ULS in given language'; } + /** + * @deprecated since MediaWiki core 1.25 + */ public function getExamples() { return array( 'api.php?action=ulslocalization&language=ta', @@ -71,7 +80,15 @@ class ApiULSLocalization extends ApiBase { ); } - public function getVersion() { - return __CLASS__ . ': ' . ULS_VERSION; + /** + * @see ApiBase::getExamplesMessages() + */ + protected function getExamplesMessages() { + return array( + 'action=ulslocalization&language=ta' + => 'apihelp-ulslocalization-example-1', + 'action=ulslocalization&language=hi' + => 'apihelp-ulslocalization-example-2', + ); } } diff --git a/i18n/en.json b/i18n/en.json index b88f8a19..72aeaefe 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -1,64 +1,74 @@ { -"@metadata": { - "authors": [ - "Nike", - "Kunal Mehta", - "Niharika", - "Amire80", - "Santhosh Thottingal" - ], - "message-documentation": "qqq" -}, -"uls-desc": "Gives the user several ways to select a language and to adjust language settings", -"uls-plang-title-languages": "Languages", -"uls-ime-helppage": "https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Extension:UniversalLanguageSelector/Input_methods/$1", -"ext-uls-select-language-settings-icon-tooltip": "Language settings", -"ext-uls-undo-language-tooltip-text": "Language changed from $1", -"ext-uls-language-settings-preferences-link": "More language settings", -"uls-betafeature-label": "Compact language links", -"uls-betafeature-desc": "Show a shorter version of the language list, with just the languages that are more relevant to you.", -"ext-uls-display-settings-title": "Display settings", -"ext-uls-display-settings-language-tab": "Language", -"ext-uls-display-settings-fonts-tab": "Fonts", -"ext-uls-display-settings-title-short": "Display", -"ext-uls-display-settings-desc": "Set language used for menus and fonts.", -"ext-uls-language-settings-title": "Language settings", -"ext-uls-language-settings-apply": "Apply settings", -"ext-uls-language-settings-cancel": "Cancel", -"ext-uls-language-buttons-help": "Change the language of menus. Content language will not be affected.", -"ext-uls-display-settings-font-settings": "Font settings", -"ext-uls-display-settings-ui-language": "Display language", -"ext-uls-display-settings-anon-label": "Display language:", -"ext-uls-display-settings-anon-same-as-content": "$1 (same as content)", -"ext-uls-display-settings-anon-log-in-cta": "[[Special:UserLogin|Log in]] to select a different language for menus.", -"ext-uls-webfonts-settings-title": "Download fonts when needed", -"ext-uls-webfonts-settings-info": "Download missing fonts automatically and allow selection of preferred fonts.", -"ext-uls-webfonts-settings-info-link": "More information", -"ext-uls-webfonts-select-for": "Select font for $1", -"ext-uls-webfonts-select-for-ui-info": "Font used for user interface", -"ext-uls-webfonts-select-for-content-info": "Font used for content", -"ext-uls-webfonts-system-font": "System font", -"ext-uls-back-to-display-settings": "Back to display settings", -"ext-uls-input-settings-title": "Input settings", -"ext-uls-input-settings-title-short": "Input", -"ext-uls-input-settings-desc": "Writing in a different language?", -"ext-uls-input-settings-ime-settings": "Input methods for $1", -"ext-uls-input-settings-ui-language": "Language used for writing", -"ext-uls-back-to-input-settings": "Back to input settings", -"ext-uls-ime-help": "How to use", -"ext-uls-disable-input-method": "Use native keyboard", -"ext-uls-input-settings-more-languages-tooltip": "More languages", -"jquery-ime-other-languages": "Other languages", -"jquery-ime-disable-text": "Use native keyboard", -"jquery-ime-help": "Help", -"ext-uls-input-disable": "Disable input tools", -"ext-uls-input-enable": "Enable input tools", -"ext-uls-input-disable-info": "Input tools are disabled.", -"ext-uls-input-settings-noime": "No input methods are available for this language.", -"ext-uls-input-disable-notification": "Input tools have been disabled", -"ext-uls-input-disable-notification-undo": "Undo", -"ext-uls-input-disable-notification-info-personal": "You can enable the input tools at any time from the language settings.", -"ext-uls-input-disable-notification-info-interlanguage": "You can enable the input tools at any time from the language settings next to the language list.", -"ext-uls-language-settings-applying": "Applying...", -"ext-uls-compact-link-count": "{{PLURAL:$1|One more language|$1 more languages}}" + "@metadata": { + "authors": [ + "Nike", + "Kunal Mehta", + "Niharika", + "Amire80", + "Santhosh Thottingal" + ], + "message-documentation": "qqq" + }, + "uls-desc": "Gives the user several ways to select a language and to adjust language settings", + "uls-plang-title-languages": "Languages", + "uls-ime-helppage": "https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Extension:UniversalLanguageSelector/Input_methods/$1", + "ext-uls-select-language-settings-icon-tooltip": "Language settings", + "ext-uls-undo-language-tooltip-text": "Language changed from $1", + "ext-uls-language-settings-preferences-link": "More language settings", + "uls-betafeature-label": "Compact language links", + "uls-betafeature-desc": "Show a shorter version of the language list, with just the languages that are more relevant to you.", + "ext-uls-display-settings-title": "Display settings", + "ext-uls-display-settings-language-tab": "Language", + "ext-uls-display-settings-fonts-tab": "Fonts", + "ext-uls-display-settings-title-short": "Display", + "ext-uls-display-settings-desc": "Set language used for menus and fonts.", + "ext-uls-language-settings-title": "Language settings", + "ext-uls-language-settings-apply": "Apply settings", + "ext-uls-language-settings-cancel": "Cancel", + "ext-uls-language-buttons-help": "Change the language of menus. Content language will not be affected.", + "ext-uls-display-settings-font-settings": "Font settings", + "ext-uls-display-settings-ui-language": "Display language", + "ext-uls-display-settings-anon-label": "Display language:", + "ext-uls-display-settings-anon-same-as-content": "$1 (same as content)", + "ext-uls-display-settings-anon-log-in-cta": "[[Special:UserLogin|Log in]] to select a different language for menus.", + "ext-uls-webfonts-settings-title": "Download fonts when needed", + "ext-uls-webfonts-settings-info": "Download missing fonts automatically and allow selection of preferred fonts.", + "ext-uls-webfonts-settings-info-link": "More information", + "ext-uls-webfonts-select-for": "Select font for $1", + "ext-uls-webfonts-select-for-ui-info": "Font used for user interface", + "ext-uls-webfonts-select-for-content-info": "Font used for content", + "ext-uls-webfonts-system-font": "System font", + "ext-uls-back-to-display-settings": "Back to display settings", + "ext-uls-input-settings-title": "Input settings", + "ext-uls-input-settings-title-short": "Input", + "ext-uls-input-settings-desc": "Writing in a different language?", + "ext-uls-input-settings-ime-settings": "Input methods for $1", + "ext-uls-input-settings-ui-language": "Language used for writing", + "ext-uls-back-to-input-settings": "Back to input settings", + "ext-uls-ime-help": "How to use", + "ext-uls-disable-input-method": "Use native keyboard", + "ext-uls-input-settings-more-languages-tooltip": "More languages", + "jquery-ime-other-languages": "Other languages", + "jquery-ime-disable-text": "Use native keyboard", + "jquery-ime-help": "Help", + "ext-uls-input-disable": "Disable input tools", + "ext-uls-input-enable": "Enable input tools", + "ext-uls-input-disable-info": "Input tools are disabled.", + "ext-uls-input-settings-noime": "No input methods are available for this language.", + "ext-uls-input-disable-notification": "Input tools have been disabled", + "ext-uls-input-disable-notification-undo": "Undo", + "ext-uls-input-disable-notification-info-personal": "You can enable the input tools at any time from the language settings.", + "ext-uls-input-disable-notification-info-interlanguage": "You can enable the input tools at any time from the language settings next to the language list.", + "ext-uls-language-settings-applying": "Applying...", + "ext-uls-compact-link-count": "{{PLURAL:$1|One more language|$1 more languages}}", + "apihelp-languagesearch-description": "Search for language names in any script.", + "apihelp-languagesearch-param-search": "Search string.", + "apihelp-languagesearch-param-typos": "Number of spelling mistakes allowed in the search string.", + "apihelp-languagesearch-example-1": "Search for \"Te\"", + "apihelp-languagesearch-example-2": "Search for \"ഫി\"", + "apihelp-languagesearch-example-3": "Search for \"ഫി\", allowing one typo", + "apihelp-ulslocalization-description": "Get the localization of ULS in given language.", + "apihelp-ulslocalization-param-language": "Language string.", + "apihelp-ulslocalization-example-1": "Get Tamil localization", + "apihelp-ulslocalization-example-2": "Get Hindi localization" } diff --git a/i18n/qqq.json b/i18n/qqq.json index 7b16d619..a34c230b 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -61,5 +61,15 @@ "ext-uls-input-disable-notification-info-personal": "Notification bubble text when input methods are disabled, appears if the ULS is at personal toolbar", "ext-uls-input-disable-notification-info-interlanguage": "Notification bubble text when input methods are disabled, appears if the ULS is at interlanguage toolbar", "ext-uls-language-settings-applying": "Label for apply settings button in language settings screen, while settings being saved. Please keep it short.", - "ext-uls-compact-link-count": "Message next to list of languages which indicates that there are more languages than the ones shown. Parameters:\n* $1 - number of languages" + "ext-uls-compact-link-count": "Message next to list of languages which indicates that there are more languages than the ones shown. Parameters:\n* $1 - number of languages", + "apihelp-languagesearch-description": "{{doc-apihelp-description|languagesearch}}", + "apihelp-languagesearch-param-search": "{{doc-apihelp-param|languagesearch|search}}", + "apihelp-languagesearch-param-typos": "{{doc-apihelp-param|languagesearch|typos}}", + "apihelp-languagesearch-example-1": "{{doc-apihelp-example|languagesearch}}", + "apihelp-languagesearch-example-2": "{{doc-apihelp-example|languagesearch}}", + "apihelp-languagesearch-example-3": "{{doc-apihelp-example|languagesearch}}", + "apihelp-ulslocalization-description": "{{doc-apihelp-description|ulslocalization}}", + "apihelp-ulslocalization-param-language": "{{doc-apihelp-param|ulslocalization|language}}", + "apihelp-ulslocalization-example-1": "{{doc-apihelp-example|ulslocalization}}", + "apihelp-ulslocalization-example-2": "{{doc-apihelp-example|ulslocalization}}" }