Last modified: 2013-12-12 03:13:06 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T36383, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 34383 - SemanticMediaWiki: Canonical namespace names are set incorrectly.
SemanticMediaWiki: Canonical namespace names are set incorrectly.
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
Semantic MediaWiki (Other open bugs)
unspecified
All All
: Unprioritized normal (vote)
: ---
Assigned To: Jeroen De Dauw
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-02-13 21:44 UTC by Van de Bugger
Modified: 2013-12-12 03:13 UTC (History)
5 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Van de Bugger 2012-02-13 21:44:29 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.
Comment 1 Jeroen De Dauw 2012-02-14 14:33:05 UTC
Confirmed. Will take care of this soonish. Thanks for the "patch"! :)
Comment 2 Van de Bugger 2012-02-14 17:15:22 UTC
BTW, SemanticForms has the same issue. Should I open a separate bug?
Comment 3 Jeroen De Dauw 2012-02-14 17:23:15 UTC
Nah, I'll just fix it there as well :)
Comment 4 Jeroen De Dauw 2012-02-14 23:24:49 UTC
Can you verify the behavior in SMW after r111507?
Comment 5 Van de Bugger 2012-02-15 15:54:26 UTC
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.
Comment 6 Jeroen De Dauw 2012-02-15 17:52:47 UTC
Right, I only moved the EN stuff over. Can make the changes and provide them in the form of a patch?
Comment 7 Siebrand Mazeland 2012-02-16 17:57:56 UTC
Reverted in r111654
Comment 8 Jeroen De Dauw 2012-02-16 18:10:22 UTC
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.
Comment 9 MWJames 2012-11-07 06:36:14 UTC
Jeroen, now that we are on SMW 1.8 any issue to re-apply the patch?

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links