-
Notifications
You must be signed in to change notification settings - Fork 68
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
CSV export email messages for pt_BR
, zh_CN
, zh_TW
fall back to en_US
, instead of using user language
#10149
Comments
Some context about these codes:
Another potential bug in that logic – what language would we use for emails to a site/merchant using Portuguese (Portugal)? |
I believe the bug causing this |
Transact-platform-server on WPCOM doesn't have complete Portuguese (Portugal) translations, so "English (US)" is used as a the default fallback. It would be good to enumerate which translations we have available on server – filtering via translate.wordpress.com doesn't seem ideal. I know there is the following list in the client code, but is it accurate/maintained? woocommerce-payments/includes/class-wc-payments-utils.php Lines 1288 to 1305 in 5ba021b
|
pt_BR
, zh_CN
, zh_TW
fall back to en_US
, instead of using user language
Is this "sometimes" or does the bug consistently happen every time for these languages? I'm assuming that it happens every time, in which case this is |
In my testing using production transact-platform-server and Pressable, every time. |
Thanks for confirming! I strengthened the wording in reproduce steps 😁 |
It looks like there's an opportunity to remove a bunch of complexity here.
Example language entry and relevant fields from {
"langSlug": "pt-br",
"name": "Português do Brasil",
"wpLocale": "pt_BR",
} So, rather than maintaining our own mapping, we can get the |
Note: I've decided to reduce the complexity of this solution and move the language code conversion logic to PHP, within the REST API controllers in #10197. I have not found a PHP package/resource with the same list of WP Locale → WPCOM Language. However, in reducing the hardcoded list to only the three that are region-specific, the maintenance burden is reduced. This approach is common across A8C (GH search), of which I found Jetpack's to be the simplest, which I've adapted and used in #10197. |
Email notifications for CSV exports for the following supported languages pt_BR, zh_CN, zh_TW fall back to English.
To Reproduce
WP Admin -> Users -> Profile
Detailed observations here #10003 (review)
Additional context
convert_to_server_locale()
that roughly converts the WordPress core locale type to the server supported dash-separated locales.en_US
. This is likely a bug that occurs when the request query params are prepared in convert_to_server_locale().The text was updated successfully, but these errors were encountered: