Thread Rating:
  • 3 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Support for multilanguage sites, Internationalization (I18N)
(2016-02-19, 21:19:48)HelgeSverre Wrote: How would one go about using 2 separate Tlds/domains (helgesverre.no and helgesverre.com) to determine the language of the page, both domains should be pointing to the same CMS instance, but should display the content in different languages depending on which domain it is.

I added instructions to http://mvlcek.bplaced.net/get-simple/i18n.
To have norwegian on helgesverre.no and the user's preferred language on helgesverre.com, you can have .htaccess rules like this - the user can still switch the language with ?setlang=xx links.
Code:
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.+ - [L]
RewriteCond %{HTTP_HOST} ^helgesverre.no [NC]
RewriteCond %{QUERY_STRING} !(^|&)(set)?lang=
RewriteCond %{HTTP_COOKIE} !(^|;)\s*language=
RewriteRule ^(.*)? $1?lang=no [QSA,DPI]
RewriteRule /?([A-Za-z0-9_-]+)/?$ index.php?id=$1 [QSA,L]
RewriteRule ^ index.php [L]
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
Is there anyway to get the expanding navigation on the Pages admin page without installing this plugin? I would enable this plug in just for those expanding menus, but all of my search result links have ?lang=en appended to the end, which I dislike.
Reply
add the following line in the file gsconfig.php
define('I18N_SINGLE_LANGUAGE', true);
Reply
(2016-02-24, 15:58:27)Oleg06 Wrote: add the following line in the file gsconfig.php
define('I18N_SINGLE_LANGUAGE', true);

Perfect, Oleg. Worked like a charm. Thanks!
Reply
Hi Martin, I've noticed that in the last few versions of the i18n plugins (including 3.3.1) the menu order of Special Pages are a bit jumbled up depending on how you have the menu sorted (by title or hierarchical) on the pages tab. I've seen this on three of my websites now. In the screenshot below, you'll see there are two News posts that are in the wrong location:

[Image: misplaced.jpg] 

But if I go to "Edit Navigation", the pages are in the correct place/order  Huh

[Image: editnav.jpg]
Reply
(2016-02-25, 08:16:03)bensayers Wrote: Hi Martin, I've noticed that in the last few versions of the i18n plugins (including 3.3.1) the menu order of Special Pages are a bit jumbled up depending on how you have the menu sorted (by title or hierarchical) on the pages tab. I've seen this on three of my websites now.

In which state does this happen - hierarchical/menu order or hierarchical/title order?

Can you please temporarily add the following line to plugins/i18n_base/pages.php after $pages = subval_sort($pages,'sort'); (probably line 108)


Code:
print_r($pages);

reload the page list (will output debug information at the top) and then send me the HTML source by PM.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
using a line in the file gsconfig.php
define('GSCANONICAL', 1);
and using this code for Fancy URLs %parents%/%slug%.html
address of such
domen.ru/mototexnika-velorex/motokolyaski-velorex/motokolyaska-velorex-562.html
converted into
domen.ru/%parents%/motokolyaska-velorex-562.html
and there is an error 400
Reply
(2016-03-11, 21:45:28)Oleg06 Wrote: using a line in the file gsconfig.php
define('GSCANONICAL', 1);
and using this code for Fancy URLs %parents%/%slug%.html
address of such
domen.ru/mototexnika-velorex/motokolyaski-velorex/motokolyaska-velorex-562.html
converted into
domen.ru/%parents%/motokolyaska-velorex-562.html
and there is an error 400

Yes, if GSCANONICAL is set, Get-Simple will always compare the incoming URL to the URL created using find_url (which does not know %parents%) and - if they are not the same - redirect to it.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
I'm having similar problem with parents, don't know why. On my latest website (http://bulgaricus.sk) I'm using breadcrumbs and canonical url that is created by i18n, however url bar says /parent/category/product while canonical url is only /category/product and in breadcrumbs it also removes /parent/ from last entry. I've tried switching from %parent% to %parents% but nothing changed (except some parts of website don't work because of %parents% not translated). Is there any special logic needed to get full links for breadcrumbs and mainly for canonical url ?
Thanks
Reply
Hello,

I have a question on the mutlilevel navigation. Is it possible to have the parent page button also on the menu on the left side?

Like so (e.g. Btn 4):

Code:
Top level menu:

+---------------------------------------+
| Btn 1 | Btn 2 | Btn 3 | Btn 4 | Btn 5 |
+-----------------------+ Sub 1 +-------+
                        | Sub 2 |
                        | Sub 3 |
                        +-------+


Left side menu

+-------+                      
| Btn 4 |
| Sub 1 |
| Sub 2 |
| Sub 3 |
| Sub 4 |
+-------+

Btn 4 should be selected in the left menu when I click on Btn 4 in the main menu. Btn 4 in the main menu should also stay highlighted/selected when the sub items are clicked.

For that I am using

PHP Code:
<?php get_i18n_navigation(return_page_slug(),0,99I18N_SHOW_MENU); ?>

which works great.

Thank you for your help and have a good day,

Stefan
Reply
(2016-04-08, 17:48:15)smsHH Wrote: Hello,

I have a question on the mutlilevel navigation. Is it possible to have the parent page button also on the menu on the left side?

Like so (e.g. Btn 4):





Code:
Top level menu:

+---------------------------------------+
| Btn 1 | Btn 2 | Btn 3 | Btn 4 | Btn 5 |
+-----------------------+ Sub 1 +-------+
                        | Sub 2 |
                        | Sub 3 |
                        +-------+


Left side menu

+-------+                      
| Btn 4 |
| Sub 1 |
| Sub 2 |
| Sub 3 |
| Sub 4 |
+-------+

Btn 4 should be selected in the left menu when I click on Btn 4 in the main menu. Btn 4 in the main menu should also stay highlighted/selected when the sub items are clicked.

For that I am using





PHP Code:
<?php get_i18n_navigation(return_page_slug(),0,99I18N_SHOW_MENU); ?>

which works great.

Thank you for your help and have a good day,

Stefan

You can add classes to the elements in the menu with components.

To show the left side menu, you can do something like this:

PHP Code:
<?php

$slug   
return_page_slug();               // current page slug
$parent returnPageField($slug'parent'); // find the parent
$parent $parent $parent $slug       // if there is no parent, use current page

// Main Menu
get_i18n_navigation($slug099I18N_SHOW_MENU);

// Left Menu
get_i18n_navigation($parent199I18N_SHOW_NORMAL);

?>

More stuff about i18n navigation can be found on mvlcek's site.
Reply
(2016-02-26, 06:13:54)mvlcek Wrote:
(2016-02-25, 08:16:03)bensayers Wrote: Hi Martin, I've noticed that in the last few versions of the i18n plugins (including 3.3.1) the menu order of Special Pages are a bit jumbled up depending on how you have the menu sorted (by title or hierarchical) on the pages tab. I've seen this on three of my websites now.

In which state does this happen - hierarchical/menu order or hierarchical/title order?

Can you please temporarily add the following line to plugins/i18n_base/pages.php after $pages = subval_sort($pages,'sort'); (probably line 108)



Code:
print_r($pages);

reload the page list (will output debug information at the top) and then send me the HTML source by PM.
Move all subpages happens when pressed only this button. http://prntscr.com/aqsgq5
If holding down both buttons, then everything falls into place. http://golden-hands43.ru/234.jpg
and after that it works normally when is disabled and sorting by headings http://prntscr.com/aqsl42
this only happens in version 3.3.1
Reply
(2016-04-09, 00:18:49)lokothodida Wrote: You can add classes to the elements in the menu with components.

To show the left side menu, you can do something like this:



PHP Code:
<?php

$slug   
return_page_slug();               // current page slug
$parent returnPageField($slug'parent'); // find the parent
$parent $parent $parent $slug       // if there is no parent, use current page

// Main Menu
get_i18n_navigation($slug099I18N_SHOW_MENU);

// Left Menu
get_i18n_navigation($parent199I18N_SHOW_NORMAL);

?>

More stuff about i18n navigation can be found on mvlcek's site.

Thank you very much for your help, but I can't get this to work for me, probably because I am a PHP beginner. I came up with this solution, maybe it can be improved, but it works :-)

PHP Code:
$home get_site_url(false);
$slug = (string) return_page_slug();
$parent = (string) get_parent(false);

if (!
$parent) {
    echo 
'<li><a href="'.$home.$slug.'" class="current">'.$slug.'</a></li>';
} else {
    echo 
'<li><a href="'.$home.$parent.'/">'.$parent.'</a></li>';
}

get_i18n_navigation(return_page_slug(), 1100); 
Reply
(2016-03-28, 23:10:54)morvy Wrote: I'm having similar problem with parents, don't know why. On my latest website (http://bulgaricus.sk) I'm using breadcrumbs and canonical url that is created by i18n, however url bar says /parent/category/product while canonical url is only /category/product and in breadcrumbs it also removes /parent/ from last entry. I've tried switching from %parent% to %parents% but nothing changed (except some parts of website don't work because of %parents% not translated). Is there any special logic needed to get full links for breadcrumbs and mainly for canonical url ?
Thanks

So I played around a little bit with i18n functions and created my own canonical url function that shows what I want. I use the same code for my microdata breadcrumbs so there are some strange things, but it works Big Grin

PHP Code:
function custom_canonical() {
    
$links return_i18n_breadcrumbs(return_page_slug());
    global 
$SITEURL$n count($links);    $gparent ""$url "";
    for(
$i=0$i<$n$i++) {
        
$gparent = (empty($gparent)) ? $links[$i]['parent'] : $gparent;
        if(
$gparent != $links[$i]['parent']) {
            
$links[$i]['parent'] = $gparent.'/'.$links[$i]['parent'];
        }
        if(
$links[$i]['parent']!=""$links[$i]['parent'] = "/".$links[$i]['parent'];
        
$url rtrim($SITEURL,"/").$links[$i]['parent'].'/'.$links[$i]['url'];
    }
    if(
$url==$SITEURL.'index'$url rtrim($SITEURL,"/");
    echo 
'<link rel="canonical" href="'.$url.'">',PHP_EOL;

Reply
Hello,

I need language dependent template files as well, but the template selection is disabled.
I have read somewhere, but do not remeber the function which includes the language specified files.
For example I need to include footer.inc_de.php automatically instead the original, if Deutch language selected.

<div id="footer">
<?php include('footer.inc.php'); ?>
</div>

Any advice?
Reply
Maybe this works:

PHP Code:
if (isset($language) && $language == 'de') {
 
 include('footer.inc_de.php');

Reply
Hi there,

it looks very easy but I'm not able to write a component which renders the menu on every single page in this way:

Code:
<li><a href="page1">Page 1</a></li>
<li><a href="page2">Page 2</a></li>
<li class="dropdown">
 <a href="#">Page 3</a>
 <ul class="dropdown-menu">
   <li><a href="page31">Page 3.1</a></li>
   <li><a href="page32">Page 3.2</a></li>
 </ul>
</li>
<li><a href="page4">Page 4</a></li>
<li><a href="page5">Page 5</a></li>


any ideas?

thx
Alexander
Reply
Bug 
@mvlcek

I'm getting this error on 3.3.9 - website currently has 96 pages, max 3 levels in menu, memory limit is 256MB

Code:
PHP Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 262144 bytes) in /public_html/plugins/i18n_navigation/frontend.class.php on line 127

.. so it's $pages = self::getPages(); but I don't understand why it has problems
Reply
(2016-05-06, 14:28:42)morvy Wrote: @mvlcek

I'm getting this error on 3.3.9 - website currently has 96 pages, max 3 levels in menu, memory limit is 256MB


Code:
PHP Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 262144 bytes) in /public_html/plugins/i18n_navigation/frontend.class.php on line 127

.. so it's $pages = self::getPages(); but I don't understand why it has problems

Welcome to the world of flat file based data handling that allows us to make the efficient use of memory ;-)
Joking apart, if you have root-rights, you can edit the php.ini file and set a higher value in the variable memory_limit
Or in somewhere in a php file: ini_set('memory_limit', ...
Reply
aaah c'mon, 96 is not a big number Big Grin and I think i18n gets data from cache file, so it's not crawling all files again and again, or am I wrong ? I'll be lowering this number to somewhere around 70, because I'll remove FAQ pages but I don't think it will fix it. It worked like 4 weeks ago when I was editing all of those pages and memory limit was just 16MB Smile
Reply
(2016-05-06, 18:29:12)morvy Wrote: aaah c'mon, 96 is not a big number Big Grin and I think i18n gets data from cache file, so it's not crawling all files again and again, or am I wrong ?

Yes - seems as i18n uses cached data if I18N_USE_CACHE is set to true. Personally, I've never used I18N, so I can't really tell you what the problem could be and what is the best way to solve it.
Reply
problem solved, deleting cache file didn't help, but I also saw broken sitemap structure (generated by i18n) so I saved structure on my localhost, uploaded to my web, deleted cache again, refreshed, saved structure and everything works fine again..
Reply
Hello mvlcek!
This plug-in is really life saver but I was failed to add multi-language php tags to components as you mentioned on this page: http://get-simple.info/wiki/plugins:i18n...uages_i18n

The steps I followed:
1- Added new languages to admin/lang such as de_DE, ru_RU
2- Added <?php i18n("WHOWERARE"); ?> to my footer component.
3- Added "WHOWEARE" => "Who We Are in spesific language?" to all language files that I have.

English version works like charm, however when I set my language to another language on website (not on admin panel), it keep showing me only English version, not other language versions.

I don't really know if I do something wrong. How can I fix this? I will create detailed product pages in 20 different languages so I do REALLY need to know how to fix this :| Thank you very much.
Reply
(2016-06-27, 22:38:29)barknezz Wrote: Hello mvlcek!
This plug-in is really life saver but I was failed to add multi-language php tags to components as you mentioned on this page: http://get-simple.info/wiki/plugins:i18n...uages_i18n

I think the correct documentation is somewhere over here: http://mvlcek.bplaced.net/get-simple/i18n
Reply
Thanks @datiswous
Seems like I can not display multi-languaged texts defined in language files in components...
Yet still waiting for @mvlcek's answer Smile
Reply




Users browsing this thread: 2 Guest(s)