Creating a miltilingual plugin in CubeCart v5 is simple. As other articles have explained a module.definitions.xml file is required to set the default language strings.
Below is an example of a default module.definitions.xml file:
This file needs to be treated as the default fallback file which is always loaded and then replaced with strings for a different locale. Say you wanted to create a US English translation. To do this duplicate the file and rename it en-US.xml. The content can then be translated. In this case we changed "Hello" to "Howdy!".
Important: The group name must always be the plugin folder name in lowercase!
The name of the file must always take the language and country ISO code. Below are a few exampes:
en-GB - British English
en-US - American English
fr-FR - French French
br-PT - Brazillian Portuguese
The admin side of the store will automaticaly load these language difinitions via the module class but you may need to add code such as below to hooks or other custom classes to get the langauge strings to load properly.
$GLOBALS['language']->loadDefinitions('wishlist', CC_ROOT_DIR.CC_DS.'modules'.CC_DS.'plugins'.CC_DS.'example_plugin'.CC_DS.'language', 'module.definitions.xml');
$GLOBALS['language']->loadLanguageXML('wishlist', '', CC_ROOT_DIR.CC_DS.'modules'.CC_DS.'plugins'.CC_DS.'example_plugin'.CC_DS.'language');
Merchants using your plugin will be able to modify the language strings from the "Settings" >> "Languages" >> {Chosen Language} >> Modules - Plugins - example_pugin in the admin conrol panel.
Comments
0 comments
Please sign in to leave a comment.