Different module for each language?

Popular automatic website translation tool

Different module for each language?

Postby 5126 » Mon May 19, 2014 6:03 pm

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?
5126
 
Posts: 23
Joined: Mon May 19, 2014 5:57 pm

Re: Different module for each language?

Postby Edvard » Mon May 19, 2014 6:06 pm

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!
Regards,

Edvard Ananyan - GTranslate Team

Please leave your feedback on your CMS plugin directory. It is very important for us!
Google Translate Joomla
Google Translate WordPress
Google Translate Drupal
Edvard
Site Admin
 
Posts: 4183
Joined: Mon Jun 28, 2010 1:54 pm
Location: Yerevan, Armenia

Re: Different module for each language?

Postby 5126 » Mon May 19, 2014 6:23 pm

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...
5126
 
Posts: 23
Joined: Mon May 19, 2014 5:57 pm

Re: Different module for each language?

Postby Edvard » Mon May 19, 2014 6:26 pm

OK, did you install GTranslate Pro plugin or general version?
Regards,

Edvard Ananyan - GTranslate Team

Please leave your feedback on your CMS plugin directory. It is very important for us!
Google Translate Joomla
Google Translate WordPress
Google Translate Drupal
Edvard
Site Admin
 
Posts: 4183
Joined: Mon Jun 28, 2010 1:54 pm
Location: Yerevan, Armenia

Re: Different module for each language?

Postby 5126 » Mon May 19, 2014 6:29 pm

I have installed plugin 1.7. I;m on Joonla 3.3, the latest.
5126
 
Posts: 23
Joined: Mon May 19, 2014 5:57 pm

Re: Different module for each language?

Postby Edvard » Mon May 19, 2014 6:37 pm

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!
Regards,

Edvard Ananyan - GTranslate Team

Please leave your feedback on your CMS plugin directory. It is very important for us!
Google Translate Joomla
Google Translate WordPress
Google Translate Drupal
Edvard
Site Admin
 
Posts: 4183
Joined: Mon Jun 28, 2010 1:54 pm
Location: Yerevan, Armenia

Re: Different module for each language?

Postby 5126 » Mon May 19, 2014 6:40 pm

Great... I will try that. Thanks Edvard. I will let you know how I am doing...
5126
 
Posts: 23
Joined: Mon May 19, 2014 5:57 pm

Re: Different module for each language?

Postby 5126 » Tue May 20, 2014 12:13 am

Hi Edvard, not sure where should I put this variable...

$session = JFactory::getSession();
$lang = $session->get('glang');
5126
 
Posts: 23
Joined: Mon May 19, 2014 5:57 pm

Re: Different module for each language?

Postby Edvard » Tue May 20, 2014 12:19 pm

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.
Regards,

Edvard Ananyan - GTranslate Team

Please leave your feedback on your CMS plugin directory. It is very important for us!
Google Translate Joomla
Google Translate WordPress
Google Translate Drupal
Edvard
Site Admin
 
Posts: 4183
Joined: Mon Jun 28, 2010 1:54 pm
Location: Yerevan, Armenia

Re: Different module for each language?

Postby 5126 » Tue May 20, 2014 5:55 pm

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...
5126
 
Posts: 23
Joined: Mon May 19, 2014 5:57 pm

Re: Different module for each language?

Postby 5126 » Tue May 20, 2014 6:24 pm

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...
5126
 
Posts: 23
Joined: Mon May 19, 2014 5:57 pm

Re: Different module for each language?

Postby Edvard » Tue May 20, 2014 6:59 pm

You can put position1 under the maintop-c inside the template and it will be OK I think.
Regards,

Edvard Ananyan - GTranslate Team

Please leave your feedback on your CMS plugin directory. It is very important for us!
Google Translate Joomla
Google Translate WordPress
Google Translate Drupal
Edvard
Site Admin
 
Posts: 4183
Joined: Mon Jun 28, 2010 1:54 pm
Location: Yerevan, Armenia

Re: Different module for each language?

Postby 5126 » Tue May 20, 2014 7:42 pm

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 } ?>
5126
 
Posts: 23
Joined: Mon May 19, 2014 5:57 pm

Re: Different module for each language?

Postby Edvard » Tue May 20, 2014 7:51 pm

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
Regards,

Edvard Ananyan - GTranslate Team

Please leave your feedback on your CMS plugin directory. It is very important for us!
Google Translate Joomla
Google Translate WordPress
Google Translate Drupal
Edvard
Site Admin
 
Posts: 4183
Joined: Mon Jun 28, 2010 1:54 pm
Location: Yerevan, Armenia

Re: Different module for each language?

Postby 5126 » Tue May 20, 2014 9:07 pm

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.
5126
 
Posts: 23
Joined: Mon May 19, 2014 5:57 pm

Re: Different module for each language?

Postby Edvard » Tue May 20, 2014 9:12 pm

Regards,

Edvard Ananyan - GTranslate Team

Please leave your feedback on your CMS plugin directory. It is very important for us!
Google Translate Joomla
Google Translate WordPress
Google Translate Drupal
Edvard
Site Admin
 
Posts: 4183
Joined: Mon Jun 28, 2010 1:54 pm
Location: Yerevan, Armenia

Re: Different module for each language?

Postby 5126 » Tue May 20, 2014 9:32 pm

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.
5126
 
Posts: 23
Joined: Mon May 19, 2014 5:57 pm

Re: Different module for each language?

Postby Edvard » Tue May 20, 2014 9:35 pm

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.
Regards,

Edvard Ananyan - GTranslate Team

Please leave your feedback on your CMS plugin directory. It is very important for us!
Google Translate Joomla
Google Translate WordPress
Google Translate Drupal
Edvard
Site Admin
 
Posts: 4183
Joined: Mon Jun 28, 2010 1:54 pm
Location: Yerevan, Armenia

Re: Different module for each language?

Postby 5126 » Tue May 20, 2014 9:51 pm

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.
5126
 
Posts: 23
Joined: Mon May 19, 2014 5:57 pm

Re: Different module for each language?

Postby Edvard » Tue May 20, 2014 9:55 pm

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!
Regards,

Edvard Ananyan - GTranslate Team

Please leave your feedback on your CMS plugin directory. It is very important for us!
Google Translate Joomla
Google Translate WordPress
Google Translate Drupal
Edvard
Site Admin
 
Posts: 4183
Joined: Mon Jun 28, 2010 1:54 pm
Location: Yerevan, Armenia

Next

  • Related Topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 0 guests

2GLux