CubeCart v6 uses XML-based language files to provide translations for plugins.

Default Language Strings

Every plugin must include a language/module.definitions.xml file with the default (English) strings. This uses the <definitions> format:

<?xml version="1.0" encoding="UTF-8"?>
<definitions version="1.0">
  <group name="my_plugin">
    <string name="title"><![CDATA[My Plugin]]></string>
    <string name="enabled"><![CDATA[Enable Plugin]]></string>
    <string name="description"><![CDATA[A short description.]]></string>
  </group>
</definitions>

The group name must match your plugin’s folder name.

Adding Translations

Translation files go in the same language/ folder, named using the language code (e.g. fr-FR.xml, de-DE.xml):

my_plugin/
  language/
    module.definitions.xml     (English defaults)
    fr-FR.xml                  (French)
    de-DE.xml                  (German)
    es-ES.xml                  (Spanish)

Translation File Format

Translation files use a different format from the definitions file — they use the <language> wrapper with <translation>:

<?xml version="1.0" encoding="UTF-8"?>
<language version="1.0">
  <info>
    <title>Français</title>
    <code>fr-FR</code>
    <character_set>utf-8</character_set>
    <version>1.0.0</version>
  </info>
  <translation>
    <group name="my_plugin">
      <string name="title"><![CDATA[Mon Plugin]]></string>
      <string name="enabled"><![CDATA[Activer le plugin]]></string>
      <string name="description"><![CDATA[Une courte description.]]></string>
    </group>
  </translation>
</language>

How CubeCart Loads Translations

CubeCart first loads module.definitions.xml as defaults. It then looks for a matching {language_code}.xml file (e.g. fr-FR.xml) and overrides the defaults with the translated strings. If no translation file exists for the active language, the English defaults are used.

Tips

  • Always provide English defaults in module.definitions.xml.
  • The group name must be consistent across all files and match your plugin folder name.
  • Use <![CDATA[...]]> wrappers for all string values.
  • CubeCart ships with support for many languages including en-GB, fr-FR, de-DE, es-ES, and more. You only need to translate the ones your audience needs.