- else
- $l = $cfg['lang'];
-
- /* Is the langage in the list ? */
- $found = false;
- foreach ($languages_list as $key => $v)
- if (strcmp ($l, $key) == 0)
- $found = true;
-
- /* Don't translate english. */
- if (!($found && strcmp ($l, "en")))
- return $text;
-
- /* Open translation file. */
- $trans_j = file_get_contents (JIRAFEAU_ROOT . "lib/locales/$l.json");
- if ($trans_j === FALSE)
- return $text;
-
- /* Decode JSON. */
- $trans = json_decode ($trans_j, true);
- if ($trans === NULL)
- return $text;
-
- /* Try to find translation. */
- if (!array_key_exists ($text, $trans))
- return $text;