Creating language packs for extensions in Joomla 1.6/1.7
(→Example Plugin Language Pack) |
(→Example Plugin Language Pack) |
||
| Line 10: | Line 10: | ||
── alpha_zz_zz_language_pack | ── alpha_zz_zz_language_pack | ||
├── index.html | ├── index.html | ||
| − | ├── | + | ├── alpha_zz_zz_language_pack.xml |
├── zz-ZZ.plg_content_alpha.ini | ├── zz-ZZ.plg_content_alpha.ini | ||
| − | + | ├── zz-ZZ.plg_content_alpha.sys.ini | |
| + | └── language | ||
| + | ├── en-GB | ||
| + | │ └── en-GB.files_alpha_zz_zz_language_pack.sys.ini | ||
| + | └── zz-ZZ | ||
| + | └── zz-ZZ.files_alpha_zz_zz_language_pack.sys.ini | ||
</pre> | </pre> | ||
| − | where the file ' | + | where the file 'alpha_zz_zz_language_pack.xml' is the installation manifest file. |
| + | |||
| + | The manifest file would look something like this: | ||
<code lang="xml"> | <code lang="xml"> | ||
<?xml version="1.0" encoding="utf-8"?> | <?xml version="1.0" encoding="utf-8"?> | ||
Revision as of 20:46, 10 July 2011
Although Joomla 1.6 supports installing language files for the front end (site) or back end (admin), it has no dedicated way to install language files for extensions (components, plugins, modules) unless they are installed with the extension itself.
Fortunately, Joomla 1.6 supports a powerful way to install an arbitrary set of files called a 'files' installation unit. (See Installation unit for an arbitrary set of files named 'files_test1').
Example Plugin Language Pack
Suppose you have a content plugin named 'alpha' that you want to create a new language pack for language zz-ZZ. Here is what your language pack files in the folder 'alpha_zz_zz_language_pack' might look like:
── alpha_zz_zz_language_pack
├── index.html
├── alpha_zz_zz_language_pack.xml
├── zz-ZZ.plg_content_alpha.ini
├── zz-ZZ.plg_content_alpha.sys.ini
└── language
├── en-GB
│ └── en-GB.files_alpha_zz_zz_language_pack.sys.ini
└── zz-ZZ
└── zz-ZZ.files_alpha_zz_zz_language_pack.sys.ini
where the file 'alpha_zz_zz_language_pack.xml' is the installation manifest file.
The manifest file would look something like this:
<?xml version="1.0" encoding="utf-8"?>
<extension version="1.7" type="file" method="upgrade">
<name>alpha_zz_zz_language_pack</name>
<version>1.6</version>
<creationDate></creationDate>
<author></author>
<authorEmail></authorEmail>
<authorUrl></authorUrl>
<copyright>Copyright (C) 2011 ???. All rights reserved.</copyright>
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
<description>ALPHA_ZZ_ZZ_LANGUAGE_PACK</description>
<fileset>
<files target="plugins/content/alpha/language/zz-ZZ">
<filename>index.html</filename>
<filename>zz-ZZ.plg_content_alpha.ini</filename>
<filename>zz-ZZ.plg_content_alpha.sys.ini</filename>
</files>
<files folder="language/en-GB" target="language/en-GB">
<filename>en-GB.files_alpha_zz_zz_language_pack.sys.ini</filename>
</files>
<files folder="language/zz-ZZ" target="language/zz-ZZ">
<filename>zz-ZZ.files_alpha_zz_zz_language_pack.sys.ini</filename>
</files>
</fileset>
</extension>