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
This commit is contained in:
Brad Jorsch
2014-10-29 16:13:29 -04:00
parent 2aaa5b19d1
commit c689fbb420
4 changed files with 123 additions and 67 deletions

View File

@@ -49,6 +49,9 @@ class ApiLanguageSearch extends ApiBase {
); );
} }
/**
* @deprecated since MediaWiki core 1.25
*/
public function getParamDescription() { public function getParamDescription() {
return array( return array(
'search' => 'Search string', 'search' => 'Search string',
@@ -56,10 +59,16 @@ class ApiLanguageSearch extends ApiBase {
); );
} }
/**
* @deprecated since MediaWiki core 1.25
*/
public function getDescription() { public function getDescription() {
return 'Search for language names in any script'; return 'Search for language names in any script';
} }
/**
* @deprecated since MediaWiki core 1.25
*/
public function getExamples() { public function getExamples() {
return array( return array(
'api.php?action=languagesearch&search=Te', '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',
);
} }
} }

View File

@@ -54,16 +54,25 @@ class ApiULSLocalization extends ApiBase {
); );
} }
/**
* @deprecated since MediaWiki core 1.25
*/
public function getParamDescription() { public function getParamDescription() {
return array( return array(
'language' => 'Language string', 'language' => 'Language string',
); );
} }
/**
* @deprecated since MediaWiki core 1.25
*/
public function getDescription() { public function getDescription() {
return 'Get the localization of ULS in given language'; return 'Get the localization of ULS in given language';
} }
/**
* @deprecated since MediaWiki core 1.25
*/
public function getExamples() { public function getExamples() {
return array( return array(
'api.php?action=ulslocalization&language=ta', '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',
);
} }
} }

View File

@@ -60,5 +60,15 @@
"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-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-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-language-settings-applying": "Applying...",
"ext-uls-compact-link-count": "{{PLURAL:$1|One more language|$1 more languages}}" "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"
} }

View File

@@ -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-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-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-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}}"
} }