GetSimple Support Forum

Full Version: i18n language menu manager
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This plugin automatically generates language menu with links to change language and stay on same page.
Requirements: mvlcek's i18n plugin.
Instuctions: set caption for each language, name class for current language <li> (in navigation menu it is 'current') and it is ready to be used in your theme template!
Don't forget to provide <ul> tags (you may add your own attributes to them), because this plugin generates only <li> elements.
Example of usage in theme template:
Code:
<ul id="language-menu"><?php get_i18n_lang_menu(); ?></ul>

To-Do list:
  • add image support (icons or png's instead of/in addition to text caption)
  • add drag'n'drop support to settings menu for customizable language order
@mvlcek I don't mind if you use part of souce code of this plugin or whole plugin itself in your next i18n plugin release (i.e. make it core functionality of your plugin)
Zorato Wrote:This plugin automatically generates language menu with links to change language and stay on same page.

To-Do list:
  • add image support (icons or png's instead of/in addition to text caption)
  • add drag'n'drop support to settings menu for customizable language order

Thanks for extending the I18N plugin.
The language switching was never a priority for me because it's a one-time setup in the template and - as your To-Do list shows - not that easy to implement, if it should fit for everybody.
But it definitely will simplify the setup for the language links.

Regarding your plugin: you must not save data in the plugins folder, you should use /data/other instead.

Suggestion: you can include the language/country combinations from e.g. here in your plugin and show the user a list with the flags corresponding to the language from here. When the user selects a flag, you can automatically download it to e.g. the data/downloads/flags folder and use it in your link.
Why is it when I use the i18n plugin the URL looks like this: http://mysitecom/?lang=en

Doesn't this null/void the purpose of the Fancy URL?

Bob
rfuller Wrote:Why is it when I use the i18n plugin the URL looks like this: http://mysitecom/?lang=en

Doesn't this null/void the purpose of the Fancy URL?

Bob

Thanks for feedback, I'll try to change it or add an option in next release
Hi there,

Thanks for your plugin,

Seems that I have a bit of a problem with it .. there's what is going on :

I18N and I18N language menu added

I've changed the main page language form EN to PL
made some sites in the first language (PL) and then tried to add some translated to English ..

What I received is - when I click EN the pages do change to English but when I want to change pages the language sets to PL :/

Is there any particular reason why I can't navigate pages in each language ?

When I check the url it looks like :
For PL www.mysite.co/faq/ with title attribute "FAQ"
For EN www.mysite.co/faq/ with title attribute "FAQ (en)"

When on the page for example contact and click EN it will change to English but as soon as I click it again (or any other) it changes back to PL



please help, Pit
protrade Wrote:...
I18N and I18N language menu added

I've changed the main page language form EN to PL
made some sites in the first language (PL) and then tried to add some translated to English ..

What I received is - when I click EN the pages do change to English but when I want to change pages the language sets to PL :/

What is you EN link? It should be ...?setlang=en.
Hi,

Thanks for a quick reaction,

The link looks

http://www.mysite.co/?setlang=en
http://www.mysite.co/?setlang=pl <- when I change form EN to PL
sorry that i reactivate this old post but i don´t understand what i must do to display "flags" insead of letters for the languages.

Can somebody help in this case ?

Thanks in advance.
(2013-07-05, 00:24:31)phpman Wrote: [ rel="nofollow" -> ]sorry that i reactivate this old post but i don´t understand what i must do to display "flags" insead of letters for the languages.

Can somebody help in this case ?

Thanks in advance.
I used to insert whole <img /> tag with src="" and alt="" attributes. It wasn't very easy, but worked for me.
Hey guys,

Great plugin. I just finish to modify it with :
  • no heading
  • a little flag

In the file page, create a folder called "flag" and copy images of flags you need. Files must be named as code country et png format.
For instance : en.pgn ; fr.png and so on.

edit file : i18n_lang_menu.php
Into the function get_i18n_lang_menu comment original line and add this :

PHP Code:
function get_i18n_lang_menu(){
 
   //load config
 
   $config=get_config();
 
   
    
//hook for <li> class
 
   $langs_arr=return_i18n_languages();
 
   $current_language=$langs_arr[0];
 
   
    foreach
($config->languages->children() as $lang){
 
       #echo '<li  '.($lang->code==$current_language?'class="'.$config->class.'"':'').' ><a href="'.htmlspecialchars(return_i18n_setlang_url($lang->code)).'">'.$lang->text.'</a></li>';
 
       echo '<li style="list-style-type: none;" '.($lang->code==$current_language?'class="'.$config->class.'"':'').' ><a href="'.htmlspecialchars(return_i18n_setlang_url($lang->code)).'"> <img src="data/uploads/flag/'.$lang->code.'.png" /></a></li>';
 
   }


I juste add a CSS style to mask li heading and replace $lang->text with image call. As you can see, you can use another folder to store your flag pictures.
Hi Folks,

small issue. I created the site with two languages. CS and PL. CS is default. But, when I opening the site from web browser with different regional settings (e.g. SK), then default language has been changed to regional (SK in this case). I see 3 flags. SK, CS, PL. When I click to CS flag, the SK flag will disappear and everything works fine.
When the pages loads first time, the array ($langs_arr=return_i18n_languages()) print these values "Array ( [0] => sk [1] => cs [2] => en )". When I select CS flag the array print "Array ( [0] => cs [1] => sk [2] => en )".
Weight settings don´t affect. This issue appears when settings "Current menu item display on the dropdown menu bar" is "Hide item" and "Dropdown (Bootstrap)" is on.