Improve and document the files in tests/data/

* Remove 'wgMetaNamespace' and 'wgMetaNamespaceTalk', the same data
  exists in 'wgFormattedNamespaces'.

* Rename 'wgContentLang' to 'wgContentLanguage', to match its real
  name in JS config. MediaWiki doesn't use 'wgContentLang' anywhere,
  although the related PHP global is called $wgContLang.

* Document how I made these files, previously only mentioned in the
  commit message of e9c401e3aa.

Change-Id: I67f962812c155aedf41154e0d837e7feb5af972d
This commit is contained in:
Bartosz Dziewoński 2020-09-01 01:14:35 +02:00
parent 2d3fe47ac1
commit 084f45128c
8 changed files with 18 additions and 20 deletions

View file

@ -1,2 +1,10 @@
Minimal overrides for Hooks::getLocalData() and mw.config
required for us to be able to parse HTML generated by the given wiki.
To make one of these files, run the following in browser console:
config.json:
JSON.stringify( mw.config.get( [ 'wgContentLanguage', 'wgArticlePath', 'wgNamespaceIds', 'wgFormattedNamespaces' ] ), null, 2 )
data.json:
JSON.stringify( mw.loader.moduleRegistry[ 'ext.discussionTools.init' ].packageExports[ 'parser/data.json' ], null, 2 )

View file

@ -1,8 +1,6 @@
{
"wgContentLang": "ar",
"wgContentLanguage": "ar",
"wgArticlePath": "/wiki/$1",
"wgMetaNamespace": "ويكيبيديا",
"wgMetaNamespaceTalk": "نقاش_ويكيبيديا",
"wgTranslateNumerals": false,
"wgNamespaceIds": {
"ميديا": -2,

View file

@ -1,8 +1,6 @@
{
"wgContentLang": "en",
"wgContentLanguage": "en",
"wgArticlePath": "/wiki/$1",
"wgMetaNamespace": "Wikipedia",
"wgMetaNamespaceTalk": "Wikipedia_talk",
"wgNamespaceIds": {
"media": -2,
"special": -1,

View file

@ -1,8 +1,6 @@
{
"wgContentLang": "fr",
"wgContentLanguage": "fr",
"wgArticlePath": "/wiki/$1",
"wgMetaNamespace": "Wikipédia",
"wgMetaNamespaceTalk": "Discussion_Wikipédia",
"wgNamespaceIds": {
"média": -2,
"spécial": -1,

View file

@ -1,8 +1,6 @@
{
"wgContentLang": "hu",
"wgContentLanguage": "hu",
"wgArticlePath": "/wiki/$1",
"wgMetaNamespace": "Wikipédia",
"wgMetaNamespaceTalk": "Wikipédia-vita",
"wgNamespaceIds": {
"média": -2,
"speciális": -1,

View file

@ -1,8 +1,6 @@
{
"wgContentLang": "nl",
"wgContentLanguage": "nl",
"wgArticlePath": "/wiki/$1",
"wgMetaNamespace": "Wikipedia",
"wgMetaNamespaceTalk": "Overleg_Wikipedia",
"wgNamespaceIds": {
"media": -2,
"speciaal": -1,

View file

@ -1,8 +1,6 @@
{
"wgContentLang": "pl",
"wgContentLanguage": "pl",
"wgArticlePath": "/wiki/$1",
"wgMetaNamespace": "Wikipedia",
"wgMetaNamespaceTalk": "Dyskusja_Wikipedii",
"wgNamespaceIds": {
"media": -2,
"specjalna": -1,

View file

@ -126,10 +126,12 @@ abstract class CommentTestCase extends MediaWikiTestCase {
$this->setMwGlobals( [
'wgArticlePath' => $config['wgArticlePath'],
'wgNamespaceAliases' => $config['wgNamespaceIds'],
'wgMetaNamespace' => strtr( $config['wgFormattedNamespaces'][NS_PROJECT], ' ', '_' ),
'wgMetaNamespaceTalk' => strtr( $config['wgFormattedNamespaces'][NS_PROJECT_TALK], ' ', '_' ),
// TODO: Move this to $config
'wgLocaltimezone' => $data['localTimezone']
] );
$this->setUserLang( $config['wgContentLang'] );
$this->setContentLang( $config['wgContentLang'] );
$this->setUserLang( $config['wgContentLanguage'] );
$this->setContentLang( $config['wgContentLanguage'] );
}
}