Language File Not Loading for System Plugin

878 views
Skip to first unread message

tomfuller

unread,
Apr 28, 2011, 10:20:59 PM4/28/11
to joomla-de...@googlegroups.com
I have upgraded several of my plugins to Joomla 1.6. The module and search plugin translate fine, but my system plugin jbspodcast does not.

The system strings do translate, but not the user strings contained in the xml file.

Example in xml:

    <field name="recipients" type="text" default="" size="80" label="PLG_JBSPODCAST_TO_EMAIL" description="PLG_JBSPODCAST_TO_EMAIL_DESC" />

In en-GB.plg_system_jbspodcast.ini:

PLG_JBSPODCAST_TO_EMAIL="To Email address(s)"

How I load the language in the jbspodcast.php:

 public function __construct(& $subject, $config)
        {
 
                parent::__construct($subject, $config);
 
                $this->loadLanguage();
                $this->loadLanguage('com_biblestudy',JPATH_ADMINISTRATOR);
 
        }

Part of the plugin fires off a function in the Joomla Bible Study component that needs to translate strings from the component language files. Those strings do translate correctly.

With language debug on I get this in the user interface on the admin side for the plugin:

??PLG_JBSPODCAST_TO_EMAIL??

The language file is stored in the administrator/language/en_GB/en-GB.plg_system_jbspodcast.ini along with the sys.ini file (which is being loaded and translating the system strings)

Any help is appreciated.

Tom

Sam Moffatt

unread,
Apr 28, 2011, 10:41:49 PM4/28/11
to joomla-de...@googlegroups.com
With debug and language debug on what language files does it show as
loading? Also the JPATH_ADMINISTRATOR is surplus to requirement as it
is the default for the second param in Joomla! 1.6.

Cheers,

Sam Moffatt
http://pasamio.id.au

> --
> You received this message because you are subscribed to the Google Groups
> "Joomla! General Development" group.
> To post to this group, send an email to joomla-de...@googlegroups.com.
> To unsubscribe from this group, send email to
> joomla-dev-gene...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/joomla-dev-general?hl=en-GB.
>

tomfuller

unread,
Apr 28, 2011, 10:56:54 PM4/28/11
to joomla-de...@googlegroups.com
I didn't realize there was more language info below the debug:

Here are the first few lines:

**Language Files Loaded**

  • C:\xampp\htdocs\j16-1\administrator/language/en-GB/en-GB.ini 1
  • C:\xampp\htdocs\j16-1\administrator/language/en-GB/en-GB.plg_system_jbspodcast.ini
  • C:\xampp\htdocs\j16-1\plugins\system\jbspodcast/language/en-GB/en-GB.plg_system_jbspodcast.ini
Later on the list:

C:\xampp\htdocs\j16-1\administrator/language/en-GB/en-GB.plg_system_jbspodcast.sys.ini 1

The folder in my .zip file that holds the languages are /administrator/language/en_GB

I notice it is trying to load some folder off of the plugins/system/jbspodcast folder - but there is no language folder in there. Perhaps I am creating my xml incorrectly.

<languages folder="administrator/language/en-GB">
        <language tag="en-GB">en-GB.plg_system_jbspodcast.ini</language>
        <language tag="en-GB">en-GB.plg_system_jbspodcast.sys.ini</language>
    </languages>

tomfuller

unread,
Apr 28, 2011, 11:03:40 PM4/28/11
to joomla-de...@googlegroups.com
I moved the language files to the root but no change. Here is the language debug:

    • C:\xampp\htdocs\j16-1\administrator/language/en-GB/en-GB.ini 1
    • C:\xampp\htdocs\j16-1\administrator/language/en-GB/en-GB.lib_joomla.ini 1
    • C:\xampp\htdocs\j16-1\administrator/language/en-GB/en-GB.tpl_bluestork.ini 1
    • C:\xampp\htdocs\j16-1\administrator/language/en-GB/en-GB.com_plugins.ini 1
    • C:\xampp\htdocs\j16-1\administrator/language/en-GB/en-GB.plg_system_cache.sys.ini 1
    • C:\xampp\htdocs\j16-1\administrator/language/en-GB/en-GB.plg_system_captcha.sys.ini
    • C:\xampp\htdocs\j16-1\plugins/system/captcha/language/en-GB/en-GB.plg_system_captcha.sys.ini
    • C:\xampp\htdocs\j16-1\administrator/language/en-GB/en-GB.plg_system_debug.sys.ini 1
    • C:\xampp\htdocs\j16-1\administrator/language/en-GB/en-GB.plg_system_dump.sys.ini
    • C:\xampp\htdocs\j16-1\plugins/system/dump/language/en-GB/en-GB.plg_system_dump.sys.ini
    • C:\xampp\htdocs\j16-1\administrator/language/en-GB/en-GB.plg_system_jbspodcast.sys.ini 1
    • C:\xampp\htdocs\j16-1\administrator/language/en-GB/en-GB.plg_system_languagefilter.sys.ini 1
    • C:\xampp\htdocs\j16-1\administrator/language/en-GB/en-GB.plg_system_log.sys.ini 1
    • C:\xampp\htdocs\j16-1\administrator/language/en-GB/en-GB.plg_system_logout.sys.ini 1
    • C:\xampp\htdocs\j16-1\administrator/language/en-GB/en-GB.plg_system_p3p.sys.ini 1
    • C:\xampp\htdocs\j16-1\administrator/language/en-GB/en-GB.plg_system_redirect.sys.ini 1
    • C:\xampp\htdocs\j16-1\administrator/language/en-GB/en-GB.plg_system_remember.sys.ini 1
    • C:\xampp\htdocs\j16-1\administrator/language/en-GB/en-GB.plg_system_sef.sys.ini 1
    • C:\xampp\htdocs\j16-1\administrator/language/en-GB/en-GB.plg_system_jbspodcast.ini
    • C:\xampp\htdocs\j16-1\plugins/system/jbspodcast/language/en-GB/en-GB.plg_system_jbspodcast.ini

    Sam Moffatt

    unread,
    Apr 28, 2011, 11:23:37 PM4/28/11
    to joomla-de...@googlegroups.com
    On Fri, Apr 29, 2011 at 1:03 PM, tomfuller <tomfu...@gmail.com> wrote:
    > C:\xampp\htdocs\j16-1\plugins/system/jbspodcast/language/en-GB/en-GB.plg_system_jbspodcast.ini

    So to clarify this path exists on the file system? With 1.6 we started
    a shift for third party extensions to contain language files within
    their own packages. This is primarily to ensure that third party
    language files are not mutilated through operations on core language
    packs (e.g. you support French but French isn't installed when your
    extension is installed thus isn't copied however later on a French
    language pack is installed however your extension is unavailable in
    French because it wasn't there at install time; alternatively it was,
    French is uninstalled and reinstalled with similar unavailability).

    As noted in the plgSystemAlpha install file the <languages> tag is
    deprecated in preference for including the language files within the
    package itself. Check out the following link for an example:
    https://svn.joomlacode.org/svn/joomla/development/trunk/tests/_data/installer_packages/plg_system_alpha/

    Cheers,

    Sam

    JM Simonet

    unread,
    Apr 29, 2011, 1:43:04 AM4/29/11
    to joomla-de...@googlegroups.com
    Concerning the xml, please look at the example content plugin.

    <files>
            <filename plugin="example">example.php</filename>
                   <filename>index.html</filename>
            <!--
                        if you want to install the language files in the plugin folder.
                    Create a "language" folder at the root of the pack i.e
                      language/en-GB/en-GB.plg_content_example.ini
                        language/en-GB/en-GB.plg_content_example.sys.ini
                    -->
                 <folder>language</folder>
           </files>
            <languages folder="language">
               <!--
                        these files will be installed in the administrator/language folder.
                 -->
                 <language tag="en-GB">en-GB/en-GB.plg_content_example.ini</language>
                <language tag="en-GB">en-GB/en-GB.plg_content_example.sys.ini</language>
            </languages>

    JM
    --

    You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
    To post to this group, send an email to joomla-de...@googlegroups.com.
    To unsubscribe from this group, send email to joomla-dev-gene...@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/joomla-dev-general?hl=en-GB.


    -- 
    
    Please keep the Subject wording in your answers
    This e-mail and any attachments may be confidential. You must not disclose or use the information contained in this e-mail if you are not the
    intended recipient. If you have received this e-mail in error, please notify us immediately and delete the e-mail and all copies.
    -----------------------------------------------------------
    Jean-Marie Simonet  /  infograf768
    Joomla Leadership Team - Production Working group
    Joomla! Translation Coordination Team 

    tomfuller

    unread,
    Apr 29, 2011, 11:13:53 AM4/29/11
    to joomla-de...@googlegroups.com
    I followed the example you provided Jean-Marie and changed the file structure this way:

    <files>
            <filename plugin="jbspodcast">jbspodcast.php</filename>
            <folder>language</folder>
        </files>

    In the language folder there is another folder called en-GB and in that folder are two files:

    en-GB.plg_system_jbspodcast.ini
    en-GB.plg_system_jbspodcast.sys.ini

    On install the two files and the folders are added to the /plugins/system/jbspodcast folder.

    One change: The description of the plugin upon install now translates correctly, however, the strings in the form still do not translate. When editing the plugn parameters, the system areas do translate as before so the sys.ini file is being loaded and used.

    In the language files loaded is this line:

    l/jbs7/plugins/system/jbspodcast/language/en-GB/en-GB.plg_system_jbspodcast.ini

    There is no 1 at the end - is this significant?

    At the bottom it also shows the strings in the form are untranslated.

    I have verified that the files exist and the path in the language files loaded list is correct (I removed part of it for security reasons).

    Is this still the correct way to call the language?

    JM Simonet

    unread,
    Apr 29, 2011, 12:52:11 PM4/29/11
    to joomla-de...@googlegroups.com


    As Sam rightfully said
    $this->loadLanguage();
    is enough.

    If there is no 1, it means the file is not loaded.
    Can you delete the ini and sys.ini in the core
    administrator/language/en-GB/ and see what happens.
    I guess it would also not work because of your former post;

    "C:\xampp\htdocs\j16-1\plugins/system/jbspodcast/language/en-GB/en-GB.plg_system_jbspodcast.ini"

    // without 1

    If I guessed OK, please send me the plugin. I will have a look.

    JM

    tomfuller

    unread,
    Apr 29, 2011, 1:10:55 PM4/29/11
    to joomla-de...@googlegroups.com
    The files did not exist in the administrator/language/en-GB folder.

    Here is the plugin. You won't want to enable it as it will error because there is no instance of the Joomla Bible Study component installed but left disabled you should still be able to see the translations working or not.

    Thanks so much!

    Tom
    jbspodcast.zip

    Ian MacLennan

    unread,
    Apr 29, 2011, 1:23:04 PM4/29/11
    to joomla-de...@googlegroups.com

    **Parsing errors in language files**

    • C:\xampp\htdocs\trunk\plugins/system/jbspodcast/language/en-GB/en-GB.plg_system_jbspodcast.ini : error(s) in line(s) 50
    Line 50 is:
    PLG_JBSPODCAST_USE_OFFSET"Use Offset"

    I added an = sign and it worked fine.

    Ian


    --

    tomfuller

    unread,
    Apr 29, 2011, 1:28:46 PM4/29/11
    to joomla-de...@googlegroups.com
    And of course, once again - Ian, you are the man! (I'm sure you don't remember but in 2007 you were instrumental in helping me create the original version of my component).

    Was that parsing error there in the language debug all along and I just didn't see it?

    I also appreciate the explanation of how the languages work - it wasn't clear to me looking at the examples.

    All good now.
    Reply all
    Reply to author
    Forward
    0 new messages