You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using WPML, MyParcel, and WooCommerce on our site, the German version encounters an exception whenever a user tries to add something to the cart or clicks on the checkout button.
I'm not sure if this issue is specific to WPML or if it also occurs when the site is set to German without WPML.
The exception occurs because the plugin attempts to load the German translation file de.json from the following directory: /wp-content/plugins/woocommerce-myparcel/config/pdk/translations However, the de.json file does not exist.
As a temporary solution, we copied en.json and renamed it to de.json, which resolved the issue for our German site.
Suggestion for Improvement
Add a German translation file:
It is surprising that there is no German translation, especially since many webshops also deliver to Germany. The plugin already includes English and French translations.
Implement a fallback language:
Instead of throwing an exception when a translation file is missing, the plugin should default to English (or another available language) to prevent site-breaking errors.
I hope you will consider adding a German translation and implementing a fallback mechanism in a future update.
Reproduction steps
Set up a WordPress site with WPML, WooCommerce, and the MyParcel plugin, with Dutch as the main language and German as a translation.
Alternatively, this issue might also occur on a standalone German WordPress site with WooCommerce and MyParcel (untested, but based on the exception, it's possible that it does not work on there either).
Create a product and translate it into German.
Go to the frontend of the product in the German translation.
Try to add the product to the cart.
You will encounter an exception.
Relevant log output
PHP Fatal error: Uncaught InvalidArgumentException: File "/wp-content/plugins/woocommerce-myparcel//config/pdk/translations/de.json" does not exist. in /wp-content/plugins/woocommerce-myparcel/vendor/myparcelnl/pdk/src/Base/FileSystem.php:46 Stack trace: #0 /wp-content/plugins/woocommerce-myparcel/vendor/myparcelnl/pdk/src/Language/Service/AbstractLanguageService.php(56): MyParcelNL\Pdk\Base\FileSystem->get() #1 /wp-content/plugins/woocommerce-myparcel/vendor/myparcelnl/pdk/src/Base/Repository/Repository.php(52): MyParcelNL\Pdk\Language\Service\AbstractLanguageService->MyParcelNL\Pdk\Language\Service\{closure}() #2 /wp-content/plugins/woocommerce-myparcel/vendor/myparcelnl/pdk/src/Language/Repository/LanguageRepository.php(17): MyParcelNL\Pdk\Base\Repository\Repository->retrieve() #3 /wp-content/plugins/woocommerce-myparcel/vendor/myparcelnl/pdk/src/Language/Service/AbstractLanguageService.php(55): MyParcelNL\Pdk\Language\Repository\LanguageRepository->getTranslations() #4 /wp-content/plugins/woocommerce-myparcel/vendor/myparcelnl/pdk/src/Language/Service/AbstractLanguageService.php(77): MyParcelNL\Pdk\Language\Service\AbstractLanguageService->getTranslations()
Additional context
No response
The text was updated successfully, but these errors were encountered:
Thanks for submitting this issue! The plugin should actually use english as a fallback language if the language is not supported (which is the case for Germany at this point in time). Unfortunately it looks like there was an issue in our underlying plugin development kit, which I've fixed. Once it's gone through our review & testing process it'll be included in the next version of our plugin(s).
MyParcel plugin version
5.3.0
WooCommerce version
9.6.1
WordPress version
6.7.2
PHP version
8.2
What went wrong?
When using WPML, MyParcel, and WooCommerce on our site, the German version encounters an exception whenever a user tries to add something to the cart or clicks on the checkout button.
I'm not sure if this issue is specific to WPML or if it also occurs when the site is set to German without WPML.
The exception occurs because the plugin attempts to load the German translation file
de.json
from the following directory:/wp-content/plugins/woocommerce-myparcel/config/pdk/translations
However, thede.json
file does not exist.As a temporary solution, we copied
en.json
and renamed it tode.json
, which resolved the issue for our German site.Suggestion for Improvement
It is surprising that there is no German translation, especially since many webshops also deliver to Germany. The plugin already includes English and French translations.
Instead of throwing an exception when a translation file is missing, the plugin should default to English (or another available language) to prevent site-breaking errors.
I hope you will consider adding a German translation and implementing a fallback mechanism in a future update.
Reproduction steps
Relevant log output
Additional context
No response
The text was updated successfully, but these errors were encountered: