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
19 function PMA_lang($lang_key, $args = null)
21 $message = isset($GLOBALS["strConfig$lang_key"])
22 ?
$GLOBALS["strConfig$lang_key"] : $lang_key;
24 $message = PMA_sanitize($message);
26 if (func_num_args() == 1) {
29 $args = func_get_args();
31 return vsprintf($message, $args);
36 * Returns translated field name/description or comment
38 * @param string $canonical_path
39 * @param string $type 'name', 'desc' or 'cmt'
40 * @param mixed $default
44 function PMA_lang_name($canonical_path, $type = 'name', $default = 'key')
46 $lang_key = str_replace(
47 array('Servers/1/', '/'),
48 array('Servers/', '_'),
51 return isset($GLOBALS["strConfig$lang_key"])
52 ?
($type == 'desc' ?
PMA_lang($lang_key) : $GLOBALS["strConfig$lang_key"])
53 : ($default == 'key' ?
$lang_key : $default);