Pergunta

As far as i'm aware, the only steps required in order to create a internationalized extension is to create a i18n file like the following:

//SemanticHighcharts.i18n.php
$messages = array();

$messages['en'] = array(
    'semantichighcharts-desc' => 'A SMW result format displaying data with the help of highcharts
);

and then reference this file with the global variable wgExtensionMessageFiles

//SemanticHighcharts.php
global $wgExtensionMessagesFiles, $wgExtensionCredits;
$wgExtensionCredits['semantic'][] = array(
    'path' => __FILE__,
    'name' => 'SemanticHighcharts',
    'version' => '0.0.1',
    'url' => 'https://www.mediawiki.org/wiki/Extension:SemanticHighcharts',
    'descriptionmsg' => 'semantichighcharts-desc'
);

//i18n
$wgExtensionMessagesFiles['SemanticHighcharts'] = dirname(__FILE__) . '/SemanticHighcharts.i18n.php';

This should cause the descriptionmsg in wgExtensionCredits to be internationalized when displayed on Special:Version.

However this is not the case... In fact, no message key from the i18n file is being read!

How can i debug this issue? I've tried to debug callstack when doing a wfMessage() call without any great success.

Any help is appreciated. I'm running the latest version of mediawiki from git. And all extensions have been installed with composer.

//composer.json
{
    "require": {
        "php": ">=5.3.2",
        "mediawiki/side-bar-menu": "dev-master",
        "mediawiki/semantic-highcharts": "dev-master",
        "mediawiki/semantic-result-formats": "dev-master"
    },
    "suggest": {
        "ext-fileinfo": "*",
        "ext-mbstring": "*",
        "ext-wikidiff2": "*",
        "ext-apc": "*"
    },
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/netbrain/SemanticHighcharts"
        }
    ]
}
Foi útil?

Solução

Typical, after struggling with this issue for quite some time. Right after posting this question I tried to remove all other extensions from composer.json, and did a composer update. Which magically fixed my issue.

I'm suspecting that there might be a conflicting extension or maybe it was just something wrong with the composer autoloading mechanism.

Ill try to look into it further.


It seems that composer was the culprit, after re-adding the extensions previously removed, it still worked. So i can only guess that there is some quirk in composers dependency management.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top