Item14738: MultiLingualPlugin breaks LanguageSelector

Priority: Urgent
Current State: Closed
Released In: n/a
Target Release:
Applies To: Extension
Component: LanguageSelector, MultiLingualPlugin
Branches: master
Reported By: FlorensWerner
Waiting For:
Last Change By: FlorensWerner
When installing the MultiLingualPlugin, the LanguageSelector (usually situated in the top bar) does not show a list of installed/enabled languages anymore. The languages are shown, though, when the plugin is disabled/removed.

Use case: The LanguageSelector is used to change between English and German in order to switch both the interface language and content language.

Expected Behaviour: When clicking on the LanguageSelector form, a drop-down list of available languages should be shown (Default, English, and German).

Actual Behaviour: When clicking on the LanguageSelector form, a drop-down list containing only 'Default' is shown (clicking on that has no effect whatsoever apart from closing the drop-down list).

Software versions: MultiLingualPlugin 4.00 (12 Jan 2018); Foswiki 2.1.6; OS Ubuntu 16.04 LTS; Apache 2.4

Steps taken: Under configure -> Internationalisation -> Languages, both Interface Internationalisation and German are enabled. Under configure -> Extensions -> MultiLingualPlugin, {MultiLingualPlugin}{SyncUserInterface} is enabled.

I suspect that the problem lies with the LANGUAGES macro, for which the MultiLingualPlugin provides a seperate implementation, as that is what is used by LanguageSelector to get a list of the available languages and disabling the plugin, i. e. using the default macro implementation, results in the languages being displayed correctly in the LanguageSelector drop-down list and clicking on a language also has the desired effect of the interface language being changed.

As this problem occurs on a fresh installation of Foswiki and the plugin, I marked this issue as urgent as it should happen to everyone (using Ubuntu at least) and the use of the MultiLingualPlugin without a convenient way to change languages is disputable.

-- FlorensWerner - 12 Jul 2018

Hm, they are shown here just fine even with MultiLingualPlugin. Even with the newest version installed I am not quite able to repro the problem. Any other hints on how to repro? Please try the %LANGUAGES makro in isolation comparing the standard implementation and the MultiLingualPlugin enabled, such as:

         format="   * marker=$marker, langtag=$langtag, langname=$langname"

-- MichaelDaum - 12 Jul 2018

That's weird, the problem happens on a fresh installation of Foswiki, so I would have thought that this is a general problem. Default Foswiki, default MultiLingualPlugin, default Ubuntu, default Apache: LanguageSelector does not work correctly. Disable/remove MultiLingualPlugin: LanguageSelector works correctly. For the fresh installation I had the Apache config file automatically generated using the . I don't really have more detailed steps to reproduce the problem. Are you sure that MultiLingualPlugin is installed/enabled on The MultiLingualPlugin page ( says in the blue bar at the top that the plugin is not installed on

Invoking the MultiLingualPlugin implementation of the LANGUAGES macro manually (using your example from above) results in no output.

Invoking the standard implementation of the LANGUAGES macro manually (using your example from above) results in the following output:

* marker=, langtag=de, langname=Deutsch * marker=, langtag=en, langname=English

-- FlorensWerner - 12 Jul 2018

Sorry for the errors in my comment, it's my first time posting here on the forums. The Apache config was created by the ApacheConfigGenerator:

The output of the standard implementation of the LANGUAGES macro is two lines, or a list with the two languages (or the languages' string representations) German and English.

-- FlorensWerner - 12 Jul 2018

Installed plugins on the blog are listed here:

Try enabling internationalisation:

$Foswiki::cfg{UserInterfaceInternationalisation} = 1;

... and languages as required:

$Foswiki::cfg{Languages}{bg}{Enabled} = 1;
$Foswiki::cfg{Languages}{cs}{Enabled} = 1;
$Foswiki::cfg{Languages}{da}{Enabled} = 1;
$Foswiki::cfg{Languages}{de}{Enabled} = 1;
$Foswiki::cfg{Languages}{es}{Enabled} = 1;
$Foswiki::cfg{Languages}{el}{Enabled} = 1;
$Foswiki::cfg{Languages}{fi}{Enabled} = 1;
$Foswiki::cfg{Languages}{fr}{Enabled} = 1;
$Foswiki::cfg{Languages}{it}{Enabled} = 1;
$Foswiki::cfg{Languages}{ja}{Enabled} = 1;
$Foswiki::cfg{Languages}{ko}{Enabled} = 1;
$Foswiki::cfg{Languages}{nl}{Enabled} = 1;
$Foswiki::cfg{Languages}{no}{Enabled} = 1;
$Foswiki::cfg{Languages}{pl}{Enabled} = 1;
$Foswiki::cfg{Languages}{'pt-br'}{Enabled} = 1;
$Foswiki::cfg{Languages}{pt}{Enabled} = 1;
$Foswiki::cfg{Languages}{ru}{Enabled} = 1;
$Foswiki::cfg{Languages}{sv}{Enabled} = 1;
$Foswiki::cfg{Languages}{tr}{Enabled} = 1;
$Foswiki::cfg{Languages}{uk}{Enabled} = 1;
$Foswiki::cfg{Languages}{tlh}{Enabled} = 1;
$Foswiki::cfg{Languages}{'zh-cn'}{Enabled} = 1;
$Foswiki::cfg{Languages}{'zh-tw'}{Enabled} = 1;

-- MichaelDaum - 12 Jul 2018

Please reopen the task item if above does not solve your problems.

-- MichaelDaum - 16 Jul 2018

On the list of installed plugins on the blog I saw that the installed MultiLingualPlugin version is 3.01 (commit hash 6d03605), i. e two versions back. I tried manually installing that version, which solved the problem, so the LanguageSelector works correctly with 3.01, everything fine. Using the next version (3.10, commit hash d152a75) breaks the LanguageSelector again. So I guess the error is introduced in 3.10.

-- FlorensWerner - 16 Jul 2018

Try enabling this line in enabledLanguages() and watch your server logs for any message of that kind. You might get <code> unknown to Locale::Country which means your system does not provide the requested locales...

-- MichaelDaum - 16 Jul 2018

Enabling that line did actually print out the 'unknown to Locale::Country' error to the Apache error log. However, the locales were all correctly installed. What we found out is that the 'if' statement starting int this line is always evaluated to 'false', regardless of what language code was passed to getLanguageOfCode(). Looking at the definition of getLanguageOfCode() we saw that the arguments in the call to code2language() in this line do not coincide with the documentation of the Locale modules API: under 'code2XXX' it says that a third optional argument can be passed in the form of the string 'retired'. The linked lines, however, call code2language() with the integer '1' as the third argument. Removing this third argument (as it is optional) as well as passing the string 'retired' instead instead of the integer, both result in everything working as expected, i. e. the LanguageSelector showing the languages English and German (in addition to 'Default'). Is it possible that passing the integer is an error?

-- FlorensWerner - 16 Jul 2018

Okay. Can confirm the error. Let me create a new release....

-- MichaelDaum - 16 Jul 2018

... try 4.10

-- MichaelDaum - 16 Jul 2018

Works flawlessly, thanks for helping out so quickly.

-- FlorensWerner - 16 Jul 2018
Topic revision: r10 - 16 Jul 2018, FlorensWerner - This page was cached on 16 May 2020 - 00:51.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy