-
AuthorPosts
-
March 14, 2007 at 9:51 am #119159
Hi guys,
Joom!Fishing templates is not possible from what I understand at the moment, since Joom!Fish basically switches database entries depending on the language. Templates do not contain database entries so Joom!Fish is completely out of the loop.
Instead of coding different languages into the template, I decided I was going to use our already available language.php files located in our /Languages folder.
Let’s look at JA’s latest template, JA Villadi (or Valladi depends on where on the site you look).
First thing I wanted to do was translate the “You are here:” text. So I opened up index.php and did a search for it. I found it around line 197:
index.php:
<div id="ja-pathway">
<strong>You are here:</strong> <?php mosPathway(); ?>
</div>Instead of hard-coding languages into the template with IF statements I made a language file element which I then integrated into my language.php files (bear with me, you’ll see where I’m getting with this)
I changed the code to this:
<div id="ja-pathway">
<strong><?php echo _JA_PATHWAY_TEXT ?></strong> <?php mosPathway(); ?>
</div>What this does is that it requests a call to the language.php file for an entry named _JA_PATHWAY_TEXT in order to “echo” or replace _JA_PATHWAY_TEXT with its equivelent in the language file.
Now I open english.php and added the line
define('_JA_PATHWAY_TEXT','You are here:');
under the /** templates/*.php heading (around line 405).Now when I open the site, I get You are here: in the pathway. I open up spanish.php and add the same line, only translated to Spanish
define('_JA_PATHWAY_TEXT','Se encuentra aquí:');
and so forth with any other language.php files you may have.This takes care of any plain text in the template… so what about alt=”” tags and whatnot?
I wanted to do the same for the user tools, have my IE tooltips pop up in the language the reader was using. I opened up templatetools.php and looked for the calls to the images. I found the image calls around line 89. I’ll take the first one as an example, the narrow button:
<a href="#Narrow" onclick="return false;"><img title="Narrow screen" src="<?php echo $ja_template_path;?>/images/<?php echo $ja_color?>/user-screen1<?php echo ( ($ja_width=="narrow") ? "-hilite" : "" ) ?>.gif" alt="Narrow screen resolution" id="ja-tool-narrow" onclick="changeToolHilite(curtool, this);curtool=this;setScreenType('narrow');" /></a>
What the IE tooltip pops up is the title=”” entry after the <img tag. Can you guess what we’re going to do? That’s right, create an entry in our language.php files. I decided to call this one _JA_NARROW_ALT, so I took out “Narrow screen” and replaced it with “<?php echo _JA_NARROW_ALT ?>” like so.
<a href="#Narrow" onclick="return false;"><img title="<?php echo _JA_NARROW_ALT ?>" src="<?php echo $ja_template_path;?>/images/<?php echo $ja_color?>/user-screen1<?php echo ( ($ja_width=="narrow") ? "-hilite" : "" ) ?>.gif" alt="<?php echo _JA_NARROW_ALT ?>" id="ja-tool-narrow" onclick="changeToolHilite(curtool, this);curtool=this;setScreenType('narrow');" /></a>
You can see that I also did the alt=”” entry as well… just in case. =)Don’t forget to add those define() calls into ALL of your language.php files and translate them all.
In some instances such as the color buttons, there is a foreach () statement that pulls the current color value, then places it in the title=”” entry. I just decided to replace all the title=”” with a call to the language.php file that is simply translated as “Choose your color!” Sure, I don’t get the individual colors in my tooltips, but is it necessary?
You can put this all over your template. I even put them in the little icons at the bottom for RSS, CSS, XHTML, and Top, adding calls to the language.php file for each entry, naming them all unique names, like _JA_RSS_ALT, _JA_XHTML_ALT, etc.
I hope this helps everyone out that needed multi-language support!
K-9
Michael Casha FriendMichael Casha
- Join date:
- September 2014
- Posts:
- 2561
- Downloads:
- 1
- Uploads:
- 32
- Thanks:
- 41
- Thanked:
- 119 times in 1 posts
March 14, 2007 at 10:49 am #215763Thanks for that mate, I’ve stickied your thread and moved it to the appropriate forum. Well done.
March 14, 2007 at 12:22 pm #215783Glad to be of service. 😀
Important note: This works with ANY template, of course. I just used JA_Villadi as an example.
Cheers!
K-9
March 21, 2008 at 4:02 pm #242792sorry, I didn’t understand …
I am Italian and my english is not so good…
I can not use Joom!fishing to have a multilanguage templates.. ??July 22, 2008 at 5:10 pm #261548hello there,
The solution brings by Chaosknign works only with Joomla! 1.0.x and its “languages.php” files …
But what about Joomla! 1.5.x ???? The languages managment have changed a lot and it’s not clear to know how it works now …
Any body knows how to fix this problem ?
Thanks in anticipation ! -
AuthorPosts
This topic contains 5 replies, has 4 voices, and was last updated by guy1901 16 years, 4 months ago.
We moved to new unified forum. Please post all new support queries in our New Forum