mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-24 00:13:36 +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
|
// ApiQuerySiteinfo
|
||||||
$data['localTimezone'] = $config->get( 'Localtimezone' );
|
$data['localTimezone'] = $config->get( 'Localtimezone' );
|
||||||
|
|
||||||
$data['specialContributionsName'] = $this->specialPageFactory
|
// special page names compared against Title::getText, which contains space
|
||||||
->getLocalNameFor( 'Contributions' );
|
// But aliases are stored with underscores (db key) in the alias files
|
||||||
$data['specialNewSectionName'] = $this->specialPageFactory
|
$data['specialContributionsName'] = str_replace( '_', ' ', $this->specialPageFactory
|
||||||
->getLocalNameFor( 'NewSection' );
|
->getLocalNameFor( 'Contributions' ) );
|
||||||
|
$data['specialNewSectionName'] = str_replace( '_', ' ', $this->specialPageFactory
|
||||||
|
->getLocalNameFor( 'NewSection' ) );
|
||||||
|
|
||||||
$localTimezone = $config->get( 'Localtimezone' );
|
$localTimezone = $config->get( 'Localtimezone' );
|
||||||
// Return all timezone abbreviations for the local timezone (there will often be two, for
|
// 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",
|
"expected": "../cases/timestamp-format-switch/timestamp-format-switch.json",
|
||||||
"config": "../data/enwiki-config.json",
|
"config": "../data/enwiki-config.json",
|
||||||
"data": "../data/enwiki-data.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",
|
"localTimezone": "UTC",
|
||||||
"specialContributionsName": "Contributions",
|
"specialContributionsName": "بەشدارییەکان",
|
||||||
"specialNewSectionName": "NewSection",
|
"specialNewSectionName": "NewSection",
|
||||||
"timezones": {
|
"timezones": {
|
||||||
"ckb": {
|
"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",
|
"localTimezone": "UTC",
|
||||||
"specialContributionsName": "Contributions",
|
"specialContributionsName": "Доприноси",
|
||||||
"specialNewSectionName": "NewSection",
|
"specialNewSectionName": "Нови одељак",
|
||||||
"timezones": {
|
"timezones": {
|
||||||
"sr": {
|
"sr": {
|
||||||
"UTC": "UTC"
|
"UTC": "UTC"
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"localTimezone": "Asia/Bangkok",
|
"localTimezone": "Asia/Bangkok",
|
||||||
"specialContributionsName": "Contributions",
|
"specialContributionsName": "เรื่องที่เขียน",
|
||||||
"specialNewSectionName": "NewSection",
|
"specialNewSectionName": "NewSection",
|
||||||
"timezones": {
|
"timezones": {
|
||||||
"th": {
|
"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",
|
"localTimezone": "Europe/Berlin",
|
||||||
"specialContributionsName": "Szerkesztő_közreműködései",
|
"specialContributionsName": "Szerkesztő közreműködései",
|
||||||
"timezones": {
|
"timezones": {
|
||||||
"hu": {
|
"hu": {
|
||||||
"CEMT": "CEMT",
|
"CEMT": "CEMT",
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
namespace MediaWiki\Extension\DiscussionTools\Tests;
|
namespace MediaWiki\Extension\DiscussionTools\Tests;
|
||||||
|
|
||||||
use MediaWiki\Extension\DiscussionTools\LanguageData;
|
use MediaWiki\Extension\DiscussionTools\LanguageData;
|
||||||
|
use MediaWiki\MainConfigNames;
|
||||||
use MediaWiki\MediaWikiServices;
|
use MediaWiki\MediaWikiServices;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -15,10 +16,10 @@ class LanguageDataTest extends IntegrationTestCase {
|
||||||
*/
|
*/
|
||||||
public function testGetLocalData( string $langCode, array $config, string $expectedPath ): void {
|
public function testGetLocalData( string $langCode, array $config, string $expectedPath ): void {
|
||||||
$config += [
|
$config += [
|
||||||
'ContentLanguage' => $langCode,
|
MainConfigNames::LanguageCode => $langCode,
|
||||||
'UsePigLatinVariant' => false,
|
MainConfigNames::UsePigLatinVariant => false,
|
||||||
'TranslateNumerals' => true,
|
MainConfigNames::TranslateNumerals => true,
|
||||||
'Localtimezone' => 'UTC',
|
MainConfigNames::Localtimezone => 'UTC',
|
||||||
];
|
];
|
||||||
$this->overrideConfigValues( $config );
|
$this->overrideConfigValues( $config );
|
||||||
|
|
||||||
|
@ -27,7 +28,7 @@ class LanguageDataTest extends IntegrationTestCase {
|
||||||
$services = MediaWikiServices::getInstance();
|
$services = MediaWikiServices::getInstance();
|
||||||
$languageData = new LanguageData(
|
$languageData = new LanguageData(
|
||||||
$services->getMainConfig(),
|
$services->getMainConfig(),
|
||||||
$services->getLanguageFactory()->getLanguage( $langCode ),
|
$services->getContentLanguage(),
|
||||||
$services->getLanguageConverterFactory(),
|
$services->getLanguageConverterFactory(),
|
||||||
$services->getSpecialPageFactory()
|
$services->getSpecialPageFactory()
|
||||||
);
|
);
|
||||||
|
@ -51,7 +52,9 @@ class LanguageDataTest extends IntegrationTestCase {
|
||||||
// Has localised digits (T261706)
|
// Has localised digits (T261706)
|
||||||
[ 'ckb', [], '../cases/datatest-ckb.json' ],
|
[ 'ckb', [], '../cases/datatest-ckb.json' ],
|
||||||
// Has unusual timezone abbreviation (T265500)
|
// 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