mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-23 16:06:53 +00:00
LanguageData: Use special page alias with spaces
The alias stored in the language files is with underscores, but the value is compared in CommentParser against text with spaces Affected languages: bjn, hu, id, jv, kaa, tl, tpi, vi, war Bug: T327021 Change-Id: I8626627d10a240973e631e24508937a9eee9fb14
This commit is contained in:
parent
25d555087f
commit
ecac4c3bd1
|
@ -71,10 +71,12 @@ class LanguageData {
|
|||
// ApiQuerySiteinfo
|
||||
$data['localTimezone'] = $config->get( 'Localtimezone' );
|
||||
|
||||
$data['specialContributionsName'] = $this->specialPageFactory
|
||||
->getLocalNameFor( 'Contributions' );
|
||||
$data['specialNewSectionName'] = $this->specialPageFactory
|
||||
->getLocalNameFor( 'NewSection' );
|
||||
// special page names compared against Title::getText, which contains space
|
||||
// But aliases are stored with underscores (db key) in the alias files
|
||||
$data['specialContributionsName'] = str_replace( '_', ' ', $this->specialPageFactory
|
||||
->getLocalNameFor( 'Contributions' ) );
|
||||
$data['specialNewSectionName'] = str_replace( '_', ' ', $this->specialPageFactory
|
||||
->getLocalNameFor( 'NewSection' ) );
|
||||
|
||||
$localTimezone = $config->get( 'Localtimezone' );
|
||||
// Return all timezone abbreviations for the local timezone (there will often be two, for
|
||||
|
|
|
@ -230,5 +230,13 @@
|
|||
"expected": "../cases/timestamp-format-switch/timestamp-format-switch.json",
|
||||
"config": "../data/enwiki-config.json",
|
||||
"data": "../data/enwiki-data.json"
|
||||
},
|
||||
{
|
||||
"name": "Signatures with Special:Contributions (alias with underscored)",
|
||||
"title": "Talk:Signatures Alias",
|
||||
"dom": "cases/signatures-comments/signatures-contribs-alias-underscore.html",
|
||||
"expected": "../cases/signatures-comments/signatures-contribs-alias-underscore.json",
|
||||
"config": "../data/huwiki-config.json",
|
||||
"data": "../data/huwiki-data.json"
|
||||
}
|
||||
]
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
]
|
||||
},
|
||||
"localTimezone": "UTC",
|
||||
"specialContributionsName": "Contributions",
|
||||
"specialContributionsName": "بەشدارییەکان",
|
||||
"specialNewSectionName": "NewSection",
|
||||
"timezones": {
|
||||
"ckb": {
|
||||
|
|
81
tests/cases/datatest-hu.json
Normal file
81
tests/cases/datatest-hu.json
Normal file
|
@ -0,0 +1,81 @@
|
|||
{
|
||||
"dateFormat": {
|
||||
"hu": "Y. F j., H:i"
|
||||
},
|
||||
"digits": {
|
||||
"hu": [
|
||||
"0",
|
||||
"1",
|
||||
"2",
|
||||
"3",
|
||||
"4",
|
||||
"5",
|
||||
"6",
|
||||
"7",
|
||||
"8",
|
||||
"9"
|
||||
]
|
||||
},
|
||||
"localTimezone": "UTC",
|
||||
"specialContributionsName": "Szerkesztő közreműködései",
|
||||
"specialNewSectionName": "NewSection",
|
||||
"timezones": {
|
||||
"hu": {
|
||||
"UTC": "UTC"
|
||||
}
|
||||
},
|
||||
"contLangMessages": {
|
||||
"hu": {
|
||||
"sunday": "vasárnap",
|
||||
"monday": "hétfő",
|
||||
"tuesday": "kedd",
|
||||
"wednesday": "szerda",
|
||||
"thursday": "csütörtök",
|
||||
"friday": "péntek",
|
||||
"saturday": "szombat",
|
||||
"sun": "vas",
|
||||
"mon": "hét",
|
||||
"tue": "kedd",
|
||||
"wed": "sze",
|
||||
"thu": "csü",
|
||||
"fri": "pén",
|
||||
"sat": "szo",
|
||||
"january": "január",
|
||||
"february": "február",
|
||||
"march": "március",
|
||||
"april": "április",
|
||||
"may_long": "május",
|
||||
"june": "június",
|
||||
"july": "július",
|
||||
"august": "augusztus",
|
||||
"september": "szeptember",
|
||||
"october": "október",
|
||||
"november": "november",
|
||||
"december": "december",
|
||||
"january-gen": "január",
|
||||
"february-gen": "február",
|
||||
"march-gen": "március",
|
||||
"april-gen": "április",
|
||||
"may-gen": "május",
|
||||
"june-gen": "június",
|
||||
"july-gen": "július",
|
||||
"august-gen": "augusztus",
|
||||
"september-gen": "szeptember",
|
||||
"october-gen": "október",
|
||||
"november-gen": "november",
|
||||
"december-gen": "december",
|
||||
"jan": "jan",
|
||||
"feb": "febr",
|
||||
"mar": "márc",
|
||||
"apr": "ápr",
|
||||
"may": "máj",
|
||||
"jun": "jún",
|
||||
"jul": "júl",
|
||||
"aug": "aug",
|
||||
"sep": "szept",
|
||||
"oct": "okt",
|
||||
"nov": "nov",
|
||||
"dec": "dec"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -43,8 +43,8 @@
|
|||
]
|
||||
},
|
||||
"localTimezone": "UTC",
|
||||
"specialContributionsName": "Contributions",
|
||||
"specialNewSectionName": "NewSection",
|
||||
"specialContributionsName": "Доприноси",
|
||||
"specialNewSectionName": "Нови одељак",
|
||||
"timezones": {
|
||||
"sr": {
|
||||
"UTC": "UTC"
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
]
|
||||
},
|
||||
"localTimezone": "Asia/Bangkok",
|
||||
"specialContributionsName": "Contributions",
|
||||
"specialContributionsName": "เรื่องที่เขียน",
|
||||
"specialNewSectionName": "NewSection",
|
||||
"timezones": {
|
||||
"th": {
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
<h2><span class="mw-headline" id="test">test</span></h2>
|
||||
<p>Hello <a href="/wiki/Speci%C3%A1lis:Szerkeszt%C5%91_k%C3%B6zrem%C5%B1k%C3%B6d%C3%A9sei/127.0.0.1" title="Speciális:Szerkesztő közreműködései/127.0.0.1">127.0.0.1</a> 2023. január 13., 10:25 (CET)
|
||||
</p>
|
||||
<dl><dd>Answer <a href="/wiki/Speci%C3%A1lis:Szerkeszt%C5%91_k%C3%B6zrem%C5%B1k%C3%B6d%C3%A9sei/lower_cased" title="Speciális:Szerkesztő közreműködései/lower cased">Lower cased</a> 2023. január 13., 12:25 (CET)</dd></dl>
|
|
@ -0,0 +1,58 @@
|
|||
[
|
||||
{
|
||||
"placeholderHeading": false,
|
||||
"type": "heading",
|
||||
"range": [
|
||||
"0/0/0",
|
||||
"0/0/1"
|
||||
],
|
||||
"headingLevel": 2,
|
||||
"level": 0,
|
||||
"name": "h-127.0.0.1-20230113092500",
|
||||
"id": "h-test-20230113092500",
|
||||
"warnings": [],
|
||||
"replies": [
|
||||
{
|
||||
"type": "comment",
|
||||
"timestamp": "20230113092500",
|
||||
"author": "127.0.0.1",
|
||||
"range": [
|
||||
"2/0",
|
||||
"2/2/30"
|
||||
],
|
||||
"signatureRanges": [
|
||||
[
|
||||
"2/1",
|
||||
"2/2/30"
|
||||
]
|
||||
],
|
||||
"level": 1,
|
||||
"name": "c-127.0.0.1-20230113092500",
|
||||
"id": "c-127.0.0.1-20230113092500-test",
|
||||
"warnings": [],
|
||||
"replies": [
|
||||
{
|
||||
"type": "comment",
|
||||
"timestamp": "20230113112500",
|
||||
"author": "Lower cased",
|
||||
"range": [
|
||||
"4/0/0",
|
||||
"4/0/2/30"
|
||||
],
|
||||
"signatureRanges": [
|
||||
[
|
||||
"4/0/1",
|
||||
"4/0/2/30"
|
||||
]
|
||||
],
|
||||
"level": 2,
|
||||
"name": "c-Lower_cased-20230113112500",
|
||||
"id": "c-Lower_cased-20230113112500-127.0.0.1-20230113092500",
|
||||
"warnings": [],
|
||||
"replies": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
|
@ -17,7 +17,7 @@
|
|||
]
|
||||
},
|
||||
"localTimezone": "Europe/Berlin",
|
||||
"specialContributionsName": "Szerkesztő_közreműködései",
|
||||
"specialContributionsName": "Szerkesztő közreműködései",
|
||||
"timezones": {
|
||||
"hu": {
|
||||
"CEMT": "CEMT",
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
namespace MediaWiki\Extension\DiscussionTools\Tests;
|
||||
|
||||
use MediaWiki\Extension\DiscussionTools\LanguageData;
|
||||
use MediaWiki\MainConfigNames;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
|
||||
/**
|
||||
|
@ -15,10 +16,10 @@ class LanguageDataTest extends IntegrationTestCase {
|
|||
*/
|
||||
public function testGetLocalData( string $langCode, array $config, string $expectedPath ): void {
|
||||
$config += [
|
||||
'ContentLanguage' => $langCode,
|
||||
'UsePigLatinVariant' => false,
|
||||
'TranslateNumerals' => true,
|
||||
'Localtimezone' => 'UTC',
|
||||
MainConfigNames::LanguageCode => $langCode,
|
||||
MainConfigNames::UsePigLatinVariant => false,
|
||||
MainConfigNames::TranslateNumerals => true,
|
||||
MainConfigNames::Localtimezone => 'UTC',
|
||||
];
|
||||
$this->overrideConfigValues( $config );
|
||||
|
||||
|
@ -27,7 +28,7 @@ class LanguageDataTest extends IntegrationTestCase {
|
|||
$services = MediaWikiServices::getInstance();
|
||||
$languageData = new LanguageData(
|
||||
$services->getMainConfig(),
|
||||
$services->getLanguageFactory()->getLanguage( $langCode ),
|
||||
$services->getContentLanguage(),
|
||||
$services->getLanguageConverterFactory(),
|
||||
$services->getSpecialPageFactory()
|
||||
);
|
||||
|
@ -51,7 +52,9 @@ class LanguageDataTest extends IntegrationTestCase {
|
|||
// Has localised digits (T261706)
|
||||
[ 'ckb', [], '../cases/datatest-ckb.json' ],
|
||||
// Has unusual timezone abbreviation (T265500)
|
||||
[ 'th', [ 'Localtimezone' => 'Asia/Bangkok' ], '../cases/datatest-th.json' ],
|
||||
[ 'th', [ MainConfigNames::Localtimezone => 'Asia/Bangkok' ], '../cases/datatest-th.json' ],
|
||||
// Special page alias with underscores (T327021)
|
||||
[ 'hu', [], '../cases/datatest-hu.json' ],
|
||||
];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue