0

I have a custom Joomla template, to which I want to apply a template language file. I can put en_GB.tpl_my_tpl.ini into the appropriate place in the language folder of my website and everything works correctly. But I would like to put this files to my template folder so that to have easier access to my language files.

I read what people write about this and it seems to me that if I put template/my_template/language/en_GB/en_GB.tpl_my_tpl.ini it should work correctly but it does not. As far as I understand default Joomla templates use the same technique. I also add to my template xml the following but still no result.

<languages folder="language">
        <language tag=”en_GB”>en_GB.tpl_my_tpl.ini</language>
</languages>

Am I doing something wrong and how to overcome the matter?

Kara
  • 6,115
  • 16
  • 50
  • 57
gag
  • 325
  • 7
  • 16

2 Answers2

0

When JLanguage::load() is called the first parameter is the $extension, which in the case of templates is the template name e.g. tpl_beez_20 (where tpl_ is prepended to the template name during the ComponentHelper renderComponent() call in the JSite's dispatch() method).

The $template name is retrieved via $app->getTemplate(true)->template, which originally comes from the template manifest <name>beez_20</name>.

So, as your small XML snippet looks OK, this could be a few things:

  1. The <name> element doesn't have a value of my_tpl in it.
  2. Your not actually re-installing the template just modifying the XML and for some reason Joomla isn't updating it's cached copy of the manifest — try using the Discover feature of the Extension Manger
  3. Your template folder is not named correctly, in your question you have /template/my_template you may just have typed this incorrectly, but, if your templateDetails.xml is specifying my_tpl as the <name> your path should be /templates/my_tpl/... (While its been a few years since I've made a template the rule used to be that "the name tag must include the exact name of the folder that the template is to be installed under /templates/" See TheArtOfJoomla

More details, like the key parts of the templateDetails.xml and a directory structure listing would also help us help you.

Craig
  • 9,335
  • 2
  • 34
  • 38
  • Thanks for the detailed answer, I understand what you mean, but the Discover function of extension manager gives no results concerning my template. As to the template names they are the same, I just typed incorrectly. As far as I see the only way is to reinstall the template? – gag Oct 10 '13 at 06:40
  • Looks like it, at least that way the cached version will match your template package. – Craig Oct 10 '13 at 09:28
  • no, I updated my template with all necessary files and everything is in its place after I uninstall and newly install the updated template, but no way out, the string would not show any way, can't find out what could be the reason. – gag Oct 10 '13 at 11:51
  • where is the string supposed to be showing front-end or back-end? – Craig Oct 10 '13 at 23:59
0

We do the same exact thing for our custom templates. Everything looks good to include the folder name. Not sure why you were told that's wrong. Everything looks good except you're using "_" instead of "-". IE... you have:

<languages folder="language">
        <language tag="en_GB">en_GB.tpl_my_tpl.ini</language>
</languages>

This should be:

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

If you ever run into any issue in regards to language translation problems, simply follow this debugging guide described in the official Joomla docs here: http://docs.joomla.org/Making_templates_translatable#Debugging_a_translation

user1046503
  • 343
  • 2
  • 6