我在 PHP 中使用 gettext 时遇到问题;我有两台服务器,一台是本地服务器(我在其中开发),在 Windows 中(使用 vs.php)并工作查找,另一台在 Amazon EC2 中(更新了 Ubuntu 12.04),这是生产服务器,在这台服务器中,相同的代码不发现了。
这是我的代码:
我用这个来初始化 gettext 。
function initialize_i18n($locale) {
$locales_root = "./librerias/noAuto/locale";
putenv('LANG='.$locale);
putenv("LC_ALL=" . $locale);
setlocale(LC_ALL,$locale);
$domains = glob($locales_root.'/'.$locale.'/LC_MESSAGES/messages*.mo');
if (count ($domains) > 0)
{
$current = basename($domains[0],'.mo');
$timestamp = preg_replace('{messages-}i','',$current);
bindtextdomain($current,$locales_root);
bind_textdomain_codeset( $current, "UTF-8" );
textdomain($current);
if ($locale == "en_US")
{
if( _("Modificar") === "Modify" ) {
$system->setDebug( "Translated correctly");
} else {
$system->setDebug( "Gettext don't working");
}
}
}
}
initialize_i18n("en_US");
Run Code Online (Sandbox Code Playgroud)
我的项目中的所有文件均以 UTF-8(西班牙语)编码,并且 .mo 和 .po …
我查询了一些数据,结果是这样的
<p><img src="xxx.png" alt="" style="margin:5px;" /><br></p><p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.<br></p>
Run Code Online (Sandbox Code Playgroud)
在控制台上显示。我想从这个数据中删除所有的 html 标签,只得到这样的字符串
Lorem Ipsum 只是印刷和排版行业的虚拟文本。自 1500 年代以来,Lorem Ipsum 一直是行业标准的虚拟文本,当时一位不知名的印刷商使用了一个类型的厨房,并争先恐后地将其制作成一个类型。
任何人都知道如何从此数据或某些解决方案中删除单引号和双引号。谢谢
我想编写一个测试用例,在其中我将前一页中单击的元素的值与当前页面中元素值的值进行比较.
我使用以下代码 -
validateText = SoftwaresUnmappedPage_POM.checkFirstSoftwareName.getText();
expect(validateText+"*").toBe(SoftwareSummary_POM.softwareName.getText());
Run Code Online (Sandbox Code Playgroud)
例如 - 如果我单击按钮(ABC),则会加载页面.此页面包含指示我单击的元素的元素.但它将名称显示为ABC*.所以我想验证我点击的元素和我登陆的页面是否相同.
导致错误 - 预期'[object Object] '为'ABC '.
有人可以帮我解决这个问题吗?谢谢.
在 Wordpress 中,我正在使用 Woocommerce v3.3.5 并在可变产品的单个产品页面中,当我单击添加到购物车按钮而我没有选择变体选项时,它会弹出一个警报,上面写着:
在将此产品添加到您的购物车之前,请选择一些产品选项。
到目前为止这是合乎逻辑的..
我的问题是如何将警报文本更改为其他内容以适合我的业务?
我在GridLayout中安排了一组按钮.我想根据文本访问特定按钮.有没有办法根据文本检索按钮?
我使用 get text 模块创建了语言翻译,现在我在我的文件中添加了更多的字符串我运行这个程序之前的字符串正在转换并且剩余的字符串没有被翻译。任何人都可以告诉我如何更新 .pot、.po 和 .在 Linux 中使用 get text 模块的 mo 文件
请告诉我有关如何使用msgcat合并两个.po文件以及如何安装msgcat的信息.
不知道我做错了什么,但我尝试比较一个字符串,例如
boolean state = ((TextView) v).getText().toString().trim().equals(R.string.[some-value]);
Run Code Online (Sandbox Code Playgroud)
这总是评估为 false,但是当我调试时, (TextView v).getText() 的输出值是我想要比较的正确值。我也尝试过
boolean state = ((TextView) v).getText().equals(R.string.[some-value]);
Run Code Online (Sandbox Code Playgroud)
如前所述,当我调试时,我可以看到 getText() 返回的值与我在 strings.xml 中为 [some-value] 定义的值匹配。
我可以通过比较单击的 TextView 的 Id 来解决此问题。但我想知道为什么上面的 equals 不起作用。任何帮助表示赞赏。
gettext ×8
javascript ×2
php ×2
android ×1
awt ×1
equals ×1
java ×1
jbutton ×1
jquery ×1
localization ×1
php-gettext ×1
product ×1
protractor ×1
python ×1
string ×1
swing ×1
testing ×1
text ×1
windows ×1
woocommerce ×1
wordpress ×1