Links and Autonavs, Global Areas, Internationalization [internationalisation]

Permalink 2 users found helpful
I was wandering if anyone has managed to work out a good way of linking pages within a multilingual site yet?

Looking through the threads and how to's I cannot see a definitive answer.

I used to add an autonav displaying pages at the second level. This generally works. For this current site I am working on they do not want thehttp://www.domain.com/en as the default path this is to remain ashttp://www.domain.com/

I have read though the older howtohttp://www.concrete5.org/documentation/how-tos/editors/building-sit... which is looking the easiest to implement so far, but that means for every language I have to add 70+ relative menu attribute to display the relevant language menu.

There is then also the problem with content that is linked within a content block, that is contained within a global area.

It would be nice if we could add areas, that are global but only to a certain section.

This could be done with an attribute similar to the autonav idea above and then pulling a stack.
Though this would then be nice to include the ability to create groups of stacks.

1. How are other people doing this?
2. Does having a language set up give all associated pages an attribute?
3. Is/Will it be possible to group stacks, other then (Global/Other)

TheRealSean
 
3CGroup replied on at Permalink Reply
3CGroup
Hi there,

when you use the internationalization plugin you don't need to do anything about it. In the setup you have 2 options you can check:
1. Attempt to use visitor's language based on their browser information.
2. Redirect home page to default language section.

That will do the trick. The homepage in the root will be ignored. Using autonav on the second level will do the rest. Only you won't have a Home page visible in your navigation; for that you use the "add external link" in your sitemap in the backend. This external link will be place on the second level (right under the Home in the root) in all your language trees. The link you will add will be a link to the Homepage per language tree.

When you use global areas you will encounter of course the problem that this will be sidewise and that normally means that you have to create multiple headers/footers or lay-out pages per language.

I found a solution to work around this and this will be very easy to set up.

First you need to determine in what language the page is setup there is this handy little code for:
$lh = Loader::helper('section', 'multilingual');  $lh->getLanguage();


With this code you can now make an action through a if else. For example a site is setup in English and you want to load a different area when the site is lets say in French:

$lh = Loader::helper('section', 'multilingual'); 
if ( $lh->getLanguage() == 'en_US' ) 
{ $stack = Stack::getByName('stack_name_EN');$stack->display();  } 
else { stack = Stack::getByName('stack_name_FR');$stack->display(); }


where "stack_name_EN" and "stack_name_FR" of course are first created in stacks in your back-end.

I hope this was useful.
3CGroup replied on at Permalink Reply
3CGroup
one more remark, if you have more then 2 languages you can add more if statements and leave the else statement out.
abra100pro replied on at Permalink Best Answer Reply
abra100pro
Thanks, your code helped me a lot!!

Since you can't know how many languages are about to come, I changed your code like this:

$lh = Loader::helper('section', 'multilingual'); 
$sprache = $lh->getLanguage();
$sprachstack = 'leftbar_'.$sprache;
$stack = Stack::getByName($sprachstack);$stack->display();


You can now make stacks that are named leftbar_[language snippet], i.e. leftbar_de_DE and it is automatically displayed in the appropriate area of your site.

one could combine it with a default-stack in order not to get an error.