- الحالة
- محلولة
- الإضافة/القالب ذو الصلة
- Germanized for WooCommerce
- وسوم الموضوع
- Compatibility, WCML
نظرة عامة على المشكلة
عند استخدام Germanized for WooCommerce مع WPML، قد تواجه المشكلة التالية: لا تظهر السلاسل المرتبطة بمربعات الاختيار القانونية، مثل التسمية ورسالة الخطأ، في واجهة WPML ترجمة النصوص ولا يمكن ترجمتها.
حل بديل مؤقت
يُرجى التأكد من أخذ نسخة احتياطية كاملة لموقعك قبل المتابعة.
- أضف الكود التالي إلى ملف functions.php في قالبك.
// WPML Workaround for compsupp-8083 if ( class_exists('Sitepress') ) { add_action( 'update_option_woocommerce_gzd_legal_checkboxes_settings', function( $old_value, $new_value ) { $current_lang = apply_filters( 'wpml_current_language', null ); update_option( 'woocommerce_gzd_legal_checkboxes_settings_' . $current_lang, $new_value ); }, 10, 2 ); add_filter( 'pre_option_woocommerce_gzd_legal_checkboxes_settings', function( $default ) { $current_lang = apply_filters( 'wpml_current_language', null ); $translated = get_option( 'woocommerce_gzd_legal_checkboxes_settings_' . $current_lang ); return is_array( $translated ) ? $translated : $default; }); }
يضمن هذا الحل البديل المؤقت تخزين السلاسل النصية لمربعات الاختيار لكل لغة. بمجرد الإضافة:
- اذهب إلى «WooCommerce > إعدادات > Germanized > Legal checkboxes > (مربع الاختيار الخاص بك)» بلغتك الافتراضية، وأجرِ تعديلاً بسيطاً على التسميات، ثم احفظ.
- ثم بدّل إلى اللغة الثانوية باستخدام مبدل اللغة في شريط لوحة التحكم العلوي، وترجم التسميات، ثم احفظ.