Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
i18n language menu manager
#1
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)
Reply
#2
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.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
#3
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
Reply
#4
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
Reply
#5
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
Reply
#6
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.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
#7
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
Reply
#8
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.
Reply
#9
(2013-07-05, 00:24:31)phpman Wrote: 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.
Reply
#10
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.
Reply
#11
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.

Reply
#12
(2019-03-25, 23:29:39)bokor.pavol Wrote: 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.

Hi i am also having issues with the default language.

I have Swedish for 0
and English for 1

but the site always resorts to English 1 on reset of cookies

any idea how to resolve this?


Attached Files Thumbnail(s)
   
Reply
#13
> but the site always resorts to English 1 on reset of cookies
You may have chosen English first in your browser
Reply
#14
(2019-11-16, 20:54:57)Cre8gent Wrote: Hi i am also having issues with the default language.

I have Swedish for 0
and English for 1

but the site always resorts to English 1 on reset of cookies

any idea how to resolve this?

Edit your .htaccess with this code:


Code:
RewriteRule ^/?$ sv/ [R,L]   # optional
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(sv|en)/(.*?/)?([A-Za-z0-9-]+)/?$ index.php?id=$3&lang=$1 [QSA,L]
RewriteRule ^(sv|en)/?$ index.php?lang=$1 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*?/)?([A-Za-z0-9-]+)/?$ index.php?id=$2&lang=sv [QSA,L]
Reply
#15
(2019-11-17, 22:44:20)smdp-1971 Wrote:
(2019-11-16, 20:54:57)Cre8gent Wrote: Hi i am also having issues with the default language.

I have Swedish for 0
and English for 1

but the site always resorts to English 1 on reset of cookies

any idea how to resolve this?

Edit your .htaccess with this code:


Code:
RewriteRule ^/?$ sv/ [R,L]   # optional
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(sv|en)/(.*?/)?([A-Za-z0-9-]+)/?$ index.php?id=$3&lang=$1 [QSA,L]
RewriteRule ^(sv|en)/?$ index.php?lang=$1 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*?/)?([A-Za-z0-9-]+)/?$ index.php?id=$2&lang=sv [QSA,L]

Hi smdp-1971, i have tried that but once that is in .htaccess , when you select english in the drop down it always remains Swedish
Reply
#16
(2019-11-21, 19:56:39)Cre8gent Wrote:
(2019-11-17, 22:44:20)smdp-1971 Wrote:
(2019-11-16, 20:54:57)Cre8gent Wrote: Hi i am also having issues with the default language.

I have Swedish for 0
and English for 1

but the site always resorts to English 1 on reset of cookies

any idea how to resolve this?

Edit your .htaccess with this code:


Code:
RewriteRule ^/?$ sv/ [R,L]   # optional
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(sv|en)/(.*?/)?([A-Za-z0-9-]+)/?$ index.php?id=$3&lang=$1 [QSA,L]
RewriteRule ^(sv|en)/?$ index.php?lang=$1 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*?/)?([A-Za-z0-9-]+)/?$ index.php?id=$2&lang=sv [QSA,L]

Hi smdp-1971, i have tried that but once that is in .htaccess , when you select english in the drop down it always remains Swedish

Ok, go to settings and add: %nondefaultlanguage%/%parent%/%slug%/ in Custom Permalink Structure:
Reply
#17
Hmm i did that but the same happens, plus my shop link now has a /sv/shop instead of /shop so breaks access to the shop.
Reply
#18
(2019-11-22, 00:15:46)Cre8gent Wrote: Hmm i did that but the same happens, plus my shop link now has a /sv/shop instead of /shop so breaks access to the shop.

try to find a solution on mvlcek page...

http://mvlcek.bplaced.net/get-simple/i18n
Reply




Users browsing this thread: 2 Guest(s)