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
Is it possible to do following:

http://sitename.com - `index` with default language, e.g. ru
http://sitename.com/page - `page` with default language, e.g. ru
http://sitename.com/en - `index` english
http://sitename.com/en/page - `page` english

I've set custom permalink structure to %nondefaultlanguage%/%parent%/%slug%/
And here is my .htaccess:

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

I have default index page and several translations: index_en, index_de...
When I type http://sitename.com it redirects me to http://sitename.com/index. If I skip first rule "page not found" is displayed. Is it possible to open home page using default language (not browser language, but one specified in the settings) without any additions in url?

Thanks.
HiltoN Wrote:I've set custom permalink structure to %nondefaultlanguage%/%parent%/%slug%/
And here is my .htaccess:

RewriteRule ^/?$ index/ [R,L] # optional
...

I have default index page and several translations: index_en, index_de...
When I type http://sitename.com it redirects me to http://sitename.com/index. If I skip first rule "page not found" is displayed. Is it possible to open home page using default language (not browser language, but one specified in the settings) without any additions in url?

You could change the rule to:
Code:
RewriteRule ^/?$ index.php?id=index&lang=ru [QSA,L]   # optional
...
Thank you, this is works for me!
Also with following permalink structure %nondefaultlanguage%/%parent%/%slug%/, when inserting link to page that use default language - %nondefaultlanguage% stays as is, so such link is broken. Is it known bug?
I'm trying to solve problem with CKEditor. And I have one more question.

If I know page slug and page parent, how can I get correct link to my page, that use fancy URL.
E.g. page slug is 'page_en', how can I get '/en/page', if I know only page slug and don't know its actual language?
Other examples,
permalink: %nondefaultlanguage%/%parent%/%slug%/ , default language 'ru'

index -> /
index_en -> /en
test -> /test
test_en -> /en/test
parent+test2 -> /parent/test2
parent_en+test2_en -> /en/parent/test2

Is it possible with find_i18n_url?
Hi there,

In my current project I haved used a second menu, next to the main pulldown menu. To enable this I used the code suggested for this on Mvlcek's website

ie.
Code:
<?php
  $bc = return_i18n_breadcrumbs(return_page_slug());
  get_i18n_navigation($bc[0]['url']=='menu1'?return_page_slug():'menu1',1,99);
?>

Works perfectly.

Then the client asked for a breadcrumb, for that I used Martin's other solution:

Code:
<a href="<?php echo find_url('index',null); ?>">home</a>
  <?php get_i18n_breadcrumbs(return_page_slug()); ?>

Works perfectly too.

However, when clicking through the site I noticed that the parent page needed for the 2nd menu is also shown in the browsers address bar, plus the name of that page shows up in the breadcrumb.

Basically this is totally logical, since these page were added using the parent/child structure but is there a way not not display the parent page of the 2nd menu in both the address bar as well as the breadcrumb?
Draxeiro Wrote:However, when clicking through the site I noticed that the parent page needed for the 2nd menu is also shown in the browsers address bar, plus the name of that page shows up in the breadcrumb.

Basically this is totally logical, since these page were added using the parent/child structure but is there a way not not display the parent page of the 2nd menu in both the address bar as well as the breadcrumb?

Use fancy URLs without %parent%.
Build the breadcrumbs programmatically with PHP using return_i18n_breadcrumbs (look at the get_i18n_breadcrumbs function in the plugin and copy/modify the code to not include the first breadcrumb).
get_component with get_i18n_component
get_navigation with get_i18n_navigation



The above do need the <php? tags in front and after correct?

Not sure what i am doing wrong but when I add tags the site goes down.

Bob
rfuller Wrote:get_component with get_i18n_component
get_navigation with get_i18n_navigation

The above do need the <php? tags in front and after correct?

Yes, they are just improved versions of the original functions.

rfuller Wrote:Not sure what i am doing wrong but when I add tags the site goes down.

Bob

Replace one, then the other and see which causes the problem.
Switch on debugging in gsconfig.php.
If it's not on your local machine, post or send me a link.
Hi all,

I'm not sure if this has been covered before I have done a quick search of the forum and cannot find anything.

What I am trying to achieve is a vertical collapsible menu system such as this example:

http://dev.danen.org/demo/danen/jquery/c..._menu.htm#

If you could give me some guidance on achieving this using the I18n plugin it would be much appreciated.

Kind Regards

Stu
srsdesign Wrote:What I am trying to achieve is a vertical collapsible menu system such as this example:

http://dev.danen.org/demo/danen/jquery/c..._menu.htm#

If you could give me some guidance on achieving this using the I18n plugin it would be much appreciated.

It's just a two level menu showing all items:
Code:
<?php get_i18n_navigation(return_page_slug(), 0, 1, I18N_SHOW_MENU); ?>
(the top level pages are only used for opening/closing the children and can thus be empty)

Then add the appropriate CSS and Javascript.
http://coxcamera.ru/admin/load.php?id=i18n_base
redirect from
http://coxcamera.ru/admin/

i received blank screen - what this can be?
cannot login to admin
debug is TRUE

though it doesn't show up the error is seen with view source of that page
<b>Fatal error</b>: Call to undefined function json_encode() in <b>/home/cox/data/www/coxcamera.ru/plugins/i18n_base/backend.class.php</b> on line <b>33</b><br />
alrobeler Wrote:http://coxcamera.ru/admin/load.php?id=i18n_base
redirect from
http://coxcamera.ru/admin/

i received blank screen - what this can be?
cannot login to admin
debug is TRUE

though it doesn't show up the error is seen with view source of that page
<b>Fatal error</b>: Call to undefined function json_encode() in <b>/home/cox/data/www/coxcamera.ru/plugins/i18n_base/backend.class.php</b> on line <b>33</b><br />

json_encode is a standard function from PHP 5.2.0 onwards, see here. It is needed for the plugin.
i know but what if hosting doesn't have it
i've fixed somehow by editing admin/inc/basic.php -- this is for website display
and for admin by editing i18base/backend.class.php in plugin folder
<?php
include("JSON.php");
if( !function_exists('json_encode') ) {
function json_encode($data) {
$json = new Services_JSON();
return( $json->encode($data) );
}
}

// Future-friendly json_decode
if( !function_exists('json_decode') ) {
function json_decode($data, $bool) {
if ($bool) {
$json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
} else {
$json = new Services_JSON();
}
return( $json->decode($data) );
}
}
?>
and adding JSON.php file to it
as described here
http://veselov.sumy.ua/277-oshibka-call-...ecode.html
and class is here
http://mike.teczno.com/JSON.tar.gz
alrobeler Wrote:i know but what if hosting doesn't have it

Request that the hoster enables it or change the hoster - json is a must IMHO.

Instead of patching the file - which will make problems, when you want to update I18N - you can also create a dummy plugin with your code.
mvlcek Wrote:
alrobeler Wrote:i know but what if hosting doesn't have it

Request that the hoster enables it or change the hoster - json is a must IMHO.

Instead of patching the file - which will make problems, when you want to update I18N - you can also create a dummy plugin with your code.
uh Thanks!
I'm sorry for my poor english...
My site has two content languages - russian and karakalpak
I use karakalpak as a default language and save karakalpak content on pages without language slug (e.g. "contacts"), and save russian content on pages like "contacts_ru".
But my browser automatically use russian as a default language, instead of karakalpak.
I set
define('I18N_DEFAULT_LANGUAGE', 'kk');
in file i18n_base.php, but it did not help
Cleaning the cache does not help.
I would be thankful for the help
alrobeler Wrote:
mvlcek Wrote:
alrobeler Wrote:i know but what if hosting doesn't have it

Request that the hoster enables it or change the hoster - json is a must IMHO.

Instead of patching the file - which will make problems, when you want to update I18N - you can also create a dummy plugin with your code.
uh Thanks!
finally contacted hosting support they installed json extension
censor2005 Wrote:My site has two content languages - russian and karakalpak
I use karakalpak as a default language and save karakalpak content on pages without language slug (e.g. "contacts"), and save russian content on pages like "contacts_ru".
But my browser automatically use russian as a default language, instead of karakalpak.
I set
define('I18N_DEFAULT_LANGUAGE', 'kk');
in file i18n_base.php, but it did not help
Cleaning the cache does not help.
I would be thankful for the help

You don't have to change the I18N_DEFAULT_LANGUAGE. Instead set the language on the View all Pages (I18N) administration page.

As to the language displayed by the browser: if your browser's language settings state that you prefer russian to karakalpak, you will see the russian version.
alrobeler Wrote:
alrobeler Wrote:
mvlcek Wrote:Request that the hoster enables it or change the hoster - json is a must IMHO.

Instead of patching the file - which will make problems, when you want to update I18N - you can also create a dummy plugin with your code.
uh Thanks!
finally contacted hosting support they installed json extension
that helped a lot Smile
mvlcek Wrote:
censor2005 Wrote:My site has two content languages - russian and karakalpak
I use karakalpak as a default language and save karakalpak content on pages without language slug (e.g. "contacts"), and save russian content on pages like "contacts_ru".
But my browser automatically use russian as a default language, instead of karakalpak.
I set
define('I18N_DEFAULT_LANGUAGE', 'kk');
in file i18n_base.php, but it did not help
Cleaning the cache does not help.
I would be thankful for the help

You don't have to change the I18N_DEFAULT_LANGUAGE. Instead set the language on the View all Pages (I18N) administration page.

As to the language displayed by the browser: if your browser's language settings state that you prefer russian to karakalpak, you will see the russian version.

Can i override browser language settings? In Karakalpakstan, everyone uses Russian OS, but it's better to show karakalpak content instead of russian
censor2005 Wrote:Can i override browser language settings? In Karakalpakstan, everyone uses Russian OS, but it's better to show karakalpak content instead of russian

You can by including the language in the URL.
mvlcek Wrote:
censor2005 Wrote:Can i override browser language settings? In Karakalpakstan, everyone uses Russian OS, but it's better to show karakalpak content instead of russian

You can by including the language in the URL.

Thanks a lot!
I see I can't ignore browser language settings. It requires editing source code
I recently discovered GetSimple and I'm currently building a test site.

I needed to implement a dropdown menu and found the great I18N Base plugin ... it works great.

There seems to be a little graphical glitch, at least on my machine (OSX 10.7.4 / Safari 5.1.7) in the way that the switch buttons are not aligned (see screenshot).

Keep up the great work.

Best regards,
Romain
Yeah that text alignment glitch has always bothered me to.

I have a question.

I wrote a custom rendering component for twitter bootstrap nav bars and dropdowns.

I need to know what the $show parameter was when the component is called.
Is there anyway to get this, or can you pass it in as an object parameter with item ?
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