Page 1 of 1

Tip & Tricks: add language strings in overrides

Posted: Wed Oct 17, 2007 10:16 am
by infograf768
Just add in each override

JPlugin::loadLanguage( 'tpl_nameoftemplate' );

Then add the strings in the en-GB.tpl_nameoftemplate.ini file frontend file.

Enjoy !

EDIT:
Other solution

$lang =& JFactory::getLanguage();
$lang->load('tpl_nameoftemplate', JPATH_SITE); // or JPATH_ADMINISTRATOR if the template language file is only present in the admin language folder(s)

Re: Tip & Tricks: add language strings in overrides

Posted: Sat Oct 20, 2007 6:03 pm
by Jinx
Good find JM, a quick note though, the JPlugin::loadLanguage is not intended to be used in template override scope. I can not guarantee that this method will keep functioning in future versions.

Re: Tip & Tricks: add language strings in overrides

Posted: Sun Oct 21, 2007 4:22 am
by infograf768
I guess you guys will devise a better way to get the overrides to accept language strings in future versions (although keeping this works OK).
In the meanwhile, this will help all template designers and does not cost one line of code.  ;)

Re: Tip & Tricks: add language strings in overrides

Posted: Tue Jun 24, 2008 3:24 pm
by fleuveblanc
Hello,

I'm sory but i don't understand where the en-GB.tpl_nameoftemplate.ini file has to be saved. Can you be more specific ?

Thanks

Re: Tip & Tricks: add language strings in overrides

Posted: Tue Jun 24, 2008 3:41 pm
by infograf768
fleuveblanc wrote:Hello,

I'm sory but i don't understand where the en-GB.tpl_nameoftemplate.ini file has to be saved. Can you be more specific ?

Thanks
Some templates do not have that file, others do (milkyway).
If it does not exist, create it in languages/en-GB/
The file can also be loaded in a template package with the following tags in the xml

Code: Select all

<languages>
		<language tag="en-GB">en-GB.name_of_template.ini</language>
</languages>

Re: Tip & Tricks: add language strings in overrides

Posted: Sat Jul 19, 2008 6:49 pm
by Mello
thanks for the TIP
but I couldn't understand the thread if you got any full reference for overrides and the benefits of it
Please advice

thanks again

Re: Tip & Tricks: add language strings in overrides

Posted: Sun Jul 20, 2008 7:05 am
by infograf768
This is used when you have occurences of JText in the index.php of your template and the template is distributed over the Net to people not using the same language as yours.

Example for Milkyway:

Code: Select all

<p id="power_by">
<?php echo JText::_('Powered by') ?> <a href="http://www.joomla.org">Joomla!</a>.
<?php echo JText::_('Valid') ?> <a href="http://validator.w3.org/check/referer">XHTML</a> <?php echo JText::_('and') ?> <a href="http://jigsaw.w3.org/css-validator/check/referer">CSS</a>.
</p>

Re: Tip & Tricks: add language strings in overrides

Posted: Mon Jun 01, 2009 1:30 pm
by nono_kaki
I'm newbie here, so I've got to subscribe this...
Thanks... :laugh: :laugh:

Re: Tip & Tricks: add language strings in overrides

Posted: Sat Oct 31, 2009 12:07 pm
by Macsimice
Thanks!

Re: Tip & Tricks: add language strings in overrides

Posted: Mon Dec 07, 2009 5:23 am
by joomfriend
Thanks very much infograf768. Great Tip.

Re: Tip & Tricks: add language strings in overrides

Posted: Sun Feb 14, 2010 10:54 am
by orjinal textil
Thanks infograf768.

Re: Tip & Tricks: add language strings in overrides

Posted: Sun Mar 07, 2010 3:27 pm
by modhumiah
@infograf768

Thank you very much. It was very helpfull.

Re: Tip & Tricks: add language strings in overrides

Posted: Tue May 25, 2010 10:08 am
by Batouta
Thanks for the tips !
Merci pour l'astuce :)

Re: Tip & Tricks: add language strings in overrides

Posted: Wed Jun 30, 2010 7:12 am
by Armon99
To: infograf768

About, Just add in each override

JPlugin::loadLanguage( 'tpl_nameoftemplate' );

Then add the strings in the en-GB.tpl_nameoftemplate.ini file frontend file.

Hi
I am new in all this but learning :) Please, i like to know when this become useful. I would have thought that most template would come with English as the main language. Is this plugin for other languages?

Re: Tip & Tricks: add language strings in overrides

Posted: Wed Jul 14, 2010 6:08 am
by KDavid01
infograf768 wrote:I guess you guys will devise a better way to get the overrides to accept language strings in future versions (although keeping this works OK).
In the meanwhile, this will help all template designers and does not cost one line of code.  ;)
I am agree with you.

David.

Re: Tip & Tricks: add language strings in overrides

Posted: Tue Aug 31, 2010 8:53 am
by Geraint
I wrote a very small plugin that does this for all components and addons (as well as Joomla core translation strings) so that it can be applied to any template with no code changes and can maintain separate translations in different addons (in case the same string is repeated).

See http://extensions.joomla.org/extensions ... tion/13147

Geraint

Re: Tip & Tricks: add language strings in overrides

Posted: Tue Oct 19, 2010 4:26 am
by ChiefGoFor
@Geraint - Thank you! It works beautifully! You just saved me a couple hours of coding. ;)

Five free Internets for you!

Re: Tip & Tricks: add language strings in overrides

Posted: Sun Oct 31, 2010 7:16 pm
by f1b0n4cc1
anybody checked this if have problem with joomfish component ?

Re: Tip & Tricks: add language strings in overrides

Posted: Wed Nov 03, 2010 3:27 pm
by Geraint
As the co-author of Joomfish I can confirm that this should have no impact on the behaviour joomfish.

This addon works on the Joomla language string translation and not your website content.

Re: Tip & Tricks: add language strings in overrides

Posted: Wed Mar 16, 2011 3:51 pm
by trytony
Wow.. Thank you, Thank you, Thank you!!!

Re: Tip & Tricks: add language strings in overrides

Posted: Fri Jun 03, 2011 12:40 pm
by pauleffah
Guys pls help me out on this topic. I get it when installing templates.

"Error! Could not find an XML setup file in the package" via the link below

http://forum.joomla.org/viewtopic.php?f=469&t=625543

Re: Tip & Tricks: add language strings in overrides

Posted: Sun Sep 11, 2011 6:17 am
by enbees
infograf768 wrote:Just add in each override

JPlugin::loadLanguage( 'tpl_nameoftemplate' );

Then add the strings in the en-GB.tpl_nameoftemplate.ini file frontend file.

Enjoy !
Hi, infograf768

I'm in the process of overriding the output of com_search in J! 1.7 Frontend and try to use the trick above.

1. I edit the default_result.php, and then put the file in the template HTML folder, as for template override in Beez5.

Code: Select all

<?php 
	echo JText::sprintf('TPL_BEEZ5_COM_SEARCH_CATEGORY', $url); 				
?>
2. Edit the en-GB.tpl_beez5.ini, by inserting a new entry

Code: Select all

TPL_BEEZ5_COM_SEARCH_CATEGORY="%s"
It work perfectly without JPlugin::loadLanguage( 'tpl_nameoftemplate' );

My question, is it okay for J! 1.7 and how to use the
JPlugin::loadLanguage( 'tpl_nameoftemplate' );
in my case?

Thanks

Re: Tip & Tricks: add language strings in overrides

Posted: Thu Sep 15, 2011 11:54 am
by gfxcasa
Thank you very much infograf768. It was very helpfull

Re: Tip & Tricks: add language strings in overrides

Posted: Wed Nov 16, 2011 6:06 pm
by sakiss
Thank you!!

Re: Tip & Tricks: add language strings in overrides

Posted: Sat Apr 21, 2012 3:59 am
by aakashdavis
Thanks infograf768.

Re: Tip & Tricks: add language strings in overrides

Posted: Fri Jul 05, 2013 2:24 pm
by shaji
Hi
Right now you can also do this using either method and add language strings in overrides is better?
also Joomla language string translation ?
What about other languages ​​like Arabic and Turkish?

Here can I get more information about this topic?
http://docs.joomla.org/Category:Tips_and_tricks

If you know, please introduce other sources on this topic
Thank you