JoomlaModule Development Combat06-language Filesin this section we will introduce the language files of Joomla. How to make it easy for our modules to support multiple languages.
on the basis of the multi-language of Joomla, there is not much to say here. If you are not sure, please see the multilingual articles on this site. First we need to create a new two language file. Then include the language file in the XML file so that the installer can put the language file in the correct place. Other things will be given to Joomla to do.
Focus on how the XML file contains the language file
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
<files> <filename module= "Mod_articletree" >mod_articletree.php</filename> <folder>tmpl</folder> <folder>language</folder> <filename>helper.php</filename> <filename>index.html</filename> <filename>mod_articletree.xml</filename> </files> <languages folder= "Language" > <language tag= "ZH-CN" >zh-CN/zh-CN.mod_articletree.sys.ini</language> <language tag= "ZH-CN" >zh-CN/zh-CN.mod_articletree.ini</language> <language tag= "EN-GB" >en-GB/en-GB.mod_articletree.sys.ini</language> <language tag= "EN-GB" >en-GB/en-GB.mod_articletree.ini</language> </languages> |
The above code is a more generic XML file containing the language file. Note that the language folder here should be in a directory with the component's directory. The following is a file structure:
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/5C/0F/wKioL1UaOheytA84AACpwHbGni4161.jpg "title=" HC72IUHS (KTO ' v072%y@[v7.png "alt=" Wkiol1uaoheyta84aacpwhbgni4161.jpg "/>
Of course, the above <folder>language</folder> can not be. If so, the system copies a copy of the language file to the installation directory of the module. The language files are also placed in the corresponding directories in Jsite/languages (EN-GB and ZH-CN).
The system retrieves the order of language files
The system will first look for the language file that corresponds to the jsite/language. If it is found, load it. If it is not found, locate the language file in the language folder under the installation directory of the module. If the language of the current system is Chinese (ZH-CN). Then the system will first look for Zh-cn.mod_articletree.ini in/languages/zh-cn/, Zh-cn.mod_articletree.sys.ini. If not found, then go to/MODULES/MOD_ARTICLETREE/LANGUAGE/ZH-CN under Search. If you still don't find it, you'll find the en-gb.mod_**** file. If it is not, then the original character is displayed directly.
Range of language files
Joomla There are two language files, one is. INI and the other is. Sys.ini. Their jurisdiction is not the same.
. Sys.ini responsible for the type of module, the type of component, and the prompt information that is displayed when the component is installed. Of course, this may not be a complete list.
. INI responsible for the translation of other information in addition
Attention
The description information of the module will be used in two places. One is when the module is installed, this time the description information is translated from the. Sys.ini. The other one is in module management, view module details or the module's description in the new module's page. This is translated in the. ini.
This is our website: http://www.zmax99.com, there are many free Joomla development tutorials, welcome to download! Zmax-----china Joomla Development Team!
Joomla Module Development Combat 06-language files