2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * Common config manipulation functions
10 * Returns sanitized language string, taking into account our special codes
11 * for formatting. Takes variable number of arguments.
12 * Based on PMA_sanitize from sanitize.lib.php.
14 * @param string $lang_key key in $GLOBALS WITHOUT 'strSetup' prefix
15 * @param mixed $args,... arguments for sprintf
18 function PMA_lang($lang_key, $args = null)
20 $message = isset($GLOBALS["strConfig$lang_key"]) ?
$GLOBALS["strConfig$lang_key"] : $lang_key;
22 $message = PMA_sanitize($message);
24 if (func_num_args() == 1) {
27 $args = func_get_args();
29 return vsprintf($message, $args);
34 * Returns translated field name/description or comment
36 * @param string $canonical_path
37 * @param string $type 'name', 'desc' or 'cmt'
38 * @param mixed $default
41 function PMA_lang_name($canonical_path, $type = 'name', $default = 'key')
43 $lang_key = str_replace(
44 array('Servers/1/', '/'),
45 array('Servers/', '_'),
46 $canonical_path) . '_' . $type;
47 return isset($GLOBALS["strConfig$lang_key"])
48 ?
($type == 'desc' ?
PMA_lang($lang_key) : $GLOBALS["strConfig$lang_key"])
49 : ($default == 'key' ?
$lang_key : $default);