1 | <?php |
||
25 | class Language |
||
26 | { |
||
27 | /** |
||
28 | * Attempt a translation of a simple string |
||
29 | * |
||
30 | * @param string $string string to translate |
||
31 | * @param string $domain language domain |
||
32 | * |
||
33 | * @return string translated string |
||
34 | * |
||
35 | * @todo do something useful |
||
36 | */ |
||
37 | 1 | public static function translate($string, $domain = null) |
|
41 | |||
42 | /** |
||
43 | * load - load a language file |
||
44 | * |
||
45 | * @param string $name name of the language file |
||
46 | * @param string $domain domain or module supplying language file |
||
47 | * @param string $language language folder name |
||
48 | * |
||
49 | * @return bool true if loaded, otherwise false |
||
50 | */ |
||
51 | 2 | public static function load($name, $domain = '', $language = null) |
|
52 | { |
||
53 | 2 | if (empty($language)) { |
|
54 | 2 | if (!empty($GLOBALS['xoopsConfig']['language'])) { |
|
55 | $language = $GLOBALS['xoopsConfig']['language']; |
||
56 | } else { |
||
57 | 2 | $language = 'english'; |
|
58 | } |
||
59 | } |
||
60 | 2 | $path = \XoopsBaseConfig::get('root-path') . '/' . ((empty($domain) || 'global' === $domain) ? '' |
|
61 | 2 | : "modules/{$domain}/") . 'language'; |
|
62 | 2 | if (!$ret = static::loadFile("{$path}/{$language}/{$name}.php")) { |
|
63 | 1 | $ret = static::loadFile("{$path}/english/{$name}.php"); |
|
64 | } |
||
65 | |||
66 | 1 | return $ret; |
|
67 | } |
||
68 | |||
69 | /** |
||
70 | * Load a file |
||
71 | * |
||
72 | * @param string $filename filename to load |
||
73 | * |
||
74 | * @return bool true if file exists and was loaded |
||
75 | * |
||
76 | * @throws \InvalidArgumentException |
||
77 | */ |
||
78 | protected static function loadFile($filename) |
||
89 | } |
||
90 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.