콘텐츠로 건너뛰기 사이드바로 건너뛰기

Waiting for author

Reported for: WPML Multilingual & Multicurrency for WooCommerce 5.3.5

Topic Tags: Bug, Compatibility, WCML

Overview of the issue

If you are using the WooCommerce PayPal Payments plugin, you will find it is not possible to translate the “Pay via PayPal” button and associated buttons shown on the front end.

Workaround

Note, following updates to the PayPal plugin the advice below has changed.

Please, make sure of having a full backup of your site before proceeding.

We recommend adding the below code in a custom plugin. Just copy the code and save it in a file with a name of your choice and a .php extension, e.g. fix-paypal-button-language.php:

Fix PayPal Button Language
<?php
/*
 * Plugin Name: Language Setting for WooCommerce PayPal Payments
 * Description: Filter the button language to match the current language
 * Author: OTGS
 * Version: 1.0
 */

if ( ! str_contains( wp_get_referer(), "wp-admin" ) ) {

    add_filter( 'option_woocommerce-ppcp-data-settings', function( $value ){
        
        $current_language = apply_filters( 'wpml_current_language', null );
        $languages = apply_filters( 'wpml_active_languages', null );
        $locale = $languages[ $current_language ]['default_locale'];
        if ( is_array( $value ) && is_string( $locale ) ) {
            $value['button_language'] = $locale;
        }
            
        return $value;
    });
            
}

응답 4개 대상 “WooCommerce PayPal Payments - "Pay via PayPal" Translation Not Working”

  1. Hello,

    I was able to translate the labels in the credit card fields, but the input box do not show in my translated language. Any idea how to fi this?

    Thanks.

    • Hello Alexanne,
      I’m afraid this is a different issue from the one reported here. If you can’t find the related string in WPML > String Translation, please open a chat in our assistance channel.
      We will be able to help you better there.

    • Hi there,
      Thanks for your feedback, and sorry for the inconvenience. Unfortunately, until the WooCommerce PayPal Payments developers implement a permanent fix, you’ll need to reapply this workaround after each update. You can follow the ticket here.

답글 남기기

주제에 집중하고 다른 사람을 존중해 주세요. 이 게시물과 관련 없는 문제에 도움이 필요하면 지원 포럼을 사용하여 채팅을 시작하거나 티켓을 제출하세요.

다음 태그를 사용할 수 있습니다:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>