In this FAQ module I have seen that there are several language files.
There are two, English and German.
Do I have to make several ones and are there rules on how I have to name them?
The rule is countrycodes in the folder name ... languages/en, languages/de languages/fr etc. Only one is required (and I'm puzzled that you don't have one).
I have seen that sometimes arrays are given as translations. For what is this? I didn't get the concept behind it.
The array will show in the backend as a label beside the field and a "tooltip" underneath the field.
Do I have to put everything into $GLOBALS['TL_LANG']['MSC'] or can I put it into $GLOBALS['TL_LANG']['foobar'] as well? Are there some rules I need to follow?
If in your DCA folder you have a DCA file called tl_foobar.php and a field in it is called min_nights, it might look like this.
Code:
'min_nights' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_foobar']['min_nights'],
'inputType' => 'text',
'eval' => array('mandatory'=>false, 'maxlength'=>2, 'rgxp'=>'digit', 'tl_class'=>'w50'),
'filter' => true,
'default' => '1'
),
In which case you would have a file BOTH in languages/en and languages/fr also called tl_foobar.php
and that would look like
Code:
$GLOBALS['TL_LANG']['tl_foobar']['min_nights'] = array('Minimum Booking', 'Will not show if 0 or 1');
in the en/ one and
Code:
$GLOBALS['TL_LANG']['tl_foobar']['min_nights'] = array('Le Boooking du Minumum', 'Nes pas l'view if 0 or 1');
in the fr/ one
$GLOBALS['TL_LANG']['MSC']['goBack'];
is an already defined label for the goback button that you can use, or override if you want to define your own label
Note in the DCA/tl_foobar.php the label is defined
Code:
'label' => &$GLOBALS['TL_LANG']['tl_foobar']['min_nights']
If you wanted this label to say "Go Back" you could define it as
Code:
'label' => &$GLOBALS['TL_LANG']['MSC']['goBack']
How do I tell contao which file with the translation will be taken? I guess this is given somehow and I need to follow some rules on how to name the file.
Not sure... If the users language is fr/ they'll see the french one, but if its not maybe it uses the defined fallback language.
Just guessing
Bookmarks