Subversion Repositories LCARS

Rev

Rev 210 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 210 Rev 214
Line 37... Line 37...
37
    'key' => 'vu',
37
    'key' => 'vu',
38
    'name' => '<abbr title="Gen-lis">G-l</abbr> Vuhlkansu'
38
    'name' => '<abbr title="Gen-lis">G-l</abbr> Vuhlkansu'
39
  )
39
  )
40
);
40
);
41
41
42
-
 
43
/**
42
/**
44
 * Returns the short language key.
43
 * Returns the short language key.
45
 *
44
 *
46
 * Needed for safely mapping extra-terrestrial languages.
45
 * Needed for safely mapping extra-terrestrial languages.
47
 */
46
 */
48
function language_key_short ($key)
47
function language_key_short ($key)
49
{
48
{
50
  global $languages;
49
  global $languages;
51
  preg_match('/^[^-]{2,3}/', $key, $matches);
50
  preg_match('/^[^-]{2,3}/', $key, $matches);
52
  $language = $languages[$key];
51
  $language = $languages[$key];
53
  return isset($language['key']) ? $language['key'] : $matches[0];
52
  return (is_array($language) && isset($language['key'])
-
 
53
    ? $language['key']
-
 
54
    : $matches[0]);
54
}
55
}
55
56
56
/**
57
/**
57
 * Returns the language name.
58
 * Returns the language name.
58
 *
59
 *
Line 60... Line 61...
60
 */
61
 */
61
function language_name ($key)
62
function language_name ($key)
62
{
63
{
63
  global $languages;
64
  global $languages;
64
  $language = $languages[$key];
65
  $language = $languages[$key];
65
  return isset($language['name']) ? $language['name'] : $language;
66
  return (is_array($language) && isset($language['name'])
-
 
67
    ? $language['name']
-
 
68
    : $language);
66
}
69
}
67
70
68
require_once 'Zend/Loader/StandardAutoloader.php';
71
require_once 'Zend/Loader/StandardAutoloader.php';
69
$loader = new Zend\Loader\StandardAutoloader(array('autoregister_zf' => true));
72
$loader = new Zend\Loader\StandardAutoloader(array('autoregister_zf' => true));
70
$loader->register();
73
$loader->register();
Line 80... Line 83...
80
/**
83
/**
81
 * Returns the translation of the parameter, if any,
84
 * Returns the translation of the parameter, if any,
82
 * using Zend Framework 2.1 Translate
85
 * using Zend Framework 2.1 Translate
83
 *
86
 *
84
 * @param string $s
87
 * @param string $s
-
 
88
 *   String to be translated
-
 
89
 * @param string $lang = null
-
 
90
 *   Target language.  The default is the document language
-
 
91
 *   ($language).
85
 * @return string
92
 * @return string
86
 */
93
 */
87
function tr ($s, $lang = null)
94
function tr ($s, $lang = null)
88
{
95
{
89
  global $translator;
96
  global $translator;