Search code examples
xmljoomlapackagetranslationjoomla3.0

Joomla 3.0 package translation


I wrote several extensions for Joomla 3.0 and want to package them. No problems so far but I haven't found a note on how to translate the package description via ini files.

My Package XML looks like the following:

Code:

<?xml version="1.0" encoding="UTF-8" ?>
<extension type="package" version="3.0">
  <name>Bootstrap editor package</name>
  <author>me</author>
  <creationDate>June 2014</creationDate>
  <packagename>profil_bootstrap_editor</packagename>
  <version>1.0.0</version>
  <url>web url</url>
  <copyright>the copyright</copyright>
  <license>GNU/GPL license: http://www.gnu.org/copyleft/gpl.html</license>
  <packager>me</packager>
  <packagerurl>package url</packagerurl>
  <description>PKG_PROFIL_BOOTSTRAP_EDITOR_DESCRIPTION</description>
  <files folder="pkg_profil_bootstrap_editor">
    <file type="plugin" id="profil_bootstrap_editor" group="editors">profil_bootstrap_editor.zip</file>
    <file type="plugin" id="profil_bootstrap_editor_content" group="content">profil_bootstrap_editor_content.zip</file>
  </files>
  <languages folder="language">
    <language tag="en-GB">en-GB/en-GB.pkg_profil_boostrap_editor.sys.ini</language>
    <language tag="de-DE">de-DE/de-DE.pkg_profil_boostrap_editor.sys.ini</language>
  </languages>
</extension>

The install process shows the translation but throws an error:

JInstaller: :Install: File does not exist tmp/install_54195d3da6b33/language/en-GB/en-GB.pkg_profil_boostrap_editor.sys.ini

How exactly should a translation be included in a package? Doesn't seem to work the same way for components, plugins or modules.

Solution:

As stated by @Lodder I had a misspelling in the language files. The package name and the language files need to match. Also method="upgrade" is necessary to override the old language files when reinstalling the package.

<?xml version="1.0" encoding="UTF-8" ?>
  <extension type="package" version="3.0" method="upgrade">
    <name>Bootstrap editor package</name>
    <author>me</author>
    <creationDate>June 2014</creationDate>
    <packagename>profil_bootstrap_editor</packagename>
    <version>1.0.0</version>
    <url>web url</url>
    <copyright>the copyright</copyright>
    <license>GNU/GPL license: http://www.gnu.org/copyleft/gpl.html</license>
    <packager>me</packager>
    <packagerurl>package url</packagerurl>
    <description>PKG_PROFIL_BOOTSTRAP_EDITOR_DESCRIPTION</description>
    <files folder="pkg_profil_bootstrap_editor">
      <file type="plugin" id="profil_bootstrap_editor"   group="editors">profil_bootstrap_editor.zip</file>
      <file type="plugin" id="profil_bootstrap_editor_content" group="content">profil_bootstrap_editor_content.zip</file>
    </files>
    <languages folder="language">
      <language tag="en-GB">en-GB/en-GB.pkg_profil_bootstrap_editor.sys.ini</language>
      <language tag="de-DE">de-DE/de-DE.pkg_profil_bootstrap_editor.sys.ini</language>
    </languages>
  </extension>

Solution

  • Ok, just tested this. Firstly, change the description in your language file to a translatable string like so:

    <description>MY_PACKAGE_DESCRIPTION</description>
    

    Then add the following to your XML file:

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

    Then created 2 language files in the following directories within your package folder:

    language/en-GB/en-GB.pkg_profil_bootstrap_editor.ini
    language/en-GB/en-GB.pkg_profil_bootstrap_editor.sys.ini
    

    Then add the following to both language files:

    ; $Id: en-GB.pkg_profil_bootstrap_editor.ini 17.09.2014 $
    ; Pkg pkg_profil_bootstrap_editor
    ; @date 17.09.2014
    ; @Copyright (C) 2011 - 2012 JoomJunk
    ; @ Released under GNU/GPL 3.0 License
    ; Note : All ini files need to be saved as UTF-8
    
    MY_PACKAGE_DESCRIPTION="<h1>My Package</h1>"
    

    Hope this helps

    Edit:

    I've just noticed on your XML you have misspelled the name of the language file:

    Change:

    en-GB.pkg_profil_boostrap_editor.sys.ini
    

    To:

    en-GB.pkg_profil_bootstrap_editor.sys.ini
    

    Update:

    Change

    <extension type="package" version="3.0">
    

    to:

    <extension type="package" version="3.0" method="upgrade">