The Joomla! Forum ™



Forum rules


Please use the mailing list here: http://groups.google.com/group/joomla-dev-general rather than this forum.



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
PostPosted: Thu Dec 18, 2008 1:10 am 
User avatar
Joomla! Fledgling
Joomla! Fledgling

Joined: Fri Nov 07, 2008 1:21 pm
Posts: 4
Location: Mainz, Germany
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:
<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:
<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:
$lang   =& JFactory::getLanguage();
die(print_r($lang));


I can see that the JLanguage instance contains:
Code:
$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

_________________
Linux is a wigwam: No windows, no gates and an apache inside.


Last edited by uwalter on Tue Dec 23, 2008 8:11 am, edited 1 time in total.

Top
 Profile  
 
PostPosted: Sat Dec 20, 2008 3:46 am 
User avatar
Joomla! Virtuoso
Joomla! Virtuoso

Joined: Sat Sep 24, 2005 11:01 pm
Posts: 4785
Location: Toronto, Canada
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:
<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:
<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:
$lang   =& JFactory::getLanguage();
die(print_r($lang));


I can see that the JLanguage instance contains:
Code:
$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


Top
 Profile  
 
PostPosted: Sat Dec 20, 2008 4:54 am 
User avatar
Joomla! Fledgling
Joomla! Fledgling

Joined: Fri Nov 07, 2008 1:21 pm
Posts: 4
Location: Mainz, Germany
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.


Top
 Profile  
 
PostPosted: Sat Dec 20, 2008 4:49 pm 
User avatar
Joomla! Virtuoso
Joomla! Virtuoso

Joined: Sat Sep 24, 2005 11:01 pm
Posts: 4785
Location: Toronto, Canada
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


Top
 Profile  
 
PostPosted: Sun Dec 21, 2008 12:29 am 
User avatar
Joomla! Fledgling
Joomla! Fledgling

Joined: Fri Nov 07, 2008 1:21 pm
Posts: 4
Location: Mainz, Germany
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.


Top
 Profile  
 
PostPosted: Tue Dec 23, 2008 8:11 am 
User avatar
Joomla! Fledgling
Joomla! Fledgling

Joined: Fri Nov 07, 2008 1:21 pm
Posts: 4
Location: Mainz, Germany
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:
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:
<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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 



Who is online

Users browsing this forum: No registered users and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group