Page MenuHomePhabricator

Support switching content language variants
Closed, ResolvedPublic

Description

MobileFrontend needs to support variants of the content in a way to support the mobile web and app interfaces to switch content variants.

(Nice feature for the new Content menu perhaps ?)


Version: unspecified
Severity: enhancement

Details

Reference
bz38101

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 12:51 AM
bzimport set Reference to bz38101.

Duping to bug 21806.

  • This bug has been marked as a duplicate of bug 21806 ***

@brion, this ticket was about content language variants, bug 21806 is about interface language variants.

You can switch the language of the content... am I misunderstanding?

In non-beta you click the W
In beta go to the blue ribbon poking from the right and expand it to choose a language

(In reply to comment #4)

You can switch the language of the content... am I misunderstanding?

That's language_urls a list of interlanguage links to other wikis.

Some languages such as zh have variants. These are kind of like sub-languages on the same wiki. Usually the same text in another script or something. This works by running a language converter over the page content.

You can see the variant menu by going to https://zh.wikipedia.org/ and looking at the menu beside the two namespace tabs.

This is missing from the mobile site. So it's not fixed.

Created attachment 11193
screenshot

Since it seems rather common that people forget what variants are, I'll add a screenshot, will save some discussion hopefully.

Attached:

Screen_Shot_2012-10-14_at_16.41.00.png (281×226 px, 26 KB)

jgonera wrote:

*** Bug 41875 has been marked as a duplicate of this bug. ***

Confirmed fixed, though I note that it doesn't skip over some of the aliases/disabled versions of variants:

See also SkinTemplate.php which is responsible for this in skins.

// Loops over each variant
foreach( $variants as $code ) {
        // Gets variant name from language code
        $varname = $pageLang->getVariantname( $code );
        // Checks if the variant is marked as disabled
        if( $varname == 'disable' ) {
                // Skips this variant
                continue;
        }
        // Appends variant link
        $content_navigation['variants'][] = array(
                'class' => ( $code == $preferred ) ? 'selected' : false,
                'text' => $varname,
                'href' => $title->getLocalURL( array( 'variant' => $code ) + $params ),
                'lang' => $code,
                'hreflang' => $code
        );
}