Multilanguage Plugin - words instead of Flags

Hi @Daniel_KM, I’m loving the Multilanguage plugin so far.

Further to the following now closed thread, would it be possible to provide the specific php that you’d use to replace the flags with words for the locale switcher?

All the best,
James

In locale-switcher.php, flags are displayed applying the relative class (that you can find in files contained in flag-icon-css directory) to a listitem, like in
<span class="active flag-icon flag-icon-<?php echo strtolower($country); ?>"></span>

You should be able to get rid of the flag and, instead, have a 2-letters string with
<span class="active">[<?php echo strtolower($country); ?>]</span>

or a longer description with
<span class="active"><?php echo locale_human($locale); ?></span>

Hope this helps.

Thanks @DanieleB! With the third option, how would I specify which word I want to appear? The string for Welsh I’m using (cy-GB) isn’t very useful, so I’d like the options to say ‘English’ and ‘Cymraeg’ or at least EN and CY.

Sorry James, I’m not sure I understand: don’t you see the language full names when using locale_human($locale)? If I do set Welsh as one of the languages used on my website, I correctly see “Cymraeg - Y Deyrnas Unedig” (if you didn’t want the UK part, you should just use “cy” as code). Just check that you’re correctly using “cy_GB”, with underscore insead of hyphen.

Further on this, @james-l-smith, see whether this fork helps you with your issue (I’ve added control over the way languages get displayed): https://github.com/DBinaghi/Multilanguage

Hi @DanieleB. Everything is working perfectly, but the flag icon and the full length language code is now displaying. I think it’s because it’s still in the html it’s spitting out:


<a href="<?php echo $url ; ?>" title="<?php echo locale_human($locale); ?>"><span class="flag-icon flag-icon-<?php echo strtolower($country); ?>"></span></a>

So the flag is still the active link but accompanied by the text. If I want to set it to just show the text, which bit should I change?

If all this stuff is something your new fork of the plugin allows me control over, I’m happy to use that instead rather than tinkering with the php.

Hi.
Is that the code from the original plugin? My fork should have fixed that issue, try installing it (there’s no release, you just have to copy the relevant code).

The fork works exactly how I wanted. Thankyou!

Glad I could help. I hope someone soon will be able to check the proposed code and update the original plugin.