How to use stacks on a multilingual site
Permalink
Hi,
Is it possible to create stack per language?
What is the best way around it?
Thanks
Is it possible to create stack per language?
What is the best way around it?
Thanks
Can u please be more detailed i am new here
I am referring to stack in general.
for instance, I want a different logo for each language.
Is that possible? or should I create a stack per lang and name it logo_english, logo_russian
Tx
I am referring to stack in general.
for instance, I want a different logo for each language.
Is that possible? or should I create a stack per lang and name it logo_english, logo_russian
Tx
I think the best way is to create a stack setting the name: EN My Stack Name.
Then in your template:
My problem is that in this way the current block's JS and CSS files doesn't included!
For example if I add a Superfish menu block to my stack.
What can be the right solution?
Then in your template:
<?php $pp = preg_split('/\//', $c->getCollectionPath()); $pageLanguage = $pp[1]; $s = Stack::getByName($pageLanguage.' My Stack Name'); $s->display(); ?>
My problem is that in this way the current block's JS and CSS files doesn't included!
For example if I add a Superfish menu block to my stack.
What can be the right solution?
I think the internationalization is a plugin that does half of the job.
It is hurting the core of the system.
You cant get around it even in the Composer...
It is hurting the core of the system.
You cant get around it even in the Composer...
- double post -
Hello there,
thanks a lot for that piece of code, it does seem to do exactly what I need for a multilingual site I work on.
I just stumbled over a fatal error when opening any single page (profile, login etc.).
I used your code snipped for the logo area and put it directly into header.php into the logo div.
Now when calling any single page, it tells me:
Fatal error: Call to a member function display() on a non-object in line 50 of header.php, which is the last line of the code snippet.
I am using styled single pages (site_theme_paths method) and the only thing I was able to see that may be conflicting is, that the original Logo area is calling a global area and your code snippet asks for a stack. But the same error is happening after changign ga to s arguments.
I pretty much do not understand how this works on normal pages but not on single pages :)
Help!
Anyway - great contribution!
PS: I think I just found something out - the single pages or not part of the translated Site Tree and the language Codes do not seem to apply.
So When "Countrycode_Stackname" is called, it finds nothing on the single pages.
So far so good - I tried creating a stack with "Stackname" only, but it still does not work. So what would be the code for "Default_Stackname"?
Your code should totally be part of the multilingual add-on !!
thanks a lot for that piece of code, it does seem to do exactly what I need for a multilingual site I work on.
I just stumbled over a fatal error when opening any single page (profile, login etc.).
I used your code snipped for the logo area and put it directly into header.php into the logo div.
Now when calling any single page, it tells me:
Fatal error: Call to a member function display() on a non-object in line 50 of header.php, which is the last line of the code snippet.
I am using styled single pages (site_theme_paths method) and the only thing I was able to see that may be conflicting is, that the original Logo area is calling a global area and your code snippet asks for a stack. But the same error is happening after changign ga to s arguments.
I pretty much do not understand how this works on normal pages but not on single pages :)
Help!
Anyway - great contribution!
PS: I think I just found something out - the single pages or not part of the translated Site Tree and the language Codes do not seem to apply.
So When "Countrycode_Stackname" is called, it finds nothing on the single pages.
So far so good - I tried creating a stack with "Stackname" only, but it still does not work. So what would be the code for "Default_Stackname"?
Your code should totally be part of the multilingual add-on !!
Sooo, i figured it out myself. So for everyone in the future:
All you need to do is to create a stack with "{Countrycode}Logo" and a default Stack "Logo" that will be shown on single pages that do not follow the language sitemap.
Thank you for the hint!
<?php $pp = preg_split('/\//', $c->getCollectionPath()); $x=$pp[1]; if ($x=="de" || $x=="en" || $x=="it") { $pageLanguage=$x; $ga = Stack::getByName($pageLanguage.'Logo'); $ga->display(); } else { $ga = Stack::getByName('Logo'); $ga->display(); } ?>
All you need to do is to create a stack with "{Countrycode}Logo" and a default Stack "Logo" that will be shown on single pages that do not follow the language sitemap.
Thank you for the hint!
Try this :
$lh = Loader::helper('section', 'multilingual'); #Load Multilingual section if($lh->getLanguage() == "id_ID"){ $a = new GlobalArea("Your Stack Name for ID"); }elseif($lh->getLanguage() == "en_GB"){ $a = new GlobalArea("Your Stack Name for GB"); }else{ $a = new GlobalArea("Your Stack Name for Other"); } $a->display($c);
Hi goesredy,
thanks for the code, works marvelous.
A quick "where to put it" would have been nice. For other's interested: You need to find the "GlobalArea" code fragments in your theme and add goesredy's code instead.
Please note, that you lokk how the code of the last line is in YOUR theme file before: In my theme there was just
(so this is what I used)
and not
Olaf
thanks for the code, works marvelous.
A quick "where to put it" would have been nice. For other's interested: You need to find the "GlobalArea" code fragments in your theme and add goesredy's code instead.
Please note, that you lokk how the code of the last line is in YOUR theme file before: In my theme there was just
$a->display();
(so this is what I used)
and not
$a->display($c);
Olaf
For regular areas you do
For global areas you do
The $c is not needed because a global area does not live on any one page. However, I have not heard of it doing any harm.
$a->display($c);
For global areas you do
$a->display();
The $c is not needed because a global area does not live on any one page. However, I have not heard of it doing any harm.
If yes, and you're using the internationalisation add-on for C5, then I think you'd have to use stacks - setting the autonav block in each stack to display pages beneath a certain parent.
Best
Ollie