Forum Archive - Different module for each language?

Different module for each language?
May 19, 2014 2:03 pm by 5126
I'm using a Pro version and would like to be able to change a module on front page to a different one when the second language is activated (switched). These 2 modules have different language files in them. What do I do to achieve that? Searched your forum but cannot find an answer... Is that something difficult to do?
Re: Different module for each language?
May 19, 2014 2:06 pm by Edvard
It is possible to do. You will need to detect selected language and display module by condition. It will require little PHP programming. If you know PHP and want more info, please let me know. Thanks!
Re: Different module for each language?
May 19, 2014 2:23 pm by 5126
Hi Edvard, I'm not a programmer actually, just designer, but if you provide me with directions I can insert or modify the code in whatever files... I will need to do the same with some pictures as well, so better if I learn on how to do that...
Re: Different module for each language?
May 19, 2014 2:26 pm by Edvard
OK, did you install GTranslate Pro plugin or general version?
Re: Different module for each language?
May 19, 2014 2:29 pm by 5126
I have installed plugin 1.7. I;m on Joonla 3.3, the latest.
Re: Different module for each language?
May 19, 2014 2:37 pm by Edvard
OK, here are the steps: 1. Detecting selected language $session = JFactory::getSession(); $lang = $session->get('glang'); So $lang variable now should contain the language code or will be empty if you are on default language. Based on the $lang variable you are going to make manipulations inside your code. 2. Showing a different module based on $lang variable You need to publish 2 modules in different positions, let's say position-1 and position-2. Now you need to edit your template index.php file and find the place where you want to show the module. After that use the $lang variable, for example: <?php if($lang == 'fr') { ?><jdoc:include type="modules" name="position-1" /><?php } else { ?><jdoc:include type="modules" name="position-2" /><?php } ?> Let me know if you have any questions. P.S. If you don't want the module in different language to be translated you can wrap it with <span class="notranslate"></span> tag. Thanks!
Re: Different module for each language?
May 19, 2014 2:40 pm by 5126
Great... I will try that. Thanks Edvard. I will let you know how I am doing...
Re: Different module for each language?
May 19, 2014 8:13 pm by 5126
Hi Edvard, not sure where should I put this variable... $session = JFactory::getSession(); $lang = $session->get('glang');
Re: Different module for each language?
May 20, 2014 8:19 am by Edvard
If you are going to use the $lang variable in template index.php file you will need to put it somewhere inside it, before you use the variable.
Re: Different module for each language?
May 20, 2014 1:55 pm by 5126
Hi Edvard, is it possible that I can use names of the modules rather than positions? I have names: "billboard" and "billboard_pl". Can I do it like this...? <?php if($lang == 'pl') { ?><jdoc:include type="modules" name="billboard_pl" /><?php } else { ?><jdoc:include type="modules" name="billboard" /><?php } ?> The reason I'm asking is that I do not know how to place "custom" positions of the module in the layout that is already pre-defined by Gantry framework...
Re: Different module for each language?
May 20, 2014 2:24 pm by 5126
Hi Edvard, I have tried and it works just fine with the custom "position1" and "position2" modules for different language. The only problem is that I want these modules to load in specific position that is "maintop-c" on the home page. Can you advise on how to do that? Thanks...
Re: Different module for each language?
May 20, 2014 2:59 pm by Edvard
You can put position1 under the maintop-c inside the template and it will be OK I think.
Re: Different module for each language?
May 20, 2014 3:42 pm by 5126
Hi Edvard, no, it's not working. I tried to put the name in various places on index and templates (gantry) and details.php and no go... is it possible that I can use names of the modules rather than positions? I have names: "billboard" and "billboard_pl". This one below does not work either... any chance you could help me modify this to use as "module assigned names"? <?php if($lang == 'pl') { ?><jdoc:include type="modules" name="billboard_pl" /><?php } else { ?><jdoc:include type="modules" name="billboard" /><?php } ?>
Re: Different module for each language?
May 20, 2014 3:51 pm by Edvard
You may try loadmodule, but I'm not sure if it will work inside the template: http://docs.joomla.org/How_do_you_put_a ... article%3F
Re: Different module for each language?
May 20, 2014 5:07 pm by 5126
Hi Edvard, unfortunately this does not work either. I have tried a few other suggestions from the Joomla forum too, I cannot put these custom "position1" and "position2" modules into the desired position on the page. I'm very discouraged and disappointed that I cannot get the right answer from this forum. I guess I am going to have to cancel my Pro purchase, as there is no solution to a problem, that apparently should be a common question around here... I was told it was a basic 5 minutes solution, but somehow it's not...Thanks anyway Edvard.
Re: Different module for each language?
May 20, 2014 5:12 pm by Edvard
Hi, Sorry, but I have answered exactly what you need to do. You see I think everybody need to do his own job, if you do not know PHP coding you better tell us or ask someone who knows his way. We may offer you a paid service to do the job for you. You may write to [email protected] directly if you are ready to pay. Thank you!
Re: Different module for each language?
May 20, 2014 5:32 pm by 5126
Edvard, I did exactly what you told me to do, but this is not a solution that works. You left me there hanging half the way. I do not have to be a programmer to use a basic "copy and paste". You selling the software then you're asking for extra payable programming services... this is not the right thing to do. You should provide easy step by step instructions that work for anybody. This software is not for programmers but for every day webmasters. This is a common question that should be resolved and posted for anybody else. You guys looking for extra income... not good.
Re: Different module for each language?
May 20, 2014 5:35 pm by Edvard
I have asked to put the code besides maintop-c, did you do that? It is a custom task which you want to have and it requires PHP programming, it is not possible to implement every feature, but we have made it as simple as possible for webmasters who know little coding.
Re: Different module for each language?
May 20, 2014 5:51 pm by 5126
Yes Edvard, I did put the code in various places, including maintop-c, but there were no results. All I have achieved was an extended position on maintop that has 6 designated placeholders. When I replace maintop-c with position1 or 2 the entire maintop-c is gone. I am positive that placing the code snippet is basic, not extensive. The snippet just does not do the job. Anyway, I will try to ask some of the programmers around. Maybe I'll get some answers from them. Unfortunately there is more questions I have regarding images placements, etc., for second language. I guess you want a money for that as well, right? I presume so, since I cannot find the answer on the forum.
Re: Different module for each language?
May 20, 2014 5:55 pm by Edvard
If you put it next to maintop-c it will render it nearby. So basically if you have a and put b or c depending on $lang it will render ab or ac. It should be very easy. Better you find a programmer who will do the job for you. Thank you!
Re: Different module for each language?
May 20, 2014 5:59 pm by 5126
Are you referring to the index.php file in the template directory Edvard?
Re: Different module for each language?
May 20, 2014 6:03 pm by Edvard
I'm referring to the file which contains the maintop-c definition like <jdoc:include type="modules" name="maintop-c" />, probably it is in index.php of your template. Thank you!
Re: Different module for each language?
May 20, 2014 6:08 pm by 5126
The index.php has just one main definition... <?php /** Begin Main Top **/ if ($gantry->countModules('maintop')) : ?> <div id="rt-maintop"> <?php echo $gantry->displayModules('maintop','standard','standard'); ?> <div class="clear"></div> </div> There is no maintop-c. I have placed the original code right there it still shows at bottom of the page. Anyways Edvard, I will get a programmer to look into this for me. Thanks for your time. Have a nice day.
Re: Different module for each language?
May 20, 2014 6:58 pm by Edvard
Hi, You will need to consult your template developer, since it uses gantry framework which differs from standard joomla core functionality. Thank you!

SIMILAR TOPICS

Large numbers of crawl errors with double language codeJan 24, 2019 1:43 amReplies: 1Post by: natastna2
Translate website to any specific language, on page loadJan 19, 2019 6:49 amReplies: 1Post by: Leaon7756
Graphic translation for every language is missingDec 19, 2018 7:54 amReplies: 1Post by: Daryl Dixon
How to remove mobile Language Select Button transparencyDec 5, 2018 10:06 pmReplies: 10Post by: JeffTR
Change language automaticallyNov 26, 2018 9:29 pmReplies: 3Post by: Antilb

Try GTranslate with a free 15 day trial