Ignore:
Timestamp:
Jan 14, 2016, 10:25:47 PM (9 years ago)
Author:
chronos
Message:
  • Added: Support for translatable URLs. Now each language can have URL in its language.

This requires to all links inside web to use System->Link function which is responsible for translation.
All links need to be written in english so they can be translated to other language.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/Locale.php

    r841 r843  
    1818  }
    1919
    20   function Translate($Text)
    21   {
    22     if(array_key_exists($Text, $this->Data) and ($this->Data[$Text] != ''))
    23       return($this->Data[$Text]);
     20  function Translate($Text, $Group = '')
     21  {
     22    if(array_key_exists($Text, $this->Data[$Group]) and ($this->Data[$Group][$Text] != ''))
     23      return($this->Data[$Group][$Text]);
    2424      else return($Text);
     25  }
     26
     27  function TranslateReverse($Text, $Group = '')
     28  {
     29    $Key = array_search($Text, $this->Data[$Group]);
     30    if(($Key === FALSE) or ($this->Data[$Group][$Key] == '')) return($Text);
     31      else return($Key);
    2532  }
    2633}
     
    232239}
    233240
    234 // Short named global function
    235 function T($Text)
     241// Short named global translation function
     242function T($Text, $Group = '')
    236243{
    237244  global $GlobalLocaleManager;
    238245
    239   if(isset($GlobalLocaleManager)) return($GlobalLocaleManager->CurrentLocale->Texts->Translate($Text));
     246  if(isset($GlobalLocaleManager)) return($GlobalLocaleManager->CurrentLocale->Texts->Translate($Text, $Group));
    240247    else return($Text);
    241248}
Note: See TracChangeset for help on using the changeset viewer.