WooCommerce-在“结帐"页面上翻译单词 [英] WooCommerce - Translate a word on the Checkout page

查看:114
本文介绍了WooCommerce-在“结帐"页面上翻译单词的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试翻译WooCommerce结帐页面上的单词. 我的网站是荷兰语,但他们的翻译效果很差,所以我想使用其他单词.

I'm trying to translate a word on the WooCommerce checkout page. My website is in the Dutch language, but they translated it poorly, so I want to use a different word.

需要翻译的内容

它涉及以下行:

"Totaal€469,38(inclusief€79,38 持久)"

"Totaal €469,38 (Inclusief €79,38 Belasting)"

用英语说:

总计469,38欧元(包括79,38欧元的)"

"Total €469,38 (Includes €79,38 tax)"

这是一行订单总金额的总和.我想将"Belasting"一词翻译为"BTW".

It's the line that sums up the total amount of the order. And I want to translate the word 'Belasting' to 'BTW'.

我尝试过的事情

  1. 在WooCommerce中检出设置

  1. Checked out settings in WooCommerce

安装了插件Loco转换器

Installed the plugin Loco translator

使用FTP(Adobe Dreamweaver)搜索单词

Searched for the word with FTP (Adobe Dreamweaver)

由于我在任何地方都找不到"Belasting"一词,所以我确实找到了带有该行元素的php文件.

As I couldn't find the word 'Belasting' anywhere, I did find the php-file with the element of the line.

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

This I found in the PHP-document wc-cart-functions.php:

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

这是HTML部分的样子:

And this is how the HTML part looks like:

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

我的问题

我想它的确会输出带有'%s'变量的单词'Belasting'.但是,我无法在任何地方找到该变量的内容.

I presume it does print the word 'Belasting' with the '%s' variable. However I am unable to find the content for that variable anywhere.

因此,有人可以通过找到该词的翻译来帮助我吗?

So can anybody help me out by finding how to translate this word?

感谢您的阅读,感谢您的帮助.

Thanks for reading and I'd appreciate the help.

推荐答案

您可以尝试使用 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 );

这篇关于WooCommerce-在“结帐"页面上翻译单词的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆