- สถานะ
- แก้ไขแล้ว
- แก้ไขใน
- 0.3.0
- ปลั๊กอิน/ธีมที่เกี่ยวข้อง
- Ninja Forms
- แท็กหัวข้อ
- Compatibility
ภาพรวมของปัญหา
Ninja Forms มีฟีเจอร์ใหม่ที่เรียกว่า Repeatable Fields ฟีเจอร์นี้ยังไม่สามารถแปลได้ในตัวแก้ไขการแปลขั้นสูงของเรา อย่างไรก็ตาม เรามีแผนที่จะทำให้รองรับการทำงานร่วมกันในเร็ว ๆ นี้
วิธีแก้ปัญหาชั่วคราว
- โปรดสำรองข้อมูลไซต์ของคุณอย่างครบถ้วนก่อนดำเนินการต่อ
- เมื่อคุณเตรียมข้อมูลสำรองพร้อมแล้ว เราจำเป็นต้องแก้ไขไฟล์ 2 ไฟล์:
- เปิด /wp-content/plugins/wpml-ninja-forms/classes/Hooks/NinjaForms/Strings.php
- ค้นหาบรรทัดที่ 76:
$package->registerField( $field->get_id(), $field->get_settings() );
- และเพิ่มต่อท้ายทันที:
// Register repeater fields strings if ( 'repeater' === $field->get_settings( 'type' ) && $field->get_settings()['fields'] ) { foreach ( $field->get_settings()['fields'] as $subfield) { $package->registerField( $subfield['id'], $subfield ); } } - จากนั้นเปิด /wp-content/plugins/wpml-ninja-forms/vendor/wpml/forms/classes/Translation/Package.php
- ค้นหาบรรทัดที่ 314:
return $data;
- และเพิ่มก่อนหน้าทันที:
// Translate repeater fields strings if ( $data['fields'] ) { foreach ( $data['fields'] as $key => $field ) { $forTranslation = $this->fieldProperties->forTranslation( $field ); foreach ( $forTranslation as $propertyName => $translationSettings ) { $stringValue = $this->fieldProperties->getValue( $field, $propertyName ); if ( $stringValue ) { if ( $this->isArray( $stringValue, $translationSettings ) ) { $field[ $propertyName ] = $this->translateOptions( $stringValue, $field['id'], $translationSettings ); } else { $data['fields'][$key][$propertyName] = $this->translateString( $stringValue, $field['id'], $propertyName ); } } } } }
ขั้นตอนถัดไป
เราจะแก้ไขปัญหานี้ในเวอร์ชันถัดไปของ Ninja Forms Multilingual