GetSimple Support Forum

Full Version: Support for multilanguage sites, Internationalization (I18N)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
(2014-03-09, 01:56:21)xxdex Wrote: [ -> ]i'm use this methood navigation structure in front-end, this is not sorting pages from I18N structure.
only when i edit a page and click "save" in front end foreach is sorting with a good order:

Just tested this and this issue is also happenning (to me) not only with that script, but also with get_i18n_navigation - pagecache is not being updated after saving nav structure. [edit: actually it was happenning with get_navigation]
I thought this had been fixed in I18N 3.2.6 (or am I missing something?)
in my case the menu is sorted. However, the content does not
video below
https://dl.dropboxusercontent.com/u/4998...20menu.avi

to a get menu i'm using:
get_i18n_navigation("krzysiek", 1, 1);
(you see it on video) in navigation structure
"tyuty" is name of page. and it's always on first place in conten's
even if i18n in the navigation structure change order (the order of the menu is working)
Sorry, there was a bug in my test code and my template was using get_navigation instead of get_i18n_navigation.
Let me test a bit more.
bellow have You got a my template test:

https://dl.dropboxusercontent.com/u/4998...8n/new.zip

look at line 52 and 77 in template.php
line 52
there is a name of menu what I'm use to get a submenu .. name of menu is "krzysiek"
and line 77
"krzysiek" is name of menu what have a submenu's
I don't master I18N's API, but this seems to work:
Replace the code you pasted in post #749 by this (shorter) one:

PHP Code:
<?php
foreach (return_i18n_menu_data('menuone',1,1) as $page) {
  
$pag $page['url'];
?>

(I haven't checked your template but I suppose it's more or less the same code, you know what to change there.)
Carlos:
[Image: images?q=tbn:ANd9GcRPGIRROvIN86X9OnWfvtX...EV3B_ZumLg]

THANK YOU! SmileBig Grin
I18N version 3.2.7:
  • updates the page cache after modifying the navigation structure (@xxdev, @Carlos)

@shawn_a: see also https://github.com/GetSimpleCMS/GetSimpleCMS/issues/778
I guess this used to work because page cache used to always update on every page load, which was obviously bad and unnecessary. Although I am not entirely sure how this was working or what was changed.
Hey guys,

I have a problem with switching the language.
The tags at the end of the url simply seem to get dropped and the developer console in Firefox says there is a 302: temporarily moved error and it simply loads the same page again.

I use /parent/slug/ url-structure and
Code:
<?php echo htmlspecialchars(return_i18n_lang_url('de')); ?>
to get the url to the other language.
Neither this, nor manually entering ?lang=en or ?setlang=en work.

I moved the files from a localhost Apache to a subdirectory on the webserver today. It worked just fine in the localhost implementation. And yes, I did put in the new base url in the admin settings. Or do I need to run the entire setup process again on the webserver and copy my templates over?

Edit: Using /slug_en/ at the end works, but is lost as soon as I load another page..
Edit2: I tried to use the search function with "302 moved" which returned nothing, and honestly I wasn't keen on reading 30 pages, so apologies if this has been asked before. (:

best regards,
Anton

EDIT:

Okay, well, maybe this post was a bit prematurely.
I just ran the setup on a fresh directory/subdomain, copied my template folder and now the language switching seems to work..
Still, what settings might prevent the old instance from working properly?
try in template:
<a href="<?php get_site_url(); ?>de">DE</a>
slug in settings should look like that:
%nondefaultlanguage%/%parent%/%slug%/

nondefaultlanguage is not giving a lang in http://www.yourpage.com/sitename
and giving a lang in other lang ttp://www.yourpage.com/de/sitename

i'm using a Use Fancy URLs
and my .htacces look like:




PHP Code:
AddDefaultCharset UTF-8
Options 
-Indexes

# blocks direct access to the XML files - they hold all the data!
<Files "\.xml$">
    
Order allow,deny
    Deny from all
    Satisfy All
</Files>
<
Files sitemap.xml>
        
Order allow,deny
    Allow from all
    Satisfy All
</Files>

RewriteEngine on

# Usually it RewriteBase is just '/', but 
# replace it with your subdirectory path
RewriteBase /

RewriteRule ^(cz|du|en|fr)/(.*?/)?([A-Za-z0-9-]+)/?$ index.php?id=$3&lang=$[QSA,L]
RewriteRule ^(cz|du|en|fr)/?$ index.php?lang=$[QSA,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond 
%{REQUEST_FILENAME} !-d
RewriteRule 
/?([A-Za-z0-9_-]+)/?$ index.php?id=$[QSA,L
where the line
RewriteRule ^(cz|du|en|fr)/(.*?/)?([A-Za-z0-9-]+)/?$ index.php?id=$3&lang=$1 [QSA,L]
RewriteRule ^(cz|du|en|fr)/?$ index.php?lang=$1 [QSA,L]

is giving me a installed language cz|du| and other..
Hi mvlcek,

I've found 2 bugs in i18n navigation plugin.

Bug 1
When saving new page i18n navigation plugin retrieves page slug from raw POST data. Page slug might change earlier during check for duplicates in GS changedata.php file. Sometimes new pages will be saved with wrong menu order.

fix:

in file i18navigation/save.php replace first 3 lines

from this:
PHP Code:
<?php
global $xml;
$url $_POST['post-id']; 

to this:
PHP Code:
<?php
global $xml,$url


Bug 2 (not so important)
When i18n navigation plugin rearanges menu order in saved pages it saves page files without CDATA tags.

fix:
in file i18navigation/save.php replace line number 16
from this:
PHP Code:
$data getXML($file); 

to this:
PHP Code:
$data getXMLWithCDATA($file); 

at the end of this file, add:
PHP Code:
function getXMLWithCDATA($file) {
    
$xml = @file_get_contents($file);
    if(
$xml){
        
$data simplexml_load_string($xml'SimpleXMLExtended'); 
        return 
$data;
    }    

is any other chance to change template of multilanguage plugin ?
when someone have the three-four languages in page
example:
https://dl.dropboxusercontent.com/u/4998...erlang.jpg
i think is not enough space to create a menu in selected languages ​​or other...
relationship in creating multi-level menu in any language in my opinion is plus and minus ...... ..
what if in another language, I want to sort menu in different order?
maybe it was easier to make a different menu for different language .. and the multi-langual sites to choose language by drop-down list. and then change everything in one language only.
what when i want to create a 5-6 language's website? it will be not enought space in back-end panel
This is only my suggestions
xxdex, look at define('GSSTYLE',GSSTYLEWIDE); in gsconfig
(2014-04-06, 05:56:03)morvy Wrote: [ -> ]xxdex, look at define('GSSTYLE',GSSTYLEWIDE); in gsconfig

thank You morvy, i know this command and i was test it earlier.
I understand this is of course a solution, but in my opinion not the ideal. What are the order of pages in different languages​​? a different order of pages = different languages, it is my opinion also a solution ... but I wonder if the optimal.
Please do not get me wrong, the work mvlcek did really great! and I am him really grateful for that! I just have some suggestions to improve this module
Had to change two instances of

Code:
$u .= (strpos($u,'?') !== false ? '&' : '?') . I18N_SET_LANGUAGE_PARAM . '=' . $language;

in the i18n_base/frontend.class.php

so it outputs '&amp;' instead of the raw '&' to pass HTML validation

These plugins are great, thanks a lot for the hard work put into them!

Best,
Tomas
(2014-04-09, 09:16:20)lindquist Wrote: [ -> ]Had to change two instances of

Code:
$u .= (strpos($u,'?') !== false ? '&' : '?') . I18N_SET_LANGUAGE_PARAM . '=' . $language;

in the i18n_base/frontend.class.php

so it outputs '&amp;' instead of the raw '&' to pass HTML validation

That's definitely the wrong place to do this. The methods here return the URL itself, not the URL encoded for use in HTML. If you use any URLs on the page, you must encode them with htmlspecialchars(,,,), as e.g. described here.

On the other hand, the method outputLinkTo in this file should use htmlspecialchars for the URL - I'll fix it in the next version.
Hello,

this guide http://mvlcek.bplaced.net/get-simple/mul...v-multiple I created 2 menu - menu1 and menu2. If I turn on the fancy URLs, breadcrumbs like this: "MyWeb >> menu1 >> item1-1" and URL myweb/menu1/item1-1 but I needed it to be "MyWeb >> item-1-1" and URL myweb/item1-1.
If there is still sub-menu, menu1 - item1-1 - item1-1-1 - then this is the breadcrumb "MyWeb >> menu1 >> item1-1 >> item1-1-1, but the URL myweb/item1-1/item1-1-1. I needed it to be "myweb >> item1-1 >> item1-1-1"
(2014-04-23, 07:38:02)Superbobo Wrote: [ -> ]this guide http://mvlcek.bplaced.net/get-simple/mul...v-multiple I created 2 menu - menu1 and menu2. If I turn on the fancy URLs, breadcrumbs like this: "MyWeb >> menu1 >> item1-1" and URL myweb/menu1/item1-1 but I needed it to be "MyWeb >> item-1-1" and URL myweb/item1-1.

You can use return_i18n_breadcrumbs and display the breadcrumbs manually. The following is a copy of the method I18nNavigationFrontend::outputBreadcrumbs, but removes the first element with array_shift:
Code:
$breadcrumbs = return_i18n_breadcrumbs($slug);
    array_shift($breadcrumbs);
    foreach ($breadcrumbs as &$item) {
      $text = $item['menu'] ? $item['menu'] : $item['title'];
      $title = $item['title'] ? $item['title'] : $item['menu'];
      $url = function_exists('find_i18n_url') ? find_i18n_url($item['url'],$item['parent']) : find_url($item['url'],$item['parent']);
      echo ' &raquo; <span class="breadcrumb"><a href="' . $url . '" title="' .
                strip_quotes($title) . '">' . $text . '</a></span>';
    }
I18N version 3.2.8:
  • fixes some small bugs found by @lindquist and @mganko
(2014-04-23, 17:23:02)mvlcek Wrote: [ -> ]I18N version 3.2.8:
  • fixes some small bugs found by @lindquist and @mganko

It' seems that you have not uploaded 3.2.8 version files. There is still 3.2.7 in download.

I've found another issue:
When user deletes page, or changes it's content sitemap is generated 3 times by i18n_base. This lines from i18n_base.php file shuldn't be used on GS 3.3+ to generate sitemap only twice (once by GS and second by plugin):
PHP Code:
add_action('changedata-aftersave''i18n_base_patch_page_save');
add_action('page-delete''i18n_base_patch_page_delete'); 
Hello, i confirm, in a clean install with only the i18n plugin sitemap.xml does not display the parent non-default language. Example www.demo.it/page/subpage becomes www.demo.it/en/subpage...
Permalink -> %nondefaultlanguage%/%parents%/%slug%/
.htaccess:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(en)/(.*?/)?([A-Za-z0-9-]+)/?$ index.php?id=$3&lang=$1 [QSA,L]
RewriteRule ^(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=it [QSA,L]

Any help is appreciated, thank you.
i have a htacces:

PHP Code:
RewriteEngine on

RewriteBase 
/
RewriteRule ^(cz|du|en|fr)/(.*?/)?([A-Za-z0-9-]+)/?$ index.php?id=$3&lang=$[QSA,L]
RewriteRule ^(cz|du|en|fr)/?$ index.php?lang=$[QSA,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond 
%{REQUEST_FILENAME} !-d
RewriteRule 
/?([A-Za-z0-9_-]+)/?$ index.php?id=$[QSA,L

i think (i hope Smile ) than he is correct..
but questions are:

why when in the breadcrumbs i have a:
home » Oferta » Wyroby Hutnicze » Blachy zimnowalcowane » Tabela przeliczeniowa mas

and in adres is only:
domain.pl/blachy-zimnowalcowane/tabela-przeliczeniowa-mas-1/
in the menu i have
Oferta
L Wyroby hutnicze
-L Blachy zimnowalcowane
--L Tabela przeliczeniowa mas
Kontakt
Galeria
so.. where in fancy urls ? is a "oferta" menu ?

seccond question:
is a possible to get in different language different fancy urls in other lang ?
in polish i have:
domain.pl/blachy-zimnowalcowane/tabela-przeliczeniowa-mas-1/

and i want to get in english:
domain.pl/en/sheet-rolled/Table-conversion-mas-1/
its possible to do it with a i18NNavigation?

i'm working on:
https://dl.dropboxusercontent.com/u/4998...ing_on.jpg
there is not so small page in two different language..
the one more question: there is a possible to sort a language's in back-end get simple in some other (custom) order ?
now i have i back end language's polish - english - deutsch..
and in back end a order is by asc " Polish (default in left) deutsch and last english
its a some possible to change this to like : polish - english - deutsch ??
@xxdex:
breadcrumbs vs. URL: use %parents%/%slug% as custom permalink structure.
language specific URL: no, this is not possible.
sort languages: not possible, but you can patch plugins/i18n_base/pages.php: replace (line 69)
Code:
sort($languages);
with
Code:
rsort($languages);
to reverse the sorting order (with the exception of the default language, which is always first).
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43