Project

General

Profile

Writing translation » History » Version 6

Valérie Isaksen, 07/11/2011 05:27 PM

1 1 Max Milbers
h1. Writing translation
2
3 2 Jörg Kiekebusch
The translation is quite simple. We now use the normal language file system of joomla (http://docs.joomla.org/Creating_a_language_definition_file).
4 1 Max Milbers
5 2 Jörg Kiekebusch
Just look in the backend and frontend language folders of joomla. The main backend VirtueMart language file "en-GB.com_virtuemart.ini" is located in ...administrator/language/en-GB. Open and translate this file with an Editor (i.e. Notepad++) configured to store the file encoded as UTF-8 without BOM! The VirtueMart frontend language files are located in .../language/en-GB.
6 1 Max Milbers
7 2 Jörg Kiekebusch
Rename the file(s) to the shortcut of your language, like de-DE or nl-NL and so on.
8
9
Helpful tools for translating language files are:
10
11 6 Valérie Isaksen
com_missingt_VMversion_0.4.1.v2.zip, which can be downloaded frome here:
12 2 Jörg Kiekebusch
(http://dev.virtuemart.net/issues/294)
13 6 Valérie Isaksen
The missing_t is compatible Joomla 1.5 and Joomla 1.6. It creates languages files for Joomla compatible Joomla 1.6 and Joomla 1.7.
14 2 Jörg Kiekebusch
15
With this one you can translate directly from the frontend:
16
(http://www.allforjoomla.com/xplugins/plg-translatehelper)
17 1 Max Milbers
18 3 Max Milbers
19
h1. What you have to know and to consider
20
21
Be aware that we use for the standard views in the backend a generic system to generate the titles and messages. So you won't find this translation keys by searching for them and missing_t wont help you.
22
23
But the system is quite easy, when you know how it works. The system is build for the controllers, models, tables, and the title of a view. 
24
25 4 Jörg Kiekebusch
Lets take the Controller as an example. The default call for storing a message is 
26 3 Max Milbers
JText::sprintf('COM_VIRTUEMART_STRING_SAVED',$this->mainLangKey);
27
28
$this->mainLangKey is JText::_('COM_VIRTUEMART_CONTROLLER_'.strtoupper($this->_cname));
29
30
and $this->_cname is the name of the controller
31
32
So at the end we have something like JText::sprintf('COM_VIRTUEMART_STRING_SAVED','COM_VIRTUEMART_CONTROLLER_PRODUCT');
33
34
COM_VIRTUEMART_STRING_SAVED="%s successfully saved" and 
35
COM_VIRTUEMART_CONTROLLER_PRODUCT="Product(s)"
36
37
the %s means that sprintf places the first parameter, translated here "Product(s)" to %s, so we get "Product(s) successfully saved"
38
39
40
When you have questions, write to Valerie (http://dev.virtuemart.net/users/48).