{{PAGELANGUAGE}} appears not to work properly

According to the Mediawiki help pages the magic word {{PAGELANGUAGE}} should expand into the language code for the current page.

Compare the English Magic words page, where {{PAGELANGUAGE}} expands to “en” with the Dutch Magic words/nl page, where it expands to “nl”.

Note that on both pages {{CONTENTLANGUAGE}}, which returns the language of the interface, returns “en”, and indeed the page furniture such as the Help, Discussion, Read and Translate tabs at the top of the page, are in English. This is all correct.

However, on the Gramps wiki the magic word {{PAGELANGUAGE}} always returns “en”. See e.g. This English page and this Dutch page (with the /nl at the end of the name, though the content is not translated).
Edit: links to pages were missing; added now.

Is there a way to get {{PAGELANGUAGE}} working properly?

It looks like {{PAGELANGUAGE}} is getting the language code from the URL, and returns ‘en’ if there’s no language code in the URL.
I think the problem is caused by the way most translated pages are implemented in the Gramps wiki.
We don’t use language code for the translated pages, but instead we use redirection.
The main index page in English is ‘Gramps_6.0_Wiki_Manual’. The page ‘Gramps_6.0_Wiki_Manual/nl’ is a redirection to ‘Nl:Gramps_6.0_Wiki_Manual’ and therefore the
{{PAGELANGUAGE}} returns ‘en’ as there is no language code in the URL for the dutch page.

1 Like

The use of a namespace (nl:Name of page) as an alternative to a subpage (Name of page/nl) is a built-in feature of the mediawiki system, and is not unique to the Gramps wiki.
The main purpose is to allow for translated page names (nl:Naam van de pagina) while also retaining a connection to the original.

But this mechanism is not what causes the problem. Note that the example I gave of pages in my user space, the “Dutch” page is an explicit “/nl” subpage. Edit: Links were missing; now added; sorry.
The Mediawiki “Magic words” pages also (strangely) do not use a redirected page.
{{PAGELANGUAGE}} should yield “nl” in both “…/nl” and “nl:…” pages (which both have the country code in the URL), but it always gives “en” instead.

There might be a hitch because my tests are in the “User:” namespace. It looks like I will be doing some experiments in the Main namespace. (I didn’t want to, but needs must.)
Edit: Test on Main namespace (using Preview only): PAGELANGUAGE stays “en”.

Another nice trick is to add ?action=info to the URL of a page. The information shown includes a Page content language field. This way you can test the value of {{PAGELANGUAGE}} without editing a page.

For some examples, with the value of Page content language in parentheses:

These examples (and any you care to try yourself) show that the Gramps wiki is currently not configured to support Page content language.
I hope the configuration can be adjusted, but I don’t know how this can be achieved.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.