Archived

Difference between revisions of "Making a Language Pack for Joomla"

From Joomla! Documentation

(32 intermediate revisions by 6 users not shown)
Line 1: Line 1:
This is a Tutorial explaining how to create your language packs in 1.6.
+
{{version/tutor|1.6,1.7,2.5,3.0}}
 +
==How to create your CORE language packs==
  
fr-FR is taken as an example of language prefix.
+
'''For 3rd party extensions self-contained ini files installation''', see http://docs.joomla.org/Making_non-core_language_packs_in_2.5
  
'''1.''' In the case of a '''FULL''' pack, the package is composed of 3 files, then zipped.  
+
The localise component may help you create and update the ini files: http://extensions.joomla.org/extensions/languages/language-edition/17755
  
pkg_fr-FR.xml
+
fr-FR is taken as an example of language prefix.
  
site_fr-FR.zip
+
# In the case of a '''FULL''' pack, the package is composed of 3 files, then zipped.
 +
#* pkg_fr-FR.xml
 +
#* site_fr-FR.zip
 +
#* admin_fr-FR.zip
  
admin_fr-FR.zip
+
# Naming of the pack
 
+
#* fr-FR_joomla_lang_full_2.5.6v1.zip
'''2.''' In the case of a '''site''' or '''administrator''' only pack, 2 files.
+
# '''IMPORTANT''': Since some administrator ini files are necessary in front-end and some changes were brought in the loading of the plugin ini files, it is always necessary to include some admin part in the final pack, even for a ''''site-only'''' pack. See below http://docs.joomla.org/Making_a_Language_Pack_for_Joomla_1.6#The_Site-only_pack
 
 
pkg_site_fr-FR.xml OR pkg_admin_fr-FR.xml
 
 
 
site_fr-FR.zip OR admin_fr-FR.zip
 
 
 
'''3.''' Naming of the pack
 
 
 
fr-FR_joomla_lang_full_1.6.0v1.zip
 
 
 
fr-FR_joomla_lang_site_1.6.0v1.zip if only site pack, fr-FR_joomla_lang_admin_1.6.0v1.zip if only administrator pack.
 
 
 
'''4.''' If one separates the site and admin packs then the pkg_ name should be different, i.e for example: pkg_site_fr-FR.xml and pkg_admin_fr-FR.xml. In this case beware of the <packagename> tag.
 
  
 
Also, each pack should include a fr-FR.lib_joomla.ini and a fr-FR.localise.php to cope for deletion of site or admin pack by the user.
 
Also, each pack should include a fr-FR.lib_joomla.ini and a fr-FR.localise.php to cope for deletion of site or admin pack by the user.
Line 30: Line 22:
  
 
<source lang="xml"><?xml version="1.0" encoding="UTF-8" ?>
 
<source lang="xml"><?xml version="1.0" encoding="UTF-8" ?>
<extension type="package" version="1.6">
+
<extension type="package" version="2.5">  <!-- replace by 3.0 for 3.0 packs -->
 
<name>French Language Pack</name>
 
<name>French Language Pack</name>
<packagename>fr-FR</packagename> //the packagename has to be the same as the name of pkg_whatever.xml
+
<packagename>fr-FR</packagename> <!-- the packagename has to be the same as the name of pkg_whatever.xml -->
<version>1.6.x</version> //change the version # when updating //will display in manager
+
<version>2.5.6.x</version> <!-- change the version # when updating, will display in manager -->
<creationDate></creationDate> //will display in manager
+
<creationDate></creationDate> <!-- will display in manager -->
<author></author> //will display in manager
+
<author></author> <!-- will display in manager -->
<authorEmail></authorEmail> //will display in manager
+
<authorEmail></authorEmail> <!-- will display in manager -->
<authorUrl></authorUrl> //will display in manager
+
<authorUrl></authorUrl> <!-- will display in manager -->
<description>1.6.x Joomla French Language Package</description>
+
<description>2.5.6.1 Joomla French Language Package</description>  <!-- replace by 3.0.x.x in 3.0 packs -->
 
<files>
 
<files>
 
<file type="language" client="site" id="fr-FR">site_fr-FR.zip</file>
 
<file type="language" client="site" id="fr-FR">site_fr-FR.zip</file>
 
<file type="language" client="administrator" id="fr-FR">admin_fr-FR.zip</file>
 
<file type="language" client="administrator" id="fr-FR">admin_fr-FR.zip</file>
 
</files>
 
</files>
 +
<updateservers>
 +
<server type="collection" priority="1" name="Accredited Joomla! Translations">http://update.joomla.org/language/translationlist.xml</server>
 +
                <!-- replace url by http://update.joomla.org/language/translationlist_3.xml for 3.x packs -->
 +
</updateservers>
 
</extension> </source>
 
</extension> </source>
  
 
==One zip per client (i.e. site and admin)==
 
==One zip per client (i.e. site and admin)==
  
site_fr-FR.zip
+
* site_fr-FR.zip
 
+
* admin_fr-FR.zip
admin_fr-FR.zip
 
  
 
Content of the client's zip (example below is for admin)
 
Content of the client's zip (example below is for admin)
Line 56: Line 51:
  
 
<source lang="xml"><?xml version="1.0" encoding="utf-8" ?>
 
<source lang="xml"><?xml version="1.0" encoding="utf-8" ?>
<extension version="1.6" client="administrator" type="language" method="upgrade"> // change to client="site" if site pack
+
<extension version="2.5" client="administrator" type="language" method="upgrade"> // change to client="site" if site pack <install is deprecated. Use <extension as it will be compatible with the 3.x series
 
     <name>French (Fr)</name>
 
     <name>French (Fr)</name>
 
     <tag>fr-FR</tag>
 
     <tag>fr-FR</tag>
     <version>1.6</version>
+
     <version>2.5.6.1</version>
 
     <creationDate>2010-08-01</creationDate>
 
     <creationDate>2010-08-01</creationDate>
 
     <author>French translation team : Joomla!fr</author>
 
     <author>French translation team : Joomla!fr</author>
Line 66: Line 61:
 
     <copyright>Copyright (C) 2005 - 2010 Joomla.fr et Open Source Matters. Tous droits réservés</copyright>
 
     <copyright>Copyright (C) 2005 - 2010 Joomla.fr et Open Source Matters. Tous droits réservés</copyright>
 
     <license>GNU General Public License version 2 or later; see LICENSE.txt</license>
 
     <license>GNU General Public License version 2 or later; see LICENSE.txt</license>
     <description>French language pack for Joomla! 1.6</description>
+
     <description>French language pack for Joomla! 1.7</description>
 
     <files>
 
     <files>
 
<filename>index.html</filename>
 
<filename>index.html</filename>
Line 73: Line 68:
 
<filename> .....ini</filename>
 
<filename> .....ini</filename>
 
[...]
 
[...]
                 <filename>fr-FR.lib_joomla.ini</filename> // Normally in administrator pack. !! If this is only a site pack then add in site !! Add in both if providing both packs together in one package
+
 +
                 <filename>fr-FR.lib_joomla.ini</filename> <!-- Add in both admin and site At least in site if "site only pack", see below -->
 
<filename>fr-FR.ini</filename>
 
<filename>fr-FR.ini</filename>
<filename file="meta">fr-FR.xml</filename> // Note the file="meta" tag, telling it's the basic xml holding info about the pack. Note file="meta"
+
<filename>fr-FR.css</filename> <!-- NEW IN 1.7: this file can be added in the ADMINISTRATOR pack if one wants to change the fonts used to display the back-end interface.-->
                 <filename file="meta">install.xml</filename> '''//Mandatory! This file lets uninstall a language.''' Note file="meta"
+
<filename file="meta">fr-FR.xml</filename> <!-- Note the file="meta" tag, telling it's the basic xml holding info about the pack. -->
<filename>fr-FR.localise.php</filename> // normally in the site pack. If the language has only an admin pack, put in the admin pack. Add in both if providing both packs together in one package.
+
                 <filename file="meta">install.xml</filename> <!-- Mandatory! This file lets uninstall a language. Note file="meta" -->
 +
<filename>fr-FR.localise.php</filename> <!-- Add in both admin and site. At least in site if "site only pack", see below -->
 
       </files>
 
       </files>
<media destination="fr-FR"> //if one needs to add a specific calendar
+
<media destination="fr-FR"> <!-- If one needs to add a specific calendar -->
 
    <filename>index.html</filename>
 
    <filename>index.html</filename>
 
<filename>js/index.html</filename>
 
<filename>js/index.html</filename>
Line 97: Line 94:
  
 
<source lang="xml"><?xml version="1.0" encoding="utf-8"?>
 
<source lang="xml"><?xml version="1.0" encoding="utf-8"?>
<metafile version="1.6" client="administrator" method="upgrade" >
+
<metafile version="2.5" client="administrator" >
 
<tag>fr-FR</tag>
 
<tag>fr-FR</tag>
 
<name>French (FR)</name>
 
<name>French (FR)</name>
 
<description>French administrator language for Joomla 1.6</description>
 
<description>French administrator language for Joomla 1.6</description>
<version>1.6</version>
+
<version>2.5.6.1</version>
 
<creationDate>2010-08-01</creationDate>
 
<creationDate>2010-08-01</creationDate>
 
         <author>French translation team : Joomla!fr</author>
 
         <author>French translation team : Joomla!fr</author>
Line 112: Line 109:
 
<tag>fr-FR</tag>
 
<tag>fr-FR</tag>
 
<rtl>0</rtl>
 
<rtl>0</rtl>
                 <locale>fr_FR.utf8, fr_FR.UTF-8, fr_FR.UTF-8@euro, French_Standard,french, fr_FR, fre_FR, fr</locale> //the locale is used to sort translated lists when present on the server.
+
                 <locale>fr_FR.utf8, fr_FR.UTF-8, fr_FR.UTF-8@euro, French_Standard,french, fr_FR, fre_FR, fr</locale> <!-- the locale is used to sort translated lists when present on the server. -->
                 <firstDay>1</firstDay> // used for the Calendar icon to specify what is the first day of the week in that language. 0 is Sunday, 1 is Monday, etc.
+
                 <firstDay>1</firstDay> <!-- used for the Calendar icon to specify what is the first day of the week in that language. 0 is Sunday, 1 is Monday, etc. -->
 
</metadata>
 
</metadata>
 
<params />
 
<params />
Line 120: Line 117:
 
===the fr-FR.localise.php===
 
===the fr-FR.localise.php===
  
(This is normally in the site pack. Add in admin pack if the pack does only provide admin language. Add in both when providing a full pack to cope with user deleting one of the packs)
+
(This file should be present at least in site zip)
  
 
Explanation of this file:
 
Explanation of this file:
Line 134: Line 131:
 
*Define specific plural functionality for some languages where the value of the string can change depending on the count (Russian for example).
 
*Define specific plural functionality for some languages where the value of the string can change depending on the count (Russian for example).
  
*Define custom transliteration (i.e. when NOT using the Unicode URLS parameter in Global Configuration) to ensure proper change of some alphabets to ascii for the alias used when SEF is on. (The transliteration which is now default in 1.6 should take care of all latin-based languages.)
+
*Define custom transliteration (i.e. when NOT using the Unicode URLS parameter in Global Configuration) to ensure proper change of some alphabets to ascii for the alias used when SEF is on. (The transliteration which is now default in 1.7 should take care of all latin-based languages.)
  
 
*Define a custom calendar by adding a function as well as some js files
 
*Define a custom calendar by adding a function as well as some js files
Line 156: Line 153:
 
  * @since 1.6
 
  * @since 1.6
 
  */
 
  */
abstract class fr_FRLocalise {    //// !!!! NOTE the use of fr_FR for the class !!!// do the same for your language prefix.
+
abstract class fr_FRLocalise {    //// !!!! NOTE the use of fr_FR for the class !!! // not the same as your language prefix.
 
/**
 
/**
 
* Returns the potential suffixes for a specific number of items
 
* Returns the potential suffixes for a specific number of items
Line 237: Line 234:
  
 
$glyph_array = array(
 
$glyph_array = array(
'a' => 'à,á,â,ã,ä,å,ā,ă,ą,ḁ,α,ά',
+
'a' => 'a,à,á,â,ã,ä,å,ā,ă,ą,ḁ,α,ά',
 
'ae' => 'æ',
 
'ae' => 'æ',
 
'b' => 'β,б',
 
'b' => 'β,б',
'c' => 'ç,ć,ĉ,ċ,č,ћ,ц',
+
'c' => 'c,ç,ć,ĉ,ċ,č,ћ,ц',
 
'ch' => 'ч',
 
'ch' => 'ч',
 
'd' => 'ď,đ,Ð,д,ђ,δ,ð',
 
'd' => 'ď,đ,Ð,д,ђ,δ,ð',
 
'dz' => 'џ',
 
'dz' => 'џ',
'e' => 'è,é,ê,ë,ē,ĕ,ė,ę,ě,э,ε,έ',
+
'e' => 'e,è,é,ê,ë,ē,ĕ,ė,ę,ě,э,ε,έ',
 
'f' => 'ƒ,ф',
 
'f' => 'ƒ,ф',
 
'g' => 'ğ,ĝ,ğ,ġ,ģ,г,γ',
 
'g' => 'ğ,ĝ,ğ,ġ,ģ,г,γ',
 
'h' => 'ĥ,ħ,Ħ,х',
 
'h' => 'ĥ,ħ,Ħ,х',
'i' => 'ì,í,î,ï,ı,ĩ,ī,ĭ,į,и,й,ъ,ы,ь,η,ή',
+
'i' => 'i,ì,í,î,ï,ı,ĩ,ī,ĭ,į,и,й,ъ,ы,ь,η,ή',
 
'ij' => 'ij',
 
'ij' => 'ij',
'j' => 'ĵ',
+
'j' => 'ĵ,j',
 
'ja' => 'я',
 
'ja' => 'я',
 
'ju' => 'яю',
 
'ju' => 'яю',
Line 256: Line 253:
 
'l' => 'ĺ,ļ,ľ,ŀ,ł,л,λ',
 
'l' => 'ĺ,ļ,ľ,ŀ,ł,л,λ',
 
'lj' => 'љ',
 
'lj' => 'љ',
'm' => 'μ',
+
'm' => 'μ',
 
'n' => 'ñ,ņ,ň,ʼn,ŋ,н,ν',
 
'n' => 'ñ,ņ,ň,ʼn,ŋ,н,ν',
 
'nj' => 'њ',
 
'nj' => 'њ',
Line 269: Line 266:
 
'sh' => 'ш',
 
'sh' => 'ш',
 
'shch' => 'щ',
 
'shch' => 'щ',
't' => 'ţ,ť,ŧ,τ',
+
't' => 'ţ,ť,ŧ,τ',
 
'th' => 'θ',
 
'th' => 'θ',
'u' => 'ù,ú,û,ü,ũ,ū,ŭ,ů,ű,ų,у',
+
'u' => 'u,ù,ú,û,ü,ũ,ū,ŭ,ů,ű,ų,у',
 
'v' => 'в',
 
'v' => 'в',
 
'w' => 'ŵ',
 
'w' => 'ŵ',
Line 325: Line 322:
 
* @since 1.6
 
* @since 1.6
 
*/
 
*/
public function calendar($format, $local = false)
+
public function calendar($format, $local = false, $translate = true)
 
{
 
{
 
// Do string replacements for date format options that can be translated.
 
// Do string replacements for date format options that can be translated.
Line 485: Line 482:
  
 
One has also to add the right calendar.js files in the package.
 
One has also to add the right calendar.js files in the package.
 +
 +
===The Site-only pack===
 +
'''
 +
Concerning those of you providing "site only" packs:'''
 +
 +
The packages have to be made on the model of http://joomlacode.org/gf/download/frsrelease/16677/72539/gd-GB_joomla_lang_full_2.5.1.zip
 +
(Download and decompress locally to see the exact structure of the pack (install.xml, files included, etc.)
 +
 +
I.e. IT IS NECESSARY TO PROVIDE A LIMITED ADMIN PACK and to post a unique package including both
 +
 +
Why? ==> because some plugin ini files are used in front-end! Here is a typical xml for admin in this case. Example for 2.5:
 +
 +
<source lang="xml">
 +
<?xml version="1.0" encoding="utf-8"?>
 +
<extension version="2.5" client="administrator" type="language" method="upgrade">
 +
<name>Scottish Gaelic (GB)</name>
 +
    <tag>gd-GB</tag>
 +
    <version>2.5.6.1</version>
 +
    <creationDate>2012-02-13</creationDate>
 +
    <author>akerbeltz</author>
 +
    <authorEmail>fios@akerbeltz.org</authorEmail>
 +
    <authorUrl>www.akerbeltz.org</authorUrl>
 +
    <copyright>Copyright (C) 2005 - 2012 Joomla Open Source Matters. Gach còir glèidhte.</copyright>
 +
    <license>GNU General Public License version 2 or later; see LICENSE.txt</license>
 +
    <description>Scottish Gaelic language pack for Joomla! 2.5</description>
 +
<files>
 +
        <filename>index.html</filename>
 +
<filename>gd-GB.plg_captcha_recaptcha.ini</filename>
 +
<filename>gd-GB.plg_finder_categories.ini</filename>
 +
<filename>gd-GB.plg_finder_contacts.ini</filename>
 +
<filename>gd-GB.plg_finder_content.ini</filename>
 +
<filename>gd-GB.plg_finder_newsfeeds.ini</filename>
 +
<filename>gd-GB.plg_finder_weblinks.ini</filename>
 +
        <filename>gd-GB.plg_content_pagebreak.ini</filename>
 +
        <filename>gd-GB.plg_content_vote.ini</filename>
 +
        <filename>gd-GB.plg_editors-xtd_article.ini</filename>
 +
        <filename>gd-GB.plg_editors-xtd_image.ini</filename>
 +
        <filename>gd-GB.plg_editors-xtd_pagebreak.ini</filename>
 +
        <filename>gd-GB.plg_editors-xtd_readmore.ini</filename>
 +
        <filename>gd-GB.plg_search_categories.ini</filename>
 +
        <filename>gd-GB.plg_search_contacts.ini</filename>
 +
        <filename>gd-GB.plg_search_content.ini</filename>
 +
        <filename>gd-GB.plg_search_newsfeeds.ini</filename>
 +
        <filename>gd-GB.plg_search_weblinks.ini</filename>
 +
        <filename>gd-GB.plg_user_profile.ini</filename>
 +
        <filename file="meta">install.xml</filename>
 +
        <filename file="meta">gd-GB.xml</filename>
 +
</files>
 +
</extension>
 +
</source>
 
[[Category:Joomla! 1.6]]
 
[[Category:Joomla! 1.6]]
 +
[[Category:Joomla! 1.7]]
 +
[[Category:Joomla! 2.5]]
 +
[[Category:Joomla! 3.0]]
 
[[Category:Tutorials]]
 
[[Category:Tutorials]]
 
[[Category:Language Development]]
 
[[Category:Language Development]]

Revision as of 06:26, 27 February 2013

This page has been archived. This page contains information for an unsupported Joomla! version or is no longer relevant. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

How to create your CORE language packs[edit]

For 3rd party extensions self-contained ini files installation, see http://docs.joomla.org/Making_non-core_language_packs_in_2.5

The localise component may help you create and update the ini files: http://extensions.joomla.org/extensions/languages/language-edition/17755

fr-FR is taken as an example of language prefix.

  1. In the case of a FULL pack, the package is composed of 3 files, then zipped.
    • pkg_fr-FR.xml
    • site_fr-FR.zip
    • admin_fr-FR.zip
  1. Naming of the pack
    • fr-FR_joomla_lang_full_2.5.6v1.zip
  2. IMPORTANT: Since some administrator ini files are necessary in front-end and some changes were brought in the loading of the plugin ini files, it is always necessary to include some admin part in the final pack, even for a 'site-only' pack. See below http://docs.joomla.org/Making_a_Language_Pack_for_Joomla_1.6#The_Site-only_pack

Also, each pack should include a fr-FR.lib_joomla.ini and a fr-FR.localise.php to cope for deletion of site or admin pack by the user.

A pkg_fr-FR.xml file[edit]

<?xml version="1.0" encoding="UTF-8" ?>
<extension type="package" version="2.5">  <!-- replace by 3.0 for 3.0 packs -->
<name>French Language Pack</name>
<packagename>fr-FR</packagename> <!-- the packagename has to be the same as the name of pkg_whatever.xml -->
<version>2.5.6.x</version> <!-- change the version # when updating, will display in manager -->
<creationDate></creationDate> <!-- will display in manager -->
<author></author> <!-- will display in manager -->
<authorEmail></authorEmail> <!-- will display in manager -->
<authorUrl></authorUrl> <!-- will display in manager -->
<description>2.5.6.1 Joomla French Language Package</description>  <!-- replace by 3.0.x.x in 3.0 packs -->
<files>
	<file type="language" client="site" id="fr-FR">site_fr-FR.zip</file>
	<file type="language" client="administrator" id="fr-FR">admin_fr-FR.zip</file>
</files>
	 <updateservers>
		<server type="collection" priority="1" name="Accredited Joomla! Translations">http://update.joomla.org/language/translationlist.xml</server>
                <!-- replace url by http://update.joomla.org/language/translationlist_3.xml for 3.x packs -->
	</updateservers>
</extension>

One zip per client (i.e. site and admin)[edit]

  • site_fr-FR.zip
  • admin_fr-FR.zip

Content of the client's zip (example below is for admin)

an install.xml[edit]

<?xml version="1.0" encoding="utf-8" ?>
<extension version="2.5" client="administrator" type="language" method="upgrade"> // change to client="site" if site pack <install is deprecated. Use <extension as it will be compatible with the 3.x series
    <name>French (Fr)</name>
    <tag>fr-FR</tag>
    <version>2.5.6.1</version>
    <creationDate>2010-08-01</creationDate>
    <author>French translation team : Joomla!fr</author>
    <authorEmail>traduction@joomla.fr</authorEmail>
    <authorUrl>www.joomla.fr</authorUrl>
    <copyright>Copyright (C) 2005 - 2010 Joomla.fr et Open Source Matters. Tous droits réservés</copyright>
    <license>GNU General Public License version 2 or later; see LICENSE.txt</license>
    <description>French language pack for Joomla! 1.7</description>
    <files>
		<filename>index.html</filename>
                <filename>fr-FR.com_admin.ini</filename>
                <filename>fr-FR.com_admin.sys.ini</filename>
		<filename> .....ini</filename>
		[...]
		
                <filename>fr-FR.lib_joomla.ini</filename> <!-- Add in both admin and site At least in site if "site only pack", see below -->
		<filename>fr-FR.ini</filename>
		<filename>fr-FR.css</filename> <!-- NEW IN 1.7: this file can be added in the ADMINISTRATOR pack if one wants to change the fonts used to display the back-end interface.-->
		<filename file="meta">fr-FR.xml</filename> <!-- Note the file="meta" tag, telling it's the basic xml holding info about the pack. -->
                <filename file="meta">install.xml</filename> <!-- Mandatory! This file lets uninstall a language. Note file="meta" -->
		<filename>fr-FR.localise.php</filename> <!-- Add in both admin and site. At least in site if "site only pack", see below -->
      </files>
	<media destination="fr-FR"> <!-- If one needs to add a specific calendar -->
	    <filename>index.html</filename>
		<filename>js/index.html</filename>
		<filename>js/calendar-setup.js</filename>
		<filename>js/calendar.js</filename>
	</media>
</extension>

All the ini files[edit]

Beware of new formatting!

Double quotes in the value should be written as "_QQ_" or as &quot;

NEVER use an escaped quote \" as these will break in php 5.2.x

the fr-FR.xml[edit]

<?xml version="1.0" encoding="utf-8"?>
<metafile version="2.5" client="administrator" >
	<tag>fr-FR</tag>
	<name>French (FR)</name>
	<description>French administrator language for Joomla 1.6</description>
	<version>2.5.6.1</version>
	<creationDate>2010-08-01</creationDate>
        <author>French translation team : Joomla!fr</author>
        <authorEmail>traduction@joomla.fr</authorEmail>
        <authorUrl>www.joomla.fr</authorUrl>
        <copyright>Copyright (C) 2005 - 2011 Open Source Matters &amp;  Joomla.fr. All rights reserved.</copyright>
        <license>GNU General Public License version 2 or later; see LICENSE.txt</license>
	<metadata>
		<name>French (FR)</name>
		<tag>fr-FR</tag>
		<rtl>0</rtl>
                <locale>fr_FR.utf8, fr_FR.UTF-8, fr_FR.UTF-8@euro, French_Standard,french, fr_FR, fre_FR, fr</locale> <!-- the locale is used to sort translated lists when present on the server. -->
                <firstDay>1</firstDay> <!-- used for the Calendar icon to specify what is the first day of the week in that language. 0 is Sunday, 1 is Monday, etc. -->
	</metadata>
	<params />
</metafile>

the fr-FR.localise.php[edit]

(This file should be present at least in site zip)

Explanation of this file:

It replaces the fr-FR.ignore.php and it can be customized depending on languages.

  • Ignore search words.
  • Define upper and lower limit of search words length.
  • Define number of characters to display for the result of the search.
  • Define specific plural functionality for some languages where the value of the string can change depending on the count (Russian for example).
  • Define custom transliteration (i.e. when NOT using the Unicode URLS parameter in Global Configuration) to ensure proper change of some alphabets to ascii for the alias used when SEF is on. (The transliteration which is now default in 1.7 should take care of all latin-based languages.)
  • Define a custom calendar by adding a function as well as some js files

ALWAYS SAVE THIS FILE AS UTF8 NO BOM if it contains non-ascii glyphs (accented letters, etc.)


Example of a basic fr-FR.localise.php (where custom transliteration is NOT implemented)

<?php
/**
 * @version		$Id: fr-FR.localise.php 15628 2010-03-27 05:20:29Z infograf768 $
 * @copyright	Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
 * @license		GNU General Public License version 2 or later; see LICENSE.txt
 */

/**
 * fr-FR localise class
 *
 * @package		Joomla.Site
 * @since		1.6
 */
abstract class fr_FRLocalise {    //// !!!! NOTE the use of fr_FR for the class !!!  // not the same as your language prefix.
	/**
	 * Returns the potential suffixes for a specific number of items
	 *
	 * @param	int $count  The number of items.
	 * @return	array  An array of potential suffixes.
	 * @since	1.6
	 */
	public static function getPluralSuffixes($count) {
		if ($count == 0) {
			$return =  array('0');
		}
		elseif($count == 1) {
			$return =  array('1');
		}
		else {
			$return = array('MORE');  // Beware, this will be added to a language KEY. It should be in ascii and Uppercase.
		}
		return $return;
	}
	/**
	 * Returns the ignored search words
	 *
	 * @return	array  An array of ignored search words.
	 * @since	1.6
	 */
	public static function getIgnoredSearchWords() {
		$search_ignore = array();
		$search_ignore[] = "et";
		$search_ignore[] = "si";
		$search_ignore[] = "ou";
		return $search_ignore;
	}
	/**
	 * Returns the lower length limit of search words
	 *
	 * @return	integer  The lower length limit of search words.
	 * @since	1.6
	 */
	public static function getLowerLimitSearchWord() {
		return 3;
	}
	/**
	 * Returns the upper length limit of search words
	 *
	 * @return	integer  The upper length limit of search words.
	 * @since	1.6
	 */
	public static function getUpperLimitSearchWord() {
		return 20;
	}
	/**
	 * Returns the number of chars to display when searching
	 *
	 * @return	integer  The number of chars to display when searching.
	 * @since	1.6
	 */
	public static function getSearchDisplayedCharactersNumber() {
		return 200;
	}
}

Example of the function to add when custom transliteration is desired[edit]

/**
	 * This method processes a string and replaces all accented UTF-8 characters by unaccented
	 * ASCII-7 "equivalents"
	 *
	 * @param	string	$string	The string to transliterate
	 * @return	string	The transliteration of the string
	 * @since	1.6
	 */
	public static function transliterate($string)
	{
		$str = JString::strtolower($string);

		//Specific language transliteration.
		//This one is for latin 1, latin supplement , extended A, Cyrillic, Greek

		$glyph_array = array(
		'a'		=>	'a,à,á,â,ã,ä,å,ā,ă,ą,ḁ,α,ά',
		'ae'	=>	'æ',
		'b'		=>	'β,б',
		'c'		=>	'c,ç,ć,ĉ,ċ,č,ћ,ц',
		'ch'	=>	'ч',
		'd'		=>	'ď,đ,Ð,д,ђ,δ,ð',
		'dz'	=>	'џ',
		'e'		=>	'e,è,é,ê,ë,ē,ĕ,ė,ę,ě,э,ε,έ',
		'f'		=>	'ƒ,ф',
		'g'		=>	'ğ,ĝ,ğ,ġ,ģ,г,γ',
		'h'		=>	'ĥ,ħ,Ħ,х',
		'i'		=>	'i,ì,í,î,ï,ı,ĩ,ī,ĭ,į,и,й,ъ,ы,ь,η,ή',
		'ij'	=>	'ij',
		'j'		=>	'ĵ,j',
		'ja'	=>	'я',
		'ju'	=>	'яю',
		'k'		=>	'ķ,ĸ,κ',
		'l'		=>	'ĺ,ļ,ľ,ŀ,ł,л,λ',
		'lj'	=>	'љ',
		'm'		=>	'μ,м',
		'n'		=>	'ñ,ņ,ň,ʼn,ŋ,н,ν',
		'nj'	=>	'њ',
		'o'		=>	'ò,ó,ô,õ,ø,ō,ŏ,ő,ο,ό,ω,ώ',
		'oe'	=>	'œ,ö',
		'p'		=>	'п,π',
		'ph'	=>	'φ',
		'ps'	=>	'ψ',
		'r'		=>	'ŕ,ŗ,ř,р,ρ,σ,ς',
		's'		=>	'ş,ś,ŝ,ş,š,с',
		'ss'	=>	'ß,ſ',
		'sh'	=>	'ш',
		'shch'	=>	'щ',
		't'		=>	'ţ,ť,ŧ,τ,т',
		'th'	=>	'θ',
		'u'		=>	'u,ù,ú,û,ü,ũ,ū,ŭ,ů,ű,ų,у',
		'v'		=>	'в',
		'w'		=>	'ŵ',
		'x'		=>	'χ,ξ',
		'y'		=>	'ý,þ,ÿ,ŷ',
		'z'		=>	'ź,ż,ž,з,ж,ζ'
		);

		foreach( $glyph_array as $letter => $glyphs ) {
			$glyphs = explode( ',', $glyphs );
			$str = str_replace( $glyphs, $letter, $str );
		}

		return $str;
	}


Here is an example of a function to add in the localise.php file in order to implement a custom calendar for fa-IR (Persian language)

/**
 * fa-IR Date class
 *
 * @package		Joomla.Site
 * @since		1.6
 */
jimport('joomla.utilities.date');
class fa_IRDate extends JDate {
	const DAY_NUMBER	= "\x027\x03";
	const DAY_NUMBER2	= "\x030\x03";
	const DAY_YEAR		= "\x032\x03";
	const MONTH_ABBR	= "\x033\x03";
	const MONTH_NAME	= "\x034\x03";
	const MONTH_NUMBER	= "\x035\x03";
	const MONTH_NUMBER2	= "\x036\x03";
	const MONTH_LENGTH	= "\x037\x03";
	const YEAR_ABBR		= "\x040\x03";
	const YEAR_NAME		= "\x041\x03";
	const AM_LOWER		= "\x042\x03";
	const AM_UPPER		= "\x043\x03";
	const PERSIAN_EPOCH	= 1948320.5;

	protected static $month_names	= array("فروردين","ارديبهشت","خرداد","تیر","مرداد","شهریور","مهر","آبان","آذر","دی","بهمن","اسفند");


	/**
	 * Gets the date as a formatted string.
	 *
	 * @param	string	The date format specification string (see {@link PHP_MANUAL#date})
	 * @param	boolean	True to return the date string in the local time zone, false to return it in GMT.
	 * @return	string	The date string in the french republican calendar (see @link{http://en.wikipedia.org/wiki/French_Republican_Calendar}).
	 * @since	1.6
	 */
	public function calendar($format, $local = false, $translate = true)
	{
		// Do string replacements for date format options that can be translated.
		$format = preg_replace('/(^|[^\\\])d/', "\\1".self::DAY_NUMBER2, $format);
		$format = preg_replace('/(^|[^\\\])j/', "\\1".self::DAY_NUMBER, $format);
		$format = preg_replace('/(^|[^\\\])z/', "\\1".self::DAY_YEAR, $format);
		$format = preg_replace('/(^|[^\\\])M/', "\\1".self::MONTH_ABBR, $format);
		$format = preg_replace('/(^|[^\\\])F/', "\\1".self::MONTH_NAME, $format);
		$format = preg_replace('/(^|[^\\\])n/', "\\1".self::MONTH_NUMBER, $format);
		$format = preg_replace('/(^|[^\\\])m/', "\\1".self::MONTH_NUMBER2, $format);
		$format = preg_replace('/(^|[^\\\])t/', "\\1".self::MONTH_LENGTH, $format);
		$format = preg_replace('/(^|[^\\\])y/', "\\1".self::YEAR_ABBR, $format);
		$format = preg_replace('/(^|[^\\\])Y/', "\\1".self::YEAR_NAME, $format);
		$format = preg_replace('/(^|[^\\\])a/', "\\1".self::AM_LOWER, $format);
		$format = preg_replace('/(^|[^\\\])A/', "\\1".self::AM_UPPER, $format);

		// Format the date.
		$return = parent::calendar($format, $local);

		$jd = gregoriantojd($this->month, $this->day, $this->year);
		$jalaliDate = self::jd_to_persian($jd);
		$m = $jalaliDate['mon'];
		$d = $jalaliDate['day'];
		$y = $jalaliDate['year'];

		// Manually modify the strings in the formated time.
		if (strpos($return, self::DAY_NUMBER) !== false) {
			$return = str_replace(self::DAY_NUMBER, $d , $return);
		}
		if (strpos($return, self::DAY_NUMBER2) !== false) {
			$return = str_replace(self::DAY_NUMBER2, sprintf("%02d",$d), $return);
		}
		if (strpos($return, self::DAY_YEAR) !== false) {
			$return = str_replace(self::DAY_YEAR, $jd - self::persian_to_jd(1,1,$y)+1, $return);
		}
		if (strpos($return, self::MONTH_ABBR) !== false) {
			$return = str_replace(self::MONTH_ABBR, self::$month_names[$m-1] , $return);
		}
		if (strpos($return, self::MONTH_NAME) !== false) {
			$return = str_replace(self::MONTH_NAME, self::$month_names[$m-1] , $return);
		}
		if (strpos($return, self::MONTH_NUMBER) !== false) {
			$return = str_replace(self::MONTH_NUMBER, $m , $return);
		}
		if (strpos($return, self::MONTH_NUMBER2) !== false) {
			$return = str_replace(self::MONTH_NUMBER2, sprintf("%02d", $m) , $return);
		}
		if (strpos($return, self::MONTH_LENGTH) !== false) {
			$return = str_replace(self::MONTH_LENGTH, $m < 7 ? 31 : $m < 12 ? 30 : self::leap_persian($y) ? 30 : 29 , $return);
		}
		if (strpos($return, self::YEAR_ABBR) !== false) {
			$return = str_replace(self::YEAR_ABBR, sprintf("%02d",$y % 100), $return);
		}
		if (strpos($return, self::YEAR_NAME) !== false) {
			$return = str_replace(self::YEAR_NAME, $y, $return);
		}
		if (strpos($return, self::AM_LOWER) !== false) {
			$return = str_replace(self::AM_LOWER, $this->format('a',$local)=='pm' ? 'ب ظ' : 'ق ظ', $return);
		}
		if (strpos($return, self::AM_UPPER) !== false) {
			$return = str_replace(self::AM_UPPER, $this->format('a',$local)=='pm' ? 'ب ظ' : 'ق ظ', $return);
		}

		return $return;
	}
	public static function jd_to_persian($jd)

	{

		//var $year, $month, $day, $depoch, $cycle, $cyear, $ycycle,

		//    $aux1, $aux2, $yday;



		$jd = floor($jd) + 0.5;



		$depoch = $jd - self::persian_to_jd(1, 1, 475);

		$cycle = floor($depoch / 1029983);

		$cyear = $depoch % 1029983;

		if ($cyear == 1029982) {

		    $ycycle = 2820;

		} else {

		    $aux1 = floor($cyear / 366);

		    $aux2 = $cyear % 366;

		    $ycycle = floor(((2134 * $aux1) + (2816 * $aux2) + 2815) / 1028522) +

		                $aux1 + 1;

		}

		$year = $ycycle + (2820 * $cycle) + 474;

		if ($year <= 0) {

		    $year--;

		}

		$yday = ($jd - self::persian_to_jd(1, 1, $year)) + 1;

		$month = ($yday <= 186) ? ceil($yday / 31) : ceil(($yday - 6) / 30);

		$day = ($jd - self::persian_to_jd($month, 1, $year)) + 1;

		return array('year'=>$year, 'mon'=>$month,'day'=> $day);

	}
	public static function persian_to_jd($month, $day, $year)

	{

		//var $epbase, $epyear;

		$epbase = $year - (($year >= 0) ? 474 : 473);

		$epyear = 474 + $epbase % 2820;



		return $day +

		        (($month <= 7) ?

		            (($month - 1) * 31) :

		            ((($month - 1) * 30) + 6)

		        ) +

		        floor((($epyear * 682) - 110) / 2816) +

		        ($epyear - 1) * 365 +

		        floor($epbase / 2820) * 1029983 +

		        self::PERSIAN_EPOCH;

	}

	public static function leap_persian($year) {

	    return (((((($year - (($year > 0) ? 474 : 473)) % 2820) + 474) + 38) * 682) % 2816) < 682;

	}

}

One has also to add the right calendar.js files in the package.

The Site-only pack[edit]

Concerning those of you providing "site only" packs:

The packages have to be made on the model of http://joomlacode.org/gf/download/frsrelease/16677/72539/gd-GB_joomla_lang_full_2.5.1.zip (Download and decompress locally to see the exact structure of the pack (install.xml, files included, etc.)

I.e. IT IS NECESSARY TO PROVIDE A LIMITED ADMIN PACK and to post a unique package including both

Why? ==> because some plugin ini files are used in front-end! Here is a typical xml for admin in this case. Example for 2.5:

<?xml version="1.0" encoding="utf-8"?>
<extension version="2.5" client="administrator" type="language" method="upgrade">
	<name>Scottish Gaelic (GB)</name>
    <tag>gd-GB</tag>
    <version>2.5.6.1</version>
    <creationDate>2012-02-13</creationDate>
    <author>akerbeltz</author>
    <authorEmail>fios@akerbeltz.org</authorEmail>
    <authorUrl>www.akerbeltz.org</authorUrl>
    <copyright>Copyright (C) 2005 - 2012 Joomla Open Source Matters. Gach còir glèidhte.</copyright>
    <license>GNU General Public License version 2 or later; see LICENSE.txt</license>
    <description>Scottish Gaelic language pack for Joomla! 2.5</description>
	<files>
        <filename>index.html</filename>
		<filename>gd-GB.plg_captcha_recaptcha.ini</filename>
		<filename>gd-GB.plg_finder_categories.ini</filename>
		<filename>gd-GB.plg_finder_contacts.ini</filename>
		<filename>gd-GB.plg_finder_content.ini</filename>
		<filename>gd-GB.plg_finder_newsfeeds.ini</filename>
		<filename>gd-GB.plg_finder_weblinks.ini</filename>
        <filename>gd-GB.plg_content_pagebreak.ini</filename>
        <filename>gd-GB.plg_content_vote.ini</filename>
        <filename>gd-GB.plg_editors-xtd_article.ini</filename>
        <filename>gd-GB.plg_editors-xtd_image.ini</filename>
        <filename>gd-GB.plg_editors-xtd_pagebreak.ini</filename>
        <filename>gd-GB.plg_editors-xtd_readmore.ini</filename>
        <filename>gd-GB.plg_search_categories.ini</filename>
        <filename>gd-GB.plg_search_contacts.ini</filename>
        <filename>gd-GB.plg_search_content.ini</filename>
        <filename>gd-GB.plg_search_newsfeeds.ini</filename>
        <filename>gd-GB.plg_search_weblinks.ini</filename>
        <filename>gd-GB.plg_user_profile.ini</filename>
        <filename file="meta">install.xml</filename>
        <filename file="meta">gd-GB.xml</filename>
	</files>
</extension>