collapse

* User Info

 
 
Welcome, Guest. Please login or register.

* Recent Posts

Forum closed by whazzup
[September 25, 2021, 02:56:14 PM]


How do i replace an image file with another image file by Malu
[December 16, 2020, 03:17:02 PM]


Can't get RSG "Show My Galleries" to work by Dampfnudel
[February 25, 2019, 11:01:55 AM]


Change the order of uploaded images in the gallery by whazzup
[February 19, 2019, 10:37:29 PM]


Upload timeout for large galleries (500 images each) by whazzup
[February 11, 2019, 10:07:25 PM]


Greetings from Ronald Smit by whazzup
[January 06, 2019, 03:39:22 PM]


Pluign and module by whazzup
[June 08, 2018, 11:57:13 PM]


Version 4.4.1 released by whazzup
[May 31, 2018, 04:31:16 PM]

Author Topic: How to create a language translation file  (Read 6423 times)

Offline mirjam

  • Retired from Dev Team
  • Hero Member
  • ****
  • Posts: 670
How to create a language translation file
« on: October 25, 2010, 03:40:10 PM »
RSgallery2 supports an ever increasing number of languages. These language files are, for the most part, not created by the core devs team, but by users like you.

How it works
Somewhere in the component text needs to be displayed. A call to a language key is then inserted into the sourcecode:
Code: [Select]
<?php echo JText::_('COM_RSGALLERY2_TEXT_KEY'); ?>To attach a certain text string to this key, definitions are made in a language file, the INI files in the packages /languages/ directory, like en-GB.com_rsgallery2.ini which is the english language file. This en-GB.com_rsgallery2.ini file is used for both frontend and backend translations and holds all keys. When installed you'll find this file at two locations: /JOOMLAROOT/administrator/language/en-GB/ and /JOOMLAROOT/language/en-GB/ (where you can replace en-GB with the language code for your language).

There is also an en-GB.com_rsgallery2.sys.ini file for keys that are used during installation or for the menu items in the Backend > Component menu list. In the package it is found in /admin/language/en-GB/ and when installed it is found at /JOOMLAROOT/administrator/language/en-GB/.

Automatically, Joomla! selects the language file corresponding to the language of the website as it is defined in the configuration. If the language in question is not present for RSgallery2, it defaults to English (en-GB).

How to translate
First, take a look at the language forum. There might already be a complete or partial language file that you can use. (Note: There are also 'prepared languages' available in the distributed RSG2 package: these were made from the old Joomla 1.0.x language files, but need to be thoroughly checked, and the filename needs to be updated to the Joomla 1.5.x format mentioned below.)

If there is no file, create a duplicate of en-GB.com_rsgallery2.ini. Download this file, rename it with this format: [language ISO code, e.g. en]-[country code, e.g. GB].com_rsgallery2.ini. For example, dutch has ISO code nl and country code NL, so the name is nl-NL.com_rsgallery2.ini.
If there is a file that is partly translated, you can do the same as in the previous case, but now use the allready translated definitions in the partly translated file to make the process a bit easier.

The file needs to be saved as UTF-8 without BOM (!), an editor with which you can do that is Notepad ++ (http://notepad-plus-plus.org/).

The format of the file is simple, blank lines and lines with a ";"  at the beginning are ignored (the latter are comment lines: a semicolon in v3.x in J!1.7.x and a "#" in v2.x on J!1.5.x). Each line then is a pair : key and its translation, e.g.
Code: [Select]
COM_RSGALLERY2_KEY=Translation
COM_RSGALLERY2_SAVE=Save
COM_RSGALLERY2_CANCEL=Cancel
The Key must be in capitals and must not be changed, the translation cannot include double-quote characters ("), to get a double quote you need the HTML special character _QQ_ (in v3.x, this used to be a &quot; in v2.x) instead. There is a help within Joomla Docs (http://docs.joomla.org/Creating_a_language_definition_file, Google can be your friend here).

After translating, check to see if the file works. Setting the level of error reporting to maximum in the Joomla! configuration (on the Server tab) is usefull, as most errors in language files show up as notices.

Missing strings will show up when you set "Debug System" and "Debug Language" both to "Yes" in the Global Configuration: it'll give you a list of missing strings and indicate missing strings with question marks.

Missing strings
Sometimes new translatable strings are added to RSGallery2. These strings will always be added to the en-GB.com_rsgallery2.ini and/or en-GB.com_rsgallery2.sys.ini files. The latest strings are added at the bottom of these files and a comment line is added so users can see after which version the new keys were added (e.g. v.3RC1 or 3.0.1 or the SVN number for Nightly Builds that are made available to test in between official releases). In your translated files, please keep their order and keep the comment lines so it's easy to check which new strings are already added and which strings are not.

Rules
To make the translations as good as possible, we do have a few rules.
Code: [Select]
     
;       en-GB (english-United Kingdom) languagefile for RSGallery
;       @version $Id$
;       @package RSGallery2
;       @copyright (C) 2003 - 2010 RSGallery2
;       @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
;       @author John Doe < your@email.com >
;       RSGallery is Free Software
(Note: in v2.x the comment signes are not ; but #)
    • License
      RSgallery2 is GNU/ GPL, this means that every part of the component needs to be GNU/ GPL in order to accomodate changes and additions. This also goes for the translation files. Language files with other licenses then GNU/ GPL will not be added to the component.
    • Credits
      RSgallery2 has a 'credits' section in the Backend. When you post your (updated) language file, please note what name we can use for the credits and your website name if you want it there.
« Last Edit: January 30, 2012, 01:01:38 PM by mirjam »
With a little boy in the house I don't spend as much time on RSG2 anymore.

I still like RSG2, if you do too, please think about how you can invest some of your time in RSG2... the one remaining coding volunteer (Whazzup) can use your help!