Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.7.2: bug in “automatic language detection” #319

Open
appeltju opened this issue May 15, 2024 · 0 comments
Open

v1.7.2: bug in “automatic language detection” #319

appeltju opened this issue May 15, 2024 · 0 comments

Comments

@appeltju
Copy link

If you set “Language In Payment Window” to “Detect Automatically” the payment window is ALWAYS shown in English. And I think it’s a bug in the plugin:

Note that “Detect automatically” is defined as the empty string in ReepayCheckout.php:297
'' => __( 'Detect Automatically', 'reepay-checkout-gateway' )

Further note that the language setting is loaded in ReepayCheckout.php:76
$this->language = $this->settings['language'] ?: $this->language;

and keep in mind that the short-versioned ternary operator ?: interprets the empty string (== “Detect Automatically”) as false and will therefore not assign the empty string to $this->language. That is $this->language will be initialized with its current value, which is defined in ReepayGateway.php:94
public $language = 'en_US';

Due to this mistake, the method get_language is never actually executed and therefore neither is get_locale. Therefore the settings “Detect automatically” is effectively ignored and the payment window is shown in en_US, no matter the current WordPress locale.

This bug has existed since at least v1.7.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant