Plugin does not load language

For Joomla! 1.5 Coding related discussions, please use: http://groups.google.com/group/joomla-dev-general
Forum rules
Please use the mailing list here: http://groups.google.com/group/joomla-dev-general rather than this forum.
User avatar
uwalter
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Fri Nov 07, 2008 1:21 pm
Location: Mainz, Germany
Contact:

Plugin does not load language

Postby uwalter » Thu Dec 18, 2008 1:10 am

Hi Joomla! developers.

Currently I'm developing, respectively upgrading my first J1.5 system plugin, adding multi language support. Unfortunately the languages are not loaded at the back end's plugin interface and I only can see the LANGUAGE_PLACEHOLDERS I definded at the plugin's manifest file.

Here are the steps I was going through:

1. Created the folder "language" at the plugin's root directory and stored the
(?:en-GB|de-DE|da-DK).plg_system_myplugin.ini in there.
2. Created an entry at the manifest file as follows.

Code: Select all

<languages folder="language">
    <language tag="en-GB">en-GB.plg_system_myplugin.ini</language>
    <language tag="de-DE">de-DE.plg_system_myplugin.ini</language>
    <language tag="da-DK">da-DK.plg_system_myplugin.ini</language>
</languages>

3. Placed the language placeholders for description and params as shown below.

Code: Select all

<param name="core" type="radio" default="0" label="CORE_LABEL" description="CORE_DESCRIPTION">
<option value="1">ENABLE</option>
<option value="0">DISABLE</option>
</param>

4. Created a package and installed it.

The languages are installed correctly and after installation they can be found under ~/administrator/language/de-DE/......

For testing purposes I used the following code at my ~/plugins/system/plg_system_myplugin.php in order to check if the language strings are set properly.

Code: Select all

$lang   =& JFactory::getLanguage();
die(print_r($lang));


I can see that the JLanguage instance contains:

Code: Select all

$lang->_paths['plg_system_debug'] => Array
    (
        [/path/to/joomla/administrator/language/de-DE/de-DE.plg_system_myplugin.ini] => 1
    )


But Joomla! does not initialize the language INIs at runtime. With my modules this works very well, and I have a functioning multi language support there, but not with the plugin. The funny thing on this is, that the placeholders ENABLE and DISABLE are replaced correctly due to their existence in one of the core INIs. :)

System is: Joomla! 1.5.8 (tested on 1.5.7 also)

Could please nudge me someone to the right direction? I can't see the wood for the trees right now. :(

Thank you very much in advance.

Best Regards
Uwe
Last edited by uwalter on Tue Dec 23, 2008 8:11 am, edited 1 time in total.
Linux is a wigwam: No windows, no gates and an apache inside.

User avatar
ianmac
Joomla! Virtuoso
Joomla! Virtuoso
Posts: 4785
Joined: Sat Sep 24, 2005 11:01 pm
Location: Toronto, Canada

Re: Plugin does not load language

Postby ianmac » Sat Dec 20, 2008 3:46 am

uwalter wrote:Hi Joomla! developers.

Currently I'm developing, respectively upgrading my first J1.5 system plugin, adding multi language support. Unfortunately the languages are not loaded at the back end's plugin interface and I only can see the LANGUAGE_PLACEHOLDERS I definded at the plugin's manifest file.

Here are the steps I was going through:

1. Created the folder "language" at the plugin's root directory and stored the
(?:en-GB|de-DE|da-DK).plg_system_myplugin.ini in there.
2. Created an entry at the manifest file as follows.

Code: Select all

<languages folder="language">
    <language tag="en-GB">en-GB.plg_system_myplugin.ini</language>
    <language tag="de-DE">de-DE.plg_system_myplugin.ini</language>
    <language tag="da-DK">da-DK.plg_system_myplugin.ini</language>
</languages>

3. Placed the language placeholders for description and params as shown below.

Code: Select all

<param name="core" type="radio" default="0" label="CORE_LABEL" description="CORE_DESCRIPTION">
<option value="1">ENABLE</option>
<option value="0">DISABLE</option>
</param>

4. Created a package and installed it.

The languages are installed correctly and after installation they can be found under ~/administrator/language/de-DE/......

For testing purposes I used the following code at my ~/plugins/system/plg_system_myplugin.php in order to check if the language strings are set properly.

Code: Select all

$lang   =& JFactory::getLanguage();
die(print_r($lang));


I can see that the JLanguage instance contains:

Code: Select all

$lang->_paths['plg_system_debug'] => Array
    (
        [/path/to/joomla/administrator/language/de-DE/de-DE.plg_system_myplugin.ini] => 1
    )


But Joomla! does not initialize the language INIs at runtime. With my modules this works very well, and I have a functioning multi language support there, but not with the plugin. The funny thing on this is, that the placeholders ENABLE and DISABLE are replaced correctly due to their existence in one of the core INIs. :)

System is: Joomla! 1.5.8 (tested on 1.5.7 also)

Could please nudge me someone to the right direction? I can't see the wood for the trees right now. :(

Thank you very much in advance.

Best Regards
Uwe

Plugin languages are really designed for the backend, rather than for the frontend, and they are generally intended to allow you to have your configuration parameters translated.

For other uses (i.e., to translate your actual plugin text), you will likely have to load your language files manually.

Ian

User avatar
uwalter
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Fri Nov 07, 2008 1:21 pm
Location: Mainz, Germany
Contact:

Re: Plugin does not load language

Postby uwalter » Sat Dec 20, 2008 4:54 am

Hi Ian,

thanks for your reply, but I think you misunderstood my post. ;)

ianmac wrote:Plugin languages are really designed for the backend, rather than for the frontend, and they are generally intended to allow you to have your configuration parameters translated.


This is exactly what I want.

ianmac wrote:For other uses (i.e., to translate your actual plugin text), you will likely have to load your language files manually.


I don't need the language at the front end. My only intension is the plugin parameters.


Best Regards
Uwe
Linux is a wigwam: No windows, no gates and an apache inside.

User avatar
ianmac
Joomla! Virtuoso
Joomla! Virtuoso
Posts: 4785
Joined: Sat Sep 24, 2005 11:01 pm
Location: Toronto, Canada

Re: Plugin does not load language

Postby ianmac » Sat Dec 20, 2008 4:49 pm

uwalter wrote:Hi Ian,

thanks for your reply, but I think you misunderstood my post. ;)

ianmac wrote:Plugin languages are really designed for the backend, rather than for the frontend, and they are generally intended to allow you to have your configuration parameters translated.


This is exactly what I want.

ianmac wrote:For other uses (i.e., to translate your actual plugin text), you will likely have to load your language files manually.


I don't need the language at the front end. My only intension is the plugin parameters.


Best Regards
Uwe

That's odd... it does get loaded for other plugins (as you can probably tell). Maybe it is a naming convention problem?

Ian

User avatar
uwalter
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Fri Nov 07, 2008 1:21 pm
Location: Mainz, Germany
Contact:

Re: Plugin does not load language

Postby uwalter » Sun Dec 21, 2008 12:29 am

Hi Ian,

thanks for your quick response.

ianmac wrote:That's odd...


Indeed, that's it. And your answer now shows me, that my steps in implementing multi language support were right. :geek:

ianmac wrote:it does get loaded for other plugins (as you can probably tell).


I had an install of a dutch plugin, but there the languages were not loaded too. I can do some more testing on that.

ianmac wrote:Maybe it is a naming convention problem?


Ah, thank you for that hint, so I do know now for what I can scan the Joomla code. By now for me it looks like a bug in Joomla, but I'm not sure because I am too new to the J1.5 development. :)

Best Regards
Uwe
Linux is a wigwam: No windows, no gates and an apache inside.

User avatar
uwalter
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Fri Nov 07, 2008 1:21 pm
Location: Mainz, Germany
Contact:

Re: Plugin does not load language

Postby uwalter » Tue Dec 23, 2008 8:11 am

Hi all together,

Finally I got'em and it was a naming convention problem, indeed. Plugin names must not contain underscores! Did not write that in my first post, because I was not aware of its importance, sorry.

I think that Joomla splits the language filenames by underscore and so the language file was never initialized, because the plugin name was broken.

The follwing changes solved the problem:
1. Changed the plugin name.

Code: Select all

OLD: <filename plugin="prefix_plugname">plg_prefix_pluganme.php</filename>
NEW: <filename plugin="prefix.plugname">prefix.pluganme.php</filename>


2. Changed the language filenames

Code: Select all

<languages folder="language">
    <language tag="en-GB">en-GB.plg_system_prefix.plugname.ini</language>
    <language tag="de-DE">de-DE.plg_system_prefix.plugname.ini</language>
    <language tag="da-DK">da-DK.plg_system_prefix.plugname.ini</language>
</languages>


Best Regards
Uwe
Linux is a wigwam: No windows, no gates and an apache inside.


Return to “Joomla! 1.5 Coding”

Who is online

Users browsing this forum: No registered users and 6 guests