Changeset 5156 for trunk/include/functions.inc.php
- Timestamp:
- Mar 17, 2010, 10:22:51 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/functions.inc.php
r5153 r5156 31 31 include_once( PHPWG_ROOT_PATH .'include/functions_url.inc.php' ); 32 32 include_once( PHPWG_ROOT_PATH .'include/functions_plugins.inc.php' ); 33 include_once( PHPWG_ROOT_PATH .'include/php-gettext/gettext.inc.php' );34 33 35 34 //----------------------------------------------------------- generic functions … … 873 872 function l10n($key, $textdomain='messages') 874 873 { 875 global $user; 876 877 if (empty($user['language'])) 878 { 879 $locale = $GLOBALS['language']; 880 } 881 else 882 { 883 $locale = $user['language']; 884 } 885 886 T_setlocale(LC_ALL, $locale.'.UTF-8'); 887 888 // Specify location of translation tables 889 T_bindtextdomain($textdomain, "./language"); 890 891 // Choose domain 892 T_textdomain($textdomain); 893 894 return T_gettext($key); 874 global $lang, $conf; 875 876 if ($conf['debug_l10n'] and !isset($lang[$key]) and !empty($key)) 877 { 878 trigger_error('[l10n] language key "'.$key.'" is not defined', E_USER_WARNING); 879 } 880 881 return isset($lang[$key]) ? $lang[$key] : $key; 895 882 } 896 883 … … 904 891 * @return string 905 892 */ 906 function l10n_dec($singular_fmt_key, $plural_fmt_key, 907 $decimal, $textdomain='messages') 908 { 909 global $user; 910 911 if (empty($user['language'])) 912 { 913 $locale = $GLOBALS['language']; 914 } 915 else 916 { 917 $locale = $user['language']; 918 } 919 920 T_setlocale(LC_ALL, $locale.'.UTF-8'); 921 922 // Specify location of translation tables 923 T_bindtextdomain($textdomain, "./language"); 924 925 // Choose domain 926 T_textdomain($textdomain); 927 928 return sprintf(T_ngettext($singular_fmt_key, 929 $plural_fmt_key, 930 $decimal), 931 $decimal 932 ); 893 function l10n_dec($singular_fmt_key, $plural_fmt_key, $decimal) 894 { 895 global $lang_info; 896 897 return 898 sprintf( 899 l10n(( 900 (($decimal > 1) or ($decimal == 0 and $lang_info['zero_plural'])) 901 ? $plural_fmt_key 902 : $singular_fmt_key 903 )), $decimal); 933 904 } 934 905
Note: See TracChangeset
for help on using the changeset viewer.