KumbiaPHP beta2-dev
Framework PHP en español
|
00001 <?php 00026 bindtextdomain('default', APP_PATH . 'locale/'); 00027 textdomain('default'); 00028 00037 class I18n 00038 { 00048 public static function get($sentence) 00049 { 00053 $sentence = gettext($sentence); 00054 00058 if(func_num_args()>1) { 00059 $args = func_get_args(); 00063 unset($args[0]); 00064 $sentence = vsprintf($sentence, $args); 00065 } 00066 00067 return $sentence; 00068 } 00077 public static function nget($sentence1, $sentence2, $n) 00078 { 00082 $sentence = ngettext($sentence1, $sentence2, $n); 00083 00087 if(func_num_args()>3) { 00088 $args = func_get_args(); 00092 unset($args[0], $args[1], $args[2]); 00093 $sentence = vsprintf($sentence, $args); 00094 } 00095 00096 return $sentence; 00097 } 00105 public static function cget($sentence, $category) 00106 { 00110 $sentence = dcgettext(textdomain(null), $sentence, $category); 00111 00115 if(func_num_args()>2) { 00116 $args = func_get_args(); 00120 unset($args[0], $args[1]); 00121 $sentence = vsprintf($sentence, $args); 00122 } 00123 00124 return $sentence; 00125 } 00135 public function cnget($sentence1, $sentence2, $n, $category) 00136 { 00140 $sentence = dcngettext(textdomain(null), $sentence1, $sentence2, $n, $category); 00141 00145 if(func_num_args()>4) { 00146 $args = func_get_args(); 00150 unset($args[0], $args[1], $args[2], $args[3]); 00151 $sentence = vsprintf($sentence, $args); 00152 } 00153 00154 return $sentence; 00155 } 00156 }