Subversion Repositories LCARS

Rev

Rev 211 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 211 Rev 213
Line 48... Line 48...
48
function language_key_short ($key)
48
function language_key_short ($key)
49
{
49
{
50
  global $languages;
50
  global $languages;
51
  preg_match('/^[^-]{2,3}/', $key, $matches);
51
  preg_match('/^[^-]{2,3}/', $key, $matches);
52
  $language = $languages[$key];
52
  $language = $languages[$key];
53
  return isset($language['key']) ? $language['key'] : $matches[0];
53
  return (is_array($language) && isset($language['key'])
-
 
54
    ? $language['key']
-
 
55
    : $matches[0]);
54
}
56
}
55
57
56
/**
58
/**
57
 * Returns the language name.
59
 * Returns the language name.
58
 *
60
 *
Line 60... Line 62...
60
 */
62
 */
61
function language_name ($key)
63
function language_name ($key)
62
{
64
{
63
  global $languages;
65
  global $languages;
64
  $language = $languages[$key];
66
  $language = $languages[$key];
65
  return isset($language['name']) ? $language['name'] : $language;
67
  return (is_array($language) && isset($language['name'])
-
 
68
    ? $language['name']
-
 
69
    : $language);
66
}
70
}
67
71
68
require_once 'Zend/Loader/StandardAutoloader.php';
72
require_once 'Zend/Loader/StandardAutoloader.php';
69
$loader = new Zend\Loader\StandardAutoloader(array('autoregister_zf' => true));
73
$loader = new Zend\Loader\StandardAutoloader(array('autoregister_zf' => true));
70
$loader->register();
74
$loader->register();
Line 80... Line 84...
80
/**
84
/**
81
 * Returns the translation of the parameter, if any,
85
 * Returns the translation of the parameter, if any,
82
 * using Zend Framework 2.1 Translate
86
 * using Zend Framework 2.1 Translate
83
 *
87
 *
84
 * @param string $s
88
 * @param string $s
-
 
89
 *   String to be translated
-
 
90
 * @param string $lang = null
-
 
91
 *   Target language.  The default is the document language
-
 
92
 *   ($language).
85
 * @return string
93
 * @return string
86
 */
94
 */
87
function tr ($s, $lang = null)
95
function tr ($s, $lang = null)
88
{
96
{
89
  global $translator;
97
  global $translator;