admin管理员组文章数量:1202781
I get this warning
Notice: Undefined variable: pofiles in /var/www/html/wp-content/themes/themename/functions.php on line 237 Warning: Invalid argument supplied for foreach() in /var/www/html/wp-content/themes/themename/functions.php on line 237
when I am trying to load po file with function, like this
foreach ($pofiles as $pofile) {
$domain = baseName($pofile, 'http://localhost:8100/var/www/html/wp-content/languages/ponamefile.po');
$lang = baseName(dirName(dirName($pofile)));
/*
# build .mo file for gettext
#
echo "Building $lang $domain.mo ...\n";
$mofile = preg_replace('/\.po$/', '.mo', $pofile);
passThru( 'msgfmt -o '. qsa($mofile) .' '. qsa($pofile), $err );
if ($err !== 0) {
echo " Failed.";
if ($err === 127) echo " (msgfmt not found. gettext not installed?)";
echo "\n";
}
*/
# build .php file for php
#
echo "Building {$lang} {$domain}.php ...\n";
$phpout = _po_to_php($pofile);
if (!is_array($phpout)) {
$phpout = array();
}
$phpout = '<' . "?php\n" . "// AUTO-GENERATED FILE. TO MAKE CHANGES EDIT\n" . "// " . $domain . ".po AND REBUILD\n\n" . $copyright . "\n\n" . '$g_gs_LANG[\'' . $lang . '\'][\'' . $domain . '\'] = ' . var_export($phpout, true) . ";\n\n" . '?' . '>';
$phpfile = preg_replace('/\\.po$/', '.php', $pofile);
$f = fOpen($phpfile, 'wb');
fWrite($f, $phpout, strLen($phpout));
fClose($f);
}
本文标签: can39t load po file in functionsphp
版权声明:本文标题:can't load .po file in functions.php 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738656470a2105171.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论