Semanticmediawiki: Namespace Property not translated in french

Created on 3 Apr 2020  路  9Comments  路  Source: SemanticMediaWiki/SemanticMediaWiki

Setup and configuration

  • SMW version: 3.1.1
  • MW version: 1.34.0
  • PHP version: 7.4.4
  • DB system : MySQL 5.7.29

Issue

I'm using a fench localized wiki. According to the file i18n/extra/fr.json, the namespace SMW_NS_PROPERTY should be translated to "Attribut". But it is not.

It works if I add $wgExtraNamespaces[SMW_NS_PROPERTY] = "Attribut"; in LocalSettings.php, but I think it's a bug.

question

Most helpful comment

It is not the definition of extra namespaces but the use of wgLanguageCode

It would never have come to my mind to set this after invoking extensions and other "miscellaneous" configuration, but this may happen even if I believe this is extremely rare. Indeed the order of configuration is very important for MediaWiki and this is not an issue specific to Semantic MediaWiki.

Thanks for improving to get the info to the sysadmins faster and better.

All 9 comments

The sandbox wiki is a french localized wiki and it does show "Attribut" as the label for namespace property. Also specific properties are labelled Attribut. I am not sure what is going on at your wiki.

Is is public and could you provide a link?

Also note that SMW 3.1 is not compatible with PHP 7.4 though I do not know if this could be the cause of such an issue.

Hi, thanks for the answer. Here is the link : https://wikirouge.net/texts/fr/Property:Auteur

The PHP version is not the cause because I already had this issue when I was under php 7.0

It could be that some other extension is interfering here however from looking at what you have installed there is no natural candidate. To find out if it is working without other extensions you could disable them and see what happens.

Perhaps also something else in your configuration interferes. Did you change $smwgNamespaceIndex? $wgLanguageCode is "fr" I believe.

See here for a working configuration. Perhaps you can tell from the difference.

Yes $wgLanguageCode = fr;
Ni, I have not changed $smwgNamespaceIndex

What is nearest in my LocalSettings are the lines concerning custom namespaces I use with PageForms :
$smwgNamespacesWithSemanticLinks[NS_KEYWORDS] = true;
$wgExtraNamespaces[NS_KEYWORDS] = "Mots-cl茅s";

I also added $wgNamespaceProtection[SMW_NS_PROPERTY] = array( 'editinterface' );

Just to be sure: You have this prior to invoking Semantic MediaWiki:

define( 'NS_KEYWORDS', 3000 );
define( 'NS_KEYWORDS_TALK', 3001 );
$wgExtraNamespaces[NS_KEYWORDS] = "Mots-cl茅s";
$wgExtraNamespaces[NS_KEYWORDS_TALK] = "Discussion_mots-cl茅s";

and this after invoking Semantic MediaWiki:

$smwgNamespacesWithSemanticLinks[NS_KEYWORDS] = true;
$wgNamespaceProtection[SMW_NS_PROPERTY] = array( 'editinterface' );

What happens if you remove this?

$wgNamespaceProtection[SMW_NS_PROPERTY] = array( 'editinterface' );

If this does not make a difference you are only left with removing all extensions to see if it works or not.

You made me found the issue. I had this part defined after invoking Semantic MediaWiki:

define( 'NS_KEYWORDS', 3000 );
define( 'NS_KEYWORDS_TALK', 3001 );
$wgExtraNamespaces[NS_KEYWORDS] = "Mots-cl茅s";
$wgExtraNamespaces[NS_KEYWORDS_TALK] = "Discussion_mots-cl茅s";

I changed this and now it works. Thanks a lot !

You made me found the issue.

You are welcome.

I had this part defined after invoking Semantic MediaWiki:

No worries, this is a common mistake made. However first you have to tell the wiki about namespaces and only after that the extensions can pick them up and work with them.

@mwjames I am not sure why the definition of an extra namespace after SMW kills parts of the functionality of standard namespaces provided by SMW but it appears to be like that.

@mwjames I am not sure why the definition of an extra namespace after SMW kills parts of the

It is not the definition of extra namespaces but the use of wgLanguageCode, so when you declare

$wgLanguageCode = "fr";
enableSemantics( 'example.org' );

then enableSemantics has access to wgLanguageCode with the fr code but when you define the language late as in:

enableSemantics( 'example.org' );
$wgLanguageCode = "fr";

then enableSemantics has only access to the default (which is en) and any declaration that happens hereafter is ignored because enableSemantics has the responsibility to register the namespace in LocalSettings.php as soon as possible so that users can have access to SMW_NS_PROPERTY or other variables after enableSemantics. So, yes, the sequence makes a difference here.

Once the SMW_NS_PROPERTY canonical space is occupied, it won't be overridden which is why when en is default and used for SMW_NS_PROPERTY, any attempt to use a different name will be ignored.

It is another fallout of the extension.json conversion.

How to prevent the issue?

While we cannot prevent the issue (users are free to place settings before or after enableSemantics) and I don't want to change the way the NamespaceManager doesn't allow any overrides, we could raise an exception in case we detect a discrepancy during the first call and any other call.

It is not the definition of extra namespaces but the use of wgLanguageCode

It would never have come to my mind to set this after invoking extensions and other "miscellaneous" configuration, but this may happen even if I believe this is extremely rare. Indeed the order of configuration is very important for MediaWiki and this is not an issue specific to Semantic MediaWiki.

Thanks for improving to get the info to the sysadmins faster and better.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jaideraf picture jaideraf  路  3Comments

WolfgangFahl picture WolfgangFahl  路  3Comments

MvGulik picture MvGulik  路  4Comments

seth2740 picture seth2740  路  3Comments

plegault3397 picture plegault3397  路  3Comments