Last modified: 2013-12-12 03:13:06 UTC
MediaWiki setups namespaces incorrectly. English (canonical) namespace names are set as namespace aliases. This is wrong, because MWNamespace::getCanonicalName( SMW_NS_PROPERTY ) returns "Свойство", not expected "Property". To setup namespaces correctly: 1. Create file "SMW_Namespaces.php" with content: > $namespaceNames = array(); > $namespaceAliases = array(); > > $namespaceNames[ 'en' ] = array( > SMW_NS_PROPERTY => 'Property', > ... > ); > $namespaceAliases[ 'en' ] = array( > ... > ); > > $namespaceNames[ 'xx' ] = array( > SMW_NS_PROPERTY => 'Localised name', > ); > $namespaceAliases[ 'xx' ] = array( > ... > ); 2. Let MediaWiki know about namespace: > $wgExtensionMessagesFiles[ 'SMW_Namespaces' ] = ".../SMW_Namespaces.php"; 3. Canonical namespace names must be setup via hook: > $wgHooks[ 'CanonicalNamespaces' ][] = 'SMW_onCanonicalNamespaceNames'; 4. The hook body: > function SMW_onCanonicalNamespaceNames( &$namespaces ) { > $namespaces += array( > SMW_NS_PROPERTY => 'Property', > ... > ); > return true; > } // function ocCanonicalNamespaceNames In such a case everything works as expected -- users see localized namespace names, while MWNamespace::getCanonicalName() returns English name.
Confirmed. Will take care of this soonish. Thanks for the "patch"! :)
BTW, SemanticForms has the same issue. Should I open a separate bug?
Nah, I'll just fix it there as well :)
Can you verify the behavior in SMW after r111507?
Verified on r111537. Yes, it works. If I add my localization to SMW_Namespaces.php, a user see localized namespace names, WNamespace::getCanonicalName returns canonical names. But change does not look completed. If seems you have to move following pieces of code: > protected $m_Namespaces = array( > SMW_NS_PROPERTY => 'Property', > SMW_NS_PROPERTY_TALK => 'Property_talk', > SMW_NS_TYPE => 'Type', > SMW_NS_TYPE_TALK => 'Type_talk', > SMW_NS_CONCEPT => 'Concept', > SMW_NS_CONCEPT_TALK => 'Concept_talk' > ); from every SMW_LanguageXX.php to SMW_Namespaces.php, and , probably, drop all the namespace-related stuff from SMWLanguage class.
Right, I only moved the EN stuff over. Can make the changes and provide them in the form of a patch?
Reverted in r111654
Yeah, revert, the canonical hook was apparently added in 1.17. So will have to wait for SMW 1.8, which is probably the next rel after 1.7.1.
Jeroen, now that we are on SMW 1.8 any issue to re-apply the patch?
Changes [1] are deployed with SMW 1.9 together with an integration test [2]. [1] https://github.com/SemanticMediaWiki/SemanticMediaWiki/pull/47 [2] https://github.com/SemanticMediaWiki/SemanticMediaWiki/blob/master/tests/phpunit/integration/MediaWikiNamespaceIntegrationTest.php