History: Contextual translations
Source of version: 7 (current)
Copy to clipboard
Available in Tiki 23 and after.
^Contextual translations are translations with added context in order to deal with situations when an english word has more than one translation depending on context.^
! Procedure
!!# Insert a new string or modify an existing string in the source or a template with context
Like this: -+tra("Edit_C(title)")+- or -+~np~{~/np~tr}Edit_C(title){/tr}+-.
!!# Then rebuild the language files
{CODE(caption="Rebuilding language files" theme="default")}php console.php translation:englishupdate --scm=git
php console.php translation:getstrings
php console.php c:c{CODE}
!!# See how it is reflected in language files
-+ lang/en/language.php +- will be changed but that's just so the english translation keeps the old text.
{CODE(colors="php" caption="lang/en/language.php")}
"edit_C(verb)" => "edit",
"edit_C(noun)" => "edit",
"D_C(abbrev-day)" => "D",
"M_C(abbrev-month)" => "M",
"Location_C(map)" => "Location",
"Rent_C(verb)" => "Rent",
{CODE}
You language file will have new entries you will want to translate. For instance, in French:
{CODE(colors="php" caption="lang/fr/language.php")}
"edit_C(verb)" => "modifier",
"edit_C(noun)" => "modification",
"D_C(abbrev-day)" => "J",
"M_C(abbrev-month)" => "M",
"Location_C(map)" => "Lieu",
"Rent_C(verb)" => "Location",
{CODE}
! More info
This was discussed here : [https://dev.tiki.org/Translations-Revamp]
Also see ((Strings Format Convention)).