This example is intended to demonstrate the language capabilities of XMLForm. It builds on the XML Only Example XMLForm by introducing a language file into the exact same form. Because I considered language files to be "supporting files", I implemented the file system structure suggested in XMLForm Basic File System Setup. I'll recap the prescribed file system structure for this example.
File System Structure
As described in the File System Setup article, a form which has supporting files SHOULD be placed in its own folder to keep it self contained. We'll call this form "basic_language", and here is the structure I created for it:
- JPATH_ROOT
- /basic_language
- /basic_language.xml
- /language
- /en-GB
- /basic_language.ini
- /en-GB
- /basic_language
As with the XML Only example, we are relying on the HTML <table> output in order to keep the example as simple as possible. Output templates are covered in other examples.
Common Base Name
You'll notice that the files share a common base name. This is detailed in the File System Setup article. If your XML file is named basic_language.xml, then "basic_language" is the base name, and your template and language files MUST share that base name.
Standard Joomla Language Folder Structure
Seasoned Joomla developers may notice that the language folder structure follows the Joomla language folder structure pattern. This is, of course, intentional. Using this existing structure allows me to use the Joomla translation components as intended. It keeps the plugin simple and provides a standardized and well documented structure to follow when building XMLForms.
Field Setup
The ONLY difference in setting up this field vs the field in the XML Only example is the Use Language switch - simply, turn it on. Joomla and XMLForm handles the rest.