https://bugzilla.wikimedia.org/show_bug.cgi?id=35489

Maxime <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |maxime.boissonneault@calcul
                   |                            |quebec.ca

--- Comment #14 from Maxime <[email protected]> ---
The source language can already be changed with MediaWiki. In 1.20.4, you can
add something like this in LocalSettings.php : 

$wgHooks['PageContentLanguage'][] = 'onPageContentLanguage';
function onPageContentLanguage( $title, &$pageLang ) {
    $categories = $title->getParentCategories();
    $pageLang = 'fr';
    foreach ($categories as $i => $value) {
        if ( strpos($i,'English_documentation') !== false ) {
            $pageLang = 'en';
            break;
        }
    }
    return true;
}

In MediaWiki 1.21, from what I understand, this hook has been moved to the
ContentHandler class, but I assume the same kind of trick should work.

Then, if you add [[Category:English documentation]] on a page, the source
language will be considered as English, and it will be considered as French
otherwise.

The only drawback that I've seen so far is that Translate does not make use of
this information quite correctly for the <languages /> tag. While it shows the
page as English first, with a possible translation in French, the language box
does not show English unless you tell the extension that you want to translate
both in English (which is a non-sense) and in French. If this could be fixed so
that the PageContentLanguage always shows in the language box, this would work
flawlessly.

I assume someone could easily come up with a tag to add to the page instead of
using categories.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to