变更集49236
时间戳: 2020年10月20日下午04:03:58 ( 4年 (之前) 位置: 大旅行箱 文件夹: -
新增19个 15已编辑
-
src/wp-includes/class-wp-locale-switcher.php (已修改) ( 2个差异 ) -
src/wp-includes/class-wp-textdomain-registry.php (新增) -
src/wp-includes/deprecated.php (已修改) ( 1个差异 ) -
src/wp-includes/l10n.php (已修改) ( 19个差异 ) -
src/wp-settings.php (已修改) ( 2个差异 ) -
tests/phpunit/data/languages/plugins/internationalized-plugin-de_de.mo (已修改) ( 以前的 ) -
tests/phpunit/data/languages/plugins/internationalized-plugin-de_de.po测试/phpunit/data/languages/plugins/internationalized-plugin-de_de.po (已修改) ( 2个差异 ) -
测试/phpunit/data/languages/plugins/internationalized-plugin-es_es.mo (新增) -
测试/phpunit/data/languages/plugins/internationalized-plugin-es_es.po (新增) -
tests/phpunit/数据/语言/主题/国际化主题-de_de.mo (已修改) ( 以前的 ) -
tests/phpunit/数据/语言/主题/国际化主题-de_de.po (已修改) ( 2个差异 ) -
测试/phpunit/data/plugins/custom-internationalized-plugin (新增) -
tests/phpunit/data/plugins/custom-internationalized-plugin/custom-internionalized-plugin.php (新增) -
测试/phpunit/data/plugins/custom-internationalized-plugin/languages (新增) -
tests/phpunit/data/plugins/custom-internationalized-plugin/languages/custom-internationalized-plugin-de_de.mo (新增) -
tests/phpunit/data/plugins/custom-internationalized-plugin/languages/custom-internationalized-plugin-de_de.po (新增) -
tests/phpunit/data/plugins/custom-internationalized-plugin/languages/custom-internationalized-plugin-es_es.mo (新增) -
tests/phpunit/data/plugins/custom-internationalized-plugin/languages/custom-internationalized-plugin-es_es.po (新增) -
tests/phpunit/data/plugins/hello.php (已修改) ( 1个差异 ) -
测试/phpunit/data/themedir1/custom-internationalized-theme (新增) -
tests/phpunit/data/themedir1/custom-internationalized-theme/functions.php (新增) -
tests/phpunit/data/themedir1/custom-internationalized-theme/index.php (新增) -
测试/phpunit/data/themedir1/custom-internationalized-theme/languages (新增) -
tests/phpunit/data/themedir1/custom-internationalized-theme/languages/de_de.mo (新增) -
tests/phpunit/data/themedir1/custom-internationalized-theme/languages/de_de.po (新增) -
tests/phpunit/data/themedir1/custom-internationalized-theme/languages/es_es.mo (新增) -
测试/phpunit/data/themedir1/custom-internationalized-theme/languages/es_es.po (新增) -
tests/phpunit/data/themedir1/custom-internationalized-theme/style.css (新增) -
tests/phpunit/includes/bootstrap.php (已修改) ( 1个差异 ) -
tests/phpunit/tests/admin/includesPlugin.php (已修改) ( 1个差异 ) -
tests/phpunit/tests/l10n/loadTextdomain.php (已修改) ( 7个差异 ) -
tests/phpunit/tests/l10n/loadTextdomainJustInTime.php (已修改) ( 4个差异 ) -
tests/phpunit/tests/l10n/localeSwitcher.php (已修改) ( 2个差异 ) -
tests/phpunit/tests/theme/themeDir.php (已修改) ( 1个差异 )
图例:
未修改 补充 已删除
-
trunk/src/wp-includes/class-wp-locale-switcher.php 46586兰特 49236兰特 197 197 198 198 foreach($domains作为$domain){ 199 //默认文本域由“load_default_textdomain()”处理。 199 200 if('default'===$domain){ 200 201 继续; 201 202 } 202 203 203 unload_textdomain($domain ); 204 unload_textdomain($domain ,是真的 ); 204 205 获取翻译域($domain); 205 206 } … … 219 220 */ 220 221 私有函数change_locale($locale){ 221 //重置翻译可用性信息。 222 _get_path_to_translation(空,真); 222 全局$wp_locale; 223 223 224 224 $this->load_translations($locale); 225 225 226 $ 全局['wp_locale'] =新WP_Locale(); 226 $ wp_位置 =新WP_Locale(); 227 227 228 228 /** -
trunk/src/wp-includes/deprecated.php 49197兰特 49236兰特 4135 4135 返回is_string($value)? addslashes($value):$value; 4136 4136 } 4137 4138 /** 4139 *获取翻译文件的路径,以便及时加载文本域。 4140 * 4141 *在内部缓存检索到的结果。 4142 * 4143 *@自4.7.0起 4144 *@已弃用5.6.0 4145 *@access私有 4146 * 4147 *@请参阅_load_textdomain_just_in_time() 4148 * 4149 *@param string$domain文本域。 用于检索已翻译字符串的唯一标识符。 4150 *@param bool$reset是否重置内部缓存。 由切换到区域设置功能使用。 4151 *@return string | false翻译文件的路径,如果找不到翻译文件,则为false。 4152 */ 4153 函数get_path_to_translation($domain,$reset=false){ 4154 _deprected_function(__function__,'5.6.0','WP_Textdomain_Registry'); 4155 4156 静态$available_translations=array(); 4157 4158 if(true===$reset){ 4159 $available_translations=array(); 4160 } 4161 4162 if(!isset($available_translations[$domain]){ 4163 $available_translations[$domain]=_get_path_to_translation _from_lang_dir($domain); 4164 } 4165 4166 return$available_translations[$domain]; 4167 } 4168 4169 /** 4170 *获取当前语言环境的语言目录中的翻译文件的路径。 4171 * 4172 *保存可用.mo文件的缓存列表以提高性能。 4173 * 4174 *@自4.7.0起 4175 *@不推荐使用5.6.0 4176 *@access私有 4177 * 4178 *@参见_get_path_to_translation() 4179 * 4180 *@param string$domain文本域。 用于检索已翻译字符串的唯一标识符。 4181 *@return string | false翻译文件的路径,如果找不到翻译文件,则为false。 4182 */ 4183 函数get_path_to_translation_from_lang_dir($domain){ 4184 _deprected_function(__function__,'5.6.0','WP_Textdomain_Registry'); 4185 4186 静态$cached_mofiles=空; 4187 4188 if(空===$cachedmo文件){ 4189 $cached_mofiles=数组(); 4190 4191 $locations=数组( 4192 WP_LANG_DIR.'/ 插件', 4193 WP_LANG_DIR.'/ 主题', 4194 ); 4195 4196 foreach($locations作为$location){ 4197 $mofiles=glob($location.'/*.mo'); 4198 if($mofiles){ 4199 $cached_mofiles=数组合并($cached_mofiles,$mofiles); 4200 } 4201 } 4202 } 4203 4204 $locale=确定_locale(); 4205 $mofile=“{$domain}-{$locale}.mo”; 4206 4207 $path=WP_LANG_DIR。'/ 插件/'$ mofile; 4208 if(in_array($path,$cachedmofiles,true)){ 4209 return$path; 4210 } 4211 4212 $path=WP_LANG_DIR。'/ 主题/'$ mofile; 4213 if(in_array($path,$cachedmofiles,true)){ 4214 return$path; 4215 } 4216 4217 返回false; 4218 } -
trunk/src/wp-includes/l10n.php 49193兰特 49236兰特 690 690 *@自1.5.0起 691 691 * 692 *@global MO[]$110n当前加载的所有文本域的数组。 693 *@global MO[]$l10n_unloaded再次卸载的所有文本域的数组。 692 *@global MO[]$110n当前加载的所有文本域的数组。 693 *@global MO[]$l10n_unloaded再次卸载的所有文本域的数组。 694 *@global WP_Textdomain_Registry$WP_Textdomain_Registry WordPress文本域注册表。 694 695 * 695 696 *@param string$domain文本域。 用于检索已翻译字符串的唯一标识符。 … … 698 699 */ 699 700 函数load_textdomain($domain,$mofile){ 700 全局$110n,$l10n已卸载 ; 701 全局$110n,$l10n已卸载 ,$wp_textdomain_registry ; 701 702 702 703 $l10n_unloaded=(数组)$l10n _ unloaded; … … 756 757 $110n[$domain]=&$mo; 757 758 759 /**@var WP_Textdomain_Registry$WP_Textdomain_Registry*/ 760 $wp_textdomain_registry->集合($domain,目录名($mofile)); 761 758 762 返回true; 759 763 } … … 763 767 * 764 768 *@自3.0.0起 769 *@since 5.6.0添加了`$reloadable`参数。 765 770 * 766 771 *@global MO[]$110n当前加载的所有文本域的数组。 767 772 *@global MO[]$l10n_unloaded再次卸载的所有文本域的数组。 768 773 * 769 *@param string$domain文本域。 用于检索已翻译字符串的唯一标识符。 774 *@param string$domain文本域。 用于检索已翻译字符串的唯一标识符。 775 *@param bool$reloadable是否可以立即再次加载文本域。 770 776 *@return bool是否卸载了textdomain。 771 777 */ 772 函数unload_textdomain($domain ) { 778 函数unload_textdomain($domain ,$reloadable=false ) { 773 779 全局$10n,$l10n_unloaded; 774 780 … … 779 785 * 780 786 *@自3.0.0起 781 * 782 *@param bool$override是否覆盖文本域卸载。 默认为false。 783 *@param string$domain文本域。 用于检索已翻译字符串的唯一标识符。 784 */ 785 $plugin_override=apply_filters('override_unload_textdomain',false,$domain); 787 *@since 5.6.0添加了`$reloadable`参数。 788 * 789 *@param bool$override是否覆盖文本域卸载。 默认为false。 790 *@param string$domain文本域。 用于检索已翻译字符串的唯一标识符。 791 *@param bool$reloadable是否可以立即再次加载文本域。 792 */ 793 $plugin_override=apply_filters('override_unload_textdomain',false,$domain,$reloadable); 786 794 787 795 if($plugin_override){ 788 $l10n_unloaded[$domain]=true; 796 if(!$可重载){ 797 $l10n_unloaded[$domain]=true; 798 } 789 799 790 800 返回true; … … 795 805 * 796 806 *@自3.0.0起 797 * 798 *@param string$domain文本域。 用于检索已翻译字符串的唯一标识符。 799 */ 800 do_action('unload_textdomain',$domain); 807 *@since 5.6.0添加了`$reloadable`参数。 808 * 809 *@param string$domain文本域。 用于检索已翻译字符串的唯一标识符。 810 *@param bool$reloadable是否可以再次及时加载文本域。 811 */ 812 do_action('unload_textdomain',$domain,$reloadable); 801 813 802 814 if(isset($110n[$domain]){ 803 815 取消设置($110n[$domain]); 804 816 805 $l10n_unloaded[$domain]=true; 817 if(!$可重载){ 818 $l10n_unloaded[$domain]=true; 819 } 806 820 807 821 返回true; … … 868 882 */ 869 883 函数load_plugin_textdomain($domain,$deprecated=false,$plugin_rel_path=false){ 884 全局$wp_textdomain_registry; 885 870 886 /** 871 887 *过滤插件的区域设置。 … … 894 910 } 895 911 912 /*@var WP_Textdomain_Registry$WP_Textdomain_Registry*/ 913 $wp_textdomain_registry->集合($domain,$path); 914 896 915 return load_textdomain($domain,$path.'/'.$mofile); 897 916 } … … 902 921 *@自3.0.0起 903 922 *@自4.6.0起该函数现在尝试首先从languages目录加载.mo文件。 923 * 924 *@global WP_Textdomain_Registry$WP_Textdomain_Registry WordPress文本域注册表。 904 925 * 905 926 *@param string$domain文本域。 用于检索已翻译字符串的唯一标识符。 … … 909 930 */ 910 931 函数load_mulugin_textdomain($domain,$mu_plugin_rel_path=“”){ 932 全局$wp_textdomain_registry; 933 911 934 /**此过滤器记录在wp-includes/l10n.php中*/ 912 935 $locale=应用过滤器('plugin_locale',determine_locale(),$domain); … … 921 944 $path=WPMU_PLUGIN_DIR.'/'。 ltrim($mu_plugin_rel_path,'/'); 922 945 946 /*@var WP_Textdomain_Registry$WP_Textdomain_Registry*/ 947 $wp_textdomain_registry->集合($domain,$path); 948 923 949 return load_textdomain($domain,$path.'/'.$mofile); 924 950 } … … 934 960 *@自1.5.0起 935 961 *@自4.6.0起该函数现在尝试首先从languages目录加载.mo文件。 962 * 963 *@global WP_Textdomain_Registry$WP_Textdomain_Registry WordPress文本域注册表。 936 964 * 937 965 *@param string$domain文本域。 用于检索翻译字符串的唯一标识符。 … … 941 969 */ 942 970 函数load_theme_textdomain($domain,$path=false){ 971 全局$wp_textdomain_registry; 972 943 973 /** 944 974 *过滤主题的区域设置。 … … 961 991 $path=获取模板目录(); 962 992 } 993 994 /*@var WP_Textdomain_Registry$WP_Textdomain_Registry*/ 995 $wp_textdomain_registry->集合($domain,$path); 963 996 964 997 return load_textdomain($domain,$path.'/'.$locale.'.mo'); … … 1191 1224 *@access私有 1192 1225 * 1193 * @ 请参见get_translations_for_domain() 1194 *@全球 MO[]$l10n_unloaded再次卸载的所有文本域的数组 . 1226 * @ global MO[]$l10n_unloaded再次卸载的所有文本域的数组。 1227 *@全球 WP_Textdomain_Registry$WP_Textdomain_Registry WordPress文本域注册表 . 1195 1228 * 1196 1229 *@param string$domain文本域。 用于检索已翻译字符串的唯一标识符。 … … 1198 1231 */ 1199 1232 函数加载文本域调整输入时间($domain){ 1200 全局$110n_已卸载 ; 1233 全局$110n_已卸载 ,$wp_textdomain_registry ; 1201 1234 1202 1235 $l10n_unloaded=(数组)$l10n _ unloaded; … … 1207 1240 } 1208 1241 1209 $translation_path=_get_path_to_translation($domain); 1210 if(false===$translation_path){ 1242 /**@var WP_Textdomain_Registry$WP_Textdomain_Registry*/ 1243 $path=$wp_textdomain_registry->get($domain); 1244 if(!$path){ 1211 1245 返回false; 1212 1246 } 1213 1247 1214 return load_textdomain($domain,$translation_path); 1215 } 1216 1217 /** 1218 *获取翻译文件的路径,以便及时加载文本域。 1219 * 1220 *在内部缓存检索到的结果。 1221 * 1222 *@自4.7.0起 1223 *@access私有 1224 * 1225 *@请参阅_load_textdomain_just_in_time() 1226 * 1227 *@param string$domain文本域。 用于检索已翻译字符串的唯一标识符。 1228 *@param bool$reset是否重置内部缓存。 由切换到区域设置功能使用。 1229 *@return string | false翻译文件的路径,如果找不到翻译文件,则为false。 1230 */ 1231 函数get_path_to_translation($domain,$reset=false){ 1232 静态$available_translations=array(); 1233 1234 if(true===$reset){ 1235 $available_translations=array(); 1236 } 1237 1238 if(!isset($available_translations[$domain]){ 1239 $available_translations[$domain]=_get_path_to_translation _from_lang_dir($domain); 1240 } 1241 1242 return$available_translations[$domain]; 1243 } 1244 1245 /** 1246 *获取当前区域设置的语言目录中翻译文件的路径。 1247 * 1248 *保存可用.mo文件的缓存列表以提高性能。 1249 * 1250 *@自4.7.0起 1251 *@access私有 1252 * 1253 *@请参见_get_path_to_translation() 1254 * 1255 *@param string$domain文本域。 用于检索翻译字符串的唯一标识符。 1256 *@return string | false翻译文件的路径,如果找不到翻译文件,则为false。 1257 */ 1258 函数get_path_to_translation_from_lang_dir($domain){ 1259 静态$cached_mofiles=空; 1260 1261 if(空===$cachedmo文件){ 1262 $cached_mofiles=数组(); 1263 1264 $locations=数组( 1265 WP_LANG_DIR.'/ 插件', 1266 WP_LANG_DIR.'/ 主题', 1267 ); 1268 1269 foreach($locations作为$location){ 1270 $mofiles=glob($location.'/*.mo'); 1271 if($mofiles){ 1272 $cached_mofiles=数组合并($cached_mofiles,$mofiles); 1273 } 1274 } 1275 } 1276 1277 1248 $locale=确定_locale(); 1278 $mofile=“{$domain}-{$locale}.mo”; 1279 1280 $path=WP_LANG_DIR。'/ 插件/'$ mofile; 1281 if(in_array($path,$cachedmofiles,true)){ 1282 return$path; 1283 } 1284 1285 $path=WP_LANG_DIR。'/ 主题/'$ mofile; 1286 if(in_array($path,$cachedmofiles,true)){ 1287 return$path;返回$path; 1288 } 1289 1290 返回false; 1249 1250 //语言目录位于WP_LANG_DIR之外的主题具有不同的文件名。 1251 $template_directory=trailingslashit(get_template_directory()); 1252 $stylesheet_directory=拖尾斜线(get_stylesheet_directory()); 1253 if(0==strpos($path,$template_directory)||0==strpos($path,$stylesheet_directory)){ 1254 $mofile=“{$path}{$locale}.mo”; 1255 }其他{ 1256 $mofile=“{$path}{$domain}-{$locale}.mo”; 1257 } 1258 1259 return load_textdomain($domain,$mofile); 1291 1260 } 1292 1261 … … 1298 1267 *@自2.8.0起 1299 1268 * 1300 *@全球MO[]110亿美元 1269 *@全球MO[]110亿美元 当前加载的所有文本域的数组。 1301 1270 * 1302 1271 *@param string$domain文本域。 用于检索已翻译字符串的唯一标识符。 … … 1322 1291 *@自3.0.0起 1323 1292 * 1324 *@全球MO[]110亿美元 1293 *@全球MO[]110亿美元 当前加载的所有文本域的数组。 1325 1294 * 1326 1295 *@param string$domain文本域。 用于检索已翻译字符串的唯一标识符。 -
中继/src/wp-settings.php 49226兰特 49236兰特 153 153 //加载L10n库。 154 154 需要一次ABSPATH。 WPINC.公司/ l10n.php'; 155 需要一次ABSPATH。 WPINC.公司/ class-wp-textdomain-registry.php'; 155 156 需要一次ABSPATH。 WPINC公司/ class-wp-locale.php'; 156 157 需要一次ABSPATH。 WPINC公司/ class-wp-locale-switcher.php'; … … 302 303 $GLOBALS['wp_embed']=新wp_embed(); 303 304 305 /** 306 *WordPress Textdomain注册表对象。 307 * 308 *用于支持手动加载的文本域的即时翻译。 309 * 310 *@自5.6.0起 311 * 312 *@global WP_Locale_Switcher$WP_Locale_Switcher WordPress文本域注册表。 313 */ 314 $GLOBALS['wp_textdomain_registry']=新wp_textdomain_registry(); 315 304 316 //加载多站点特定的文件。 305 317 if(is_multisite()){ -
trunk/tests/phpunit/data/languages/plugins/internationalized-plugin-de_de.po 48930兰特 49236兰特 三 三 “项目Id版本:\n” 4 4 “POT-创建日期:2015-12-31 16:31+0100\n” 5 “PO-修订日期:20 16-10-26 00:02 +0200\n“ 5 “PO-修订日期:20 20-10-20 17:11 +0200\n“ 6 6 “语言:de_de\n” 7 7 “MIME版本:1.0\n” 8 8 “内容类型:text/plain;字符集=UTF-8 \n” 9 9 “内容传输编码:8位\n” 10 “X生成器:Poedit 1.8.10 \n“ 10 “X生成器:Poedit 第2.4.1条 \n“ 11 11 “X-Poedit-Basepath:。\n” 12 12 “复数形式:nplurals=2;复数形式=(n!=1);\n” … … 15 15 “esc_html_x:1,2c\n” 16 16 “X-Textdomain-Support:yes\n” 17 “语言团队:\n” 18 “最后一个转换器:\n” 17 19 “X-Poedit-SearchPath-0:。\n” 18 20 -
trunk/tests/phpunit/data/languages/themes/internationalized-theme-de_de.po 48930兰特 49236兰特 三 三 “项目Id版本:\n” 4 4 “POT-创建日期:2015-12-31 16:38+0100\n” 5 “PO-修订日期:20 16-10-26 00:02 +0200\n“ 5 “PO-修订日期:20 20-10-20 17:09 +0200\n“ 6 6 “语言:de_de\n” 7 7 “MIME版本:1.0\n” 8 8 “内容类型:text/plain;charset=UTF-8\n” 9 9 “内容传输编码:8位\n” 10 “X生成器:Poedit 1.8.10 \n“ 10 “X生成器:Poedit 第2.4.1条 \n英寸 11 11 “X-Poedit-Basepath:。\n” 12 12 “复数形式:nplurals=2;复数形式=(n!=1);\n” … … 15 15 “esc_html_x:1,2c\n” 16 16 “X-Textdomain-Support:yes\n” 17 “上一个转换器:\n” 18 “语言团队:\n” 17 19 “X-Poedit-SearchPath-0:。\n” 18 20 -
trunk/tests/phpunit/data/plugins/hello.php 46586兰特 49236兰特 5 5 描述:这不仅仅是一个插件,它象征着整整一代人的希望和热情,这可以用路易斯·阿姆斯特朗最著名的两个词来概括:你好,多莉。 激活后,您将在每个页面的管理屏幕右上角随机看到来自Hello,Dolly的歌词。 6 6 作者:Matt Mullenweg 7 版本:1。 5.1 7 版本:1。 7.2 8 8 作者URI: 网址:http://ma.tt/ 9 9 文本域:hello dolly 10 10 11 11 */ 12 13 //测试 14 ?> -
trunk/tests/phpunit/includes/bootstrap.php 49226兰特 49236兰特 77 77 define('DIR_TESTROOT',realpath(目录名(__DIR__))); 78 78 79 定义('WP_LANG_DIR',DIR_TESTDATA.'/languages'); 79 define('WP_LANG_DIR',realpath(DIR_TESTDATA.'/languages')); 80 define('WP_PLUGIN_DIR',realpath(DIR_TESTDATA.'/plugins'); 80 81 81 82 if(!已定义('WP_TESTS_FORCE_NOWN_BUGS')){ -
trunk/tests/phpunit/tests/admin/includesPlugin.php 人民币49112元 49236兰特 15 15 '作者'=>'<a href=“ 网址:http://ma.tt/ “>Matt Mullenweg”, 16 16 “AuthorURI”=>“ 网址:http://ma.tt/ ', 17 “版本”=>“1”。 5.1 ', 17 “版本”=>“1”。 7.2 ', 18 18 'TextDomain'=>'hello-dolly', 19 19 “DomainPath”=>“”, -
trunk/tests/phpunit/tests/l10n/loadTextdomain.php 46586兰特 49236兰特 25 25 add_filter('plugin_locale',数组($this,'store_locale')); 26 26 add_filter('theme_locale',数组($this,'store_locale')); 27 28 /**@var WP_Textdomain_Registry$WP_Textdomain_Registry*/ 29 全局$wp_textdomain_registry; 30 31 $wp_textdomain_registry->重置(); 27 32 } 28 33 … … 31 36 remove_filter('theme_locale',数组($this,'store_locale')); 32 37 38 /**@var WP_Textdomain_Registry$WP_Textdomain_Registry*/ 39 全局$wp_textdomain_registry; 40 41 $wp_textdomain_registry->重置(); 42 33 43 父项::tearDown(); 34 44 } … … 117 127 *@门票21319 118 128 */ 119 函数test_is_textdomain_is_not_loaded_after_gettext_call_with_no_translations(){ 129 公众的 函数测试_is_textdomain_is_not_loaded_after_getext_call_with_no_translations(){ 120 130 $this->assertFalse(is_textdomain_loaded('wp-tests-domain')); 121 131 __('只是一些字符串','wp-tests-domain'); … … 123 133 } 124 134 125 函数test_override_load_textdomain_noop(){ 135 公众的 函数test_override_load_textdomain_noop(){ 126 136 add_filter('override_load_textdomain','__return_true'); 127 137 $load_textdomain=load_textdomain('wp-tests-domain',DIR_TESTDATA.'/不存在文件'); … … 132 142 } 133 143 134 函数test_override_load_textdomain_non_existent_mofile(){ 144 公众的 函数test_override_load_textdomain_non_existent_mofile(){ 135 145 add_filter('override_load_textdomain',数组($this,'_override_ load_textdomain_filter'),10,3); 136 146 $load_textdomain=load_textdomain('wp-tests-domain',wp_LANG_DIR.'/non-existent-file.mo'); … … 146 156 } 147 157 148 函数test_override_load_textdomain_custom_mofile(){ 158 公众的 函数test_override_load_textdomain_custom_mofile(){ 149 159 add_filter('override_load_textdomain',数组($this,'_override_ load_textdomain_filter'),10,3); 150 160 $load_textdomain=load_textdomain('wp-tests-domain',wp_LANG_DIR.'/plugins/internationalized-plugin-de_de.mo'); … … 166 176 *@return bool 167 177 */ 168 函数_override_load_textdomain_filter($override,$domain,$file){ 178 公众的 函数_override_load_textdomain_filter($override,$domain,$file){ 169 179 全球1100亿美元; 170 180 -
trunk/tests/phpunit/tests/l10n/loadTextdomainJustInTime.php 47200兰特 49236兰特 33 33 add_filter('template_root',数组($this,'filter_theme_root'); 34 34 wp_clean_themes_cache(); 35 unset($GLOBALS['wp_themes']); 36 取消设置($GLOBALS['l0n']); 37 取消设置($GLOBALS['l0n_unloaded']); 38 _get_path_to_translation(空,真); 35 未设置($GLOBALS['wp_themes'],$GLOBAS['l0n'],$GLOBALS['l10n_unloaded']); 36 37 /**@var WP_Textdomain_Registry$WP_Textdomain_Registry*/ 38 全局$wp_textdomain_registry; 39 40 $wp_textdomain_registry->重置(); 39 41 } 40 42 … … 45 47 remove_filter('template_root',数组($this,'filter_theme_root')); 46 48 wp_clean_themes_cache(); 47 unset($GLOBALS['wp_themes']); 48 取消设置($GLOBALS['l0n']); 49 未设置($GLOBALS['l10n_unloaded']); 50 _get_path_to_translation(空,真); 49 未设置($GLOBALS['wp_themes']、$GLOBALS['l10n']、$GLOBALS['l10n_unloaded']); 50 51 /**@var WP_Textdomain_Registry$WP_Textdomain_Registry*/ 52 全局$wp_textdomain_registry; 53 54 $wp_textdomain_registry->重置(); 51 55 52 56 父项::tearDown(); … … 171 175 /** 172 176 *@门票37997 177 *@票39210 173 178 */ 174 179 公共函数test_plugin_translation_after_switching_locale_twice(){ … … 184 189 185 190 $this->assertSame(“Das ist ein Dummy Plugin”,$expected_de_de); 186 $this->资产相同(' 这是一个虚拟插件 ',$expected_es_es); 191 $this->资产相同(' Este es un-plugin虚拟 ',$expected_es_es); 187 192 } 188 193 -
trunk/tests/phpunit/tests/l10n/localeSwitcher.php 48939兰特 49236兰特 23 23 $this->previous_locale=''; 24 24 25 取消设置($GLOBALS['l0n']); 26 取消设置($GLOBALS['l0n_unloaded']); 27 _get_path_to_translation(空,真); 25 取消设置($GLOBALS['l0n'],$GLOBAS['l10n_unloaded']); 26 27 /**@var WP_Textdomain_Registry$WP_Textdomain_Registry*/ 28 全局$wp_textdomain_registry; 29 30 $wp_textdomain_registry->重置(); 28 31 } 29 32 30 33 公共函数tearDown(){ 31 取消设置($GLOBALS['l0n']); 32 未设置($GLOBALS['l10n_unloaded']); 33 _get_path_to_translation(空,真); 34 取消设置($GLOBALS['l0n'],$GLOBAS['l10n_unloaded']); 35 36 /**@var WP_Textdomain_Registry$WP_Textdomain_Registry*/ 37 全局$wp_textdomain_registry; 38 39 $wp_textdomain_registry->reset(); 34 40 35 41 父项::tearDown(); … … 389 395 } 390 396 397 /** 398 *@票39210 399 */ 400 公共函数test_switch_reloads_plugin_translations_outside_wp_lang_dir(){ 401 全局$wp_locale_switcher,$wp_textdomain_registry; 402 403 $locale_switcher=克隆$wp_locale_skitcher; 404 405 $wp_locale_switcher=新的wp_locale_switcher(); 406 $wp_locale_switcher->init(); 407 408 需要一次DIR_TESTDATA。'/ plugins/custom-internationalized-plugin/custom-internationalized-plugin.php'; 409 410 $this->assertSame(WP_PLUGIN_DIR.'/custom-internationalized-PLUGIN/languages/',$WP_textdomain_registry->get('自定义国际化插件'); 411 412 $expected=custom_i18n_plugin_test(); 413 $this->assertSame(“这是一个虚拟插件”,$expected); 414 415 switch_to_locale(“es_es”); 416 switch_to_locale('de_de'); 417 418 $expected=custom_i18n_plugin_test(); 419 $this->assertSame(“Das is ein Dummy Plugin”,$expected); 420 421 restore_previous_locale(); 422 423 $expected=custom_i18n_plugin_test(); 424 $this->assertSame(“Este es un-plugin dummy”,$expected); 425 426 restore_current_locale(); 427 428 $wp_locale_switcher=$locale_sitcher; 429 } 430 431 /** 432 *@票39210 433 */ 434 公共函数test_switch_reloads_theme_translations_outside_wp_lang_dir(){ 435 全局$wp_locale_switcher,$wp_textdomain_registry; 436 437 $locale_switcher=克隆$wp_locale_skitcher; 438 439 $wp_locale_switcher=新的wp_locale_switcher(); 440 $wp_locale_switcher->init(); 441 442 switch_theme('自定义国际化主题'); 443 444 require_once获取样式表目录()。'/ functions.php'; 445 446 $this->assertSame(get_template_directory())。'/ languages/',$wp_textdomain_registry->get('自定义国际化主题'); 447 448 $expected=自定义_i18n_theme_test(); 449 450 $this->assertSame(“这是一个虚拟主题”,$expected); 451 452 switch_to_locale(“es_es”); 453 switch_to_scale(“de_de”); 454 455 $应为=custom_i18n_theme_test(); 456 $this->assertSame(“这是一个伪主题”,应为$); 457 458 restore_previous_locale(); 459 460 $应为=custom_i18n_theme_test(); 461 $this->assertSame(“Este es un tema dummy”,$expected); 462 463 restore_current_locale(); 464 465 $wp_locale_switcher=$locale_sitcher; 466 } 467 391 468 公共函数filter_locale(){ 392 469 return'es_es'; -
trunk/tests/phpunit/tests/theme/themeDir.php 48937兰特 49236兰特 163 163 '目录中有空间的主题', 164 164 “国际化主题”, 165 '自定义国际化主题', 165 166 “camelCase”, 166 167 “REST主题”,