wordpress - WooCommerce - 翻译结帐页面上的单词

标签 wordpress internationalization woocommerce machine-translation

我正在尝试翻译 WooCommerce 结帐页面上的一个词。 我的网站是荷兰语,但他们翻译得不好,所以我想换个词。

需要翻译的内容

它涉及以下行:

“总计 469,38 欧元(包括 79,38 欧元 Belasting)”

英文是这样说的:

“总计 469,38 欧元(包括 79,38 欧元)”

这是汇总订单总金额的行。我想将“Belasting”这个词翻译成“BTW”。

我尝试过的

  1. 检查 WooCommerce 中的设置

  2. 安装插件 Loco 翻译器

  3. 使用 FTP (Adobe Dreamweaver) 搜索单词

因为我在任何地方都找不到“Belasting”这个词,所以我确实找到了包含该行元素的 php 文件。

这是我在 PHP 文档 wc-cart-functions.php 中找到的:

if ( ! empty( $tax_string_array ) ) {
        $value .= '<small class="includes_tax">' . sprintf( __( '(Includes %s)', 'woocommerce' ), implode( ', ', $tax_string_array ) ) . '</small>';
    }

这就是 HTML 部分的样子:

<small class="includes_tax">
(inclusief 
<span class="amount">€79,38</span>
Belasting)
</small>

我的问题

我假设它确实用“%s”变量打印了“Belasting”这个词。但是我无法在任何地方找到该变量的内容。

所以有人可以帮助我找到如何翻译这个词吗?

感谢阅读,非常感谢您的帮助。

最佳答案

您可以尝试使用 gettext过滤器

例子

function my_text_strings( $translated_text, $text, $domain ) {
    switch ( $translated_text ) {
        case 'Related Products' :
            $translated_text = __( 'Check out these related products', 'woocommerce' );
            break;
    }
    return $translated_text;
}
add_filter( 'gettext', 'my_text_strings', 20, 3 );

关于wordpress - WooCommerce - 翻译结帐页面上的单词,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31559778/

相关文章:

wordpress - 如何从其他WordPress安装中调用WordPress循环?

javascript - TinyMCE 替换父节点

internationalization - 在项目中管理多种语言的良好解决方案

java - GWT i18n 呈现键而不是值

php - WooCommerce wc_get_lated_products 功能不起作用

css - 如何在 Woocommerce 中对齐 "Add to Cart"按钮?

css - Chrome 中的 Z-index 重叠问题

php - 如何使用 CURL 为 Wordpress 发送数据

ruby-on-rails - 如何从 Rails I18n 中的 yml 文件中检索所有翻译

php - 哪个钩子(Hook)可以在 WooCommerce 中保存 WooCommerce 产品元数据?