Tip & Tricks: add language strings in overrides
Moderator: General Support Moderators
Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
- infograf768
- Joomla! Master
- Posts: 19133
- Joined: Fri Aug 12, 2005 3:47 pm
- Location: **Translation Matters**
Tip & Tricks: add language strings in overrides
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)
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)
Jean-Marie Simonet / infograf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group
- Jinx
- Joomla! Champion
- Posts: 6508
- Joined: Fri Aug 12, 2005 12:47 am
- Contact:
Re: Tip & Tricks: add language strings in overrides
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.
Johan Janssens - Joomla Co-Founder, Lead Developer of Joomla 1.5
http://www.joomlatools.com - Joomla extensions that just work
http://www.joomlatools.com - Joomla extensions that just work
- infograf768
- Joomla! Master
- Posts: 19133
- Joined: Fri Aug 12, 2005 3:47 pm
- Location: **Translation Matters**
Re: Tip & Tricks: add language strings in overrides
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.
In the meanwhile, this will help all template designers and does not cost one line of code.
Jean-Marie Simonet / infograf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group
-
- Joomla! Apprentice
- Posts: 5
- Joined: Tue Jun 24, 2008 8:04 am
Re: Tip & Tricks: add language strings in overrides
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
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
- infograf768
- Joomla! Master
- Posts: 19133
- Joined: Fri Aug 12, 2005 3:47 pm
- Location: **Translation Matters**
Re: Tip & Tricks: add language strings in overrides
Some templates do not have that file, others do (milkyway).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
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>
Jean-Marie Simonet / infograf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group
-
- Joomla! Intern
- Posts: 98
- Joined: Fri Jan 25, 2008 8:12 am
- Location: Kuwait
- Contact:
Re: Tip & Tricks: add language strings in overrides
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
but I couldn't understand the thread if you got any full reference for overrides and the benefits of it
Please advice
thanks again
Mestslm Rady Be Tab3ek, 3sfor Fe El-7elm Masaknk :: Me7tar 3la Shat Shafayfk, Dh 3tor El Koon Men Ward
Rosheha Nasyeny Meen ANA!
My Hosting Company : http://www.sz4h.com
Rosheha Nasyeny Meen ANA!
My Hosting Company : http://www.sz4h.com
- infograf768
- Joomla! Master
- Posts: 19133
- Joined: Fri Aug 12, 2005 3:47 pm
- Location: **Translation Matters**
Re: Tip & Tricks: add language strings in overrides
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:
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>
Jean-Marie Simonet / infograf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group
-
- Joomla! Apprentice
- Posts: 25
- Joined: Tue Apr 14, 2009 8:16 am
- Location: Makassar, Indonesia
- Contact:
Re: Tip & Tricks: add language strings in overrides
I'm newbie here, so I've got to subscribe this...
Thanks...
Thanks...
- Macsimice
- Joomla! Explorer
- Posts: 331
- Joined: Sun Mar 18, 2007 12:50 pm
- Location: Netherlands
- Contact:
- joomfriend
- Joomla! Explorer
- Posts: 284
- Joined: Sun Feb 08, 2009 5:10 pm
- Contact:
Re: Tip & Tricks: add language strings in overrides
Thanks very much infograf768. Great Tip.
- https://www.adelnipet.com: Adelni Pet - Your Social Pet Network
- https://www.egliseprimitive.org: Christian Website
- https://www.egliseprimitive.org: Christian Website
-
- Joomla! Fledgling
- Posts: 2
- Joined: Tue Feb 09, 2010 7:17 pm
- Contact:
Re: Tip & Tricks: add language strings in overrides
Thanks infograf768.
-
- Joomla! Intern
- Posts: 56
- Joined: Wed Feb 24, 2010 2:14 am
Re: Tip & Tricks: add language strings in overrides
@infograf768
Thank you very much. It was very helpfull.
Thank you very much. It was very helpfull.
-
- Joomla! Fledgling
- Posts: 4
- Joined: Tue May 25, 2010 9:29 am
Re: Tip & Tricks: add language strings in overrides
Thanks for the tips !
Merci pour l'astuce
Merci pour l'astuce
Développeur web:
http://www.yootint.com/ - Site corporate pour la pose de vitre teintée pour auto.
http://www.yootint.com/ - Site corporate pour la pose de vitre teintée pour auto.
-
- Joomla! Intern
- Posts: 98
- Joined: Mon Jan 04, 2010 7:38 am
Re: Tip & Tricks: add language strings in overrides
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?
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?
-
- Joomla! Fledgling
- Posts: 4
- Joined: Mon Jun 21, 2010 11:56 am
Re: Tip & Tricks: add language strings in overrides
I am agree with you.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.
David.
- Geraint
- Joomla! Guru
- Posts: 561
- Joined: Fri Aug 19, 2005 5:23 pm
- Location: Gogledd Cymru
Re: Tip & Tricks: add language strings in overrides
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
See http://extensions.joomla.org/extensions ... tion/13147
Geraint
- ChiefGoFor
- Joomla! Champion
- Posts: 5614
- Joined: Tue Sep 13, 2005 12:22 am
- Location: Omaha, Nebraska, USA
- Contact:
Re: Tip & Tricks: add language strings in overrides
@Geraint - Thank you! It works beautifully! You just saved me a couple hours of coding.
Five free Internets for you!
Five free Internets for you!
Joomla! ...because open source matters
"Try to answer two questions for every one question you ask." - Me
"Try to answer two questions for every one question you ask." - Me
-
- Joomla! Apprentice
- Posts: 15
- Joined: Fri May 28, 2010 4:10 pm
- Contact:
Re: Tip & Tricks: add language strings in overrides
anybody checked this if have problem with joomfish component ?
Please read forum rules regarding signatures: http://forum.joomla.org/viewtopic.php?t=65
- Geraint
- Joomla! Guru
- Posts: 561
- Joined: Fri Aug 19, 2005 5:23 pm
- Location: Gogledd Cymru
Re: Tip & Tricks: add language strings in overrides
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.
This addon works on the Joomla language string translation and not your website content.
-
- Joomla! Fledgling
- Posts: 1
- Joined: Wed Mar 16, 2011 3:40 pm
Re: Tip & Tricks: add language strings in overrides
Wow.. Thank you, Thank you, Thank you!!!
My Joomla Site --> http://www.meldo.com
http://www.TryTony.com
http://www.TryTony.com
-
- Joomla! Fledgling
- Posts: 4
- Joined: Fri Jun 03, 2011 12:22 pm
Re: Tip & Tricks: add language strings in overrides
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
"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
- enbees
- Joomla! Guru
- Posts: 860
- Joined: Mon Sep 20, 2010 7:58 am
- Location: Jakarta - Indonesia
- Contact:
Re: Tip & Tricks: add language strings in overrides
Hi, infograf768infograf768 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 !
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);
?>
Code: Select all
TPL_BEEZ5_COM_SEARCH_CATEGORY="%s"
My question, is it okay for J! 1.7 and how to use the
JPlugin::loadLanguage( 'tpl_nameoftemplate' );
in my case?
Thanks
Regards,
enbees, I'm here: http://koperasoft.com
enbees, I'm here: http://koperasoft.com
-
- Joomla! Fledgling
- Posts: 1
- Joined: Thu Sep 15, 2011 11:51 am
- Contact:
Re: Tip & Tricks: add language strings in overrides
Thank you very much infograf768. It was very helpfull
- sakiss
- Joomla! Explorer
- Posts: 349
- Joined: Wed Aug 20, 2008 4:09 pm
-
- Joomla! Apprentice
- Posts: 13
- Joined: Sat Apr 21, 2012 3:19 am
- Location: India
- Contact:
Re: Tip & Tricks: add language strings in overrides
Thanks infograf768.
~Aakash
A computer once beat me at chess, but it was no match for me at kick boxing
http://akashtablet.in/
Moving http://aadhaaruid.org/ from WP to Joomla
A computer once beat me at chess, but it was no match for me at kick boxing
http://akashtablet.in/
Moving http://aadhaaruid.org/ from WP to Joomla
-
- Joomla! Intern
- Posts: 85
- Joined: Wed Apr 10, 2013 10:09 am
Re: Tip & Tricks: add language strings in overrides
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
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
http://karajab.ir/ . http://tehranab.ir/
Thank you so very much for making Joomla the best CMS on the planet!
Thank you so very much for making Joomla the best CMS on the planet!