Skip to content
This repository was archived by the owner on Feb 29, 2024. It is now read-only.

Commit df2ffc6

Browse files
committed
fix save acf fields
fix translate strings with zero fix save string with zero
1 parent aa45b2b commit df2ffc6

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

core/vendor/class-wpm-acf.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ public function save_value( $value, $post_id, $field ) {
186186
}
187187

188188
remove_filter( "acf/load_value", 'wpm_translate_value', 0 );
189-
$old_value = get_field( $field['name'], $post_id );
189+
$old_value = get_field( $field['name'], $post_id, false );
190190
add_filter( "acf/load_value", 'wpm_translate_value', 0 );
191191
$old_value = wpm_value_to_ml_array( $old_value );
192192
$new_value = wpm_set_language_value( $old_value, $value, $acf_field_config );

core/wpm-translation-functions.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ function wpm_translate_string( $string, $language = '' ) {
112112
$language = wpm_get_language();
113113
$default_locale = wpm_get_default_locale();
114114

115-
if ( empty( $strings[ $language ] ) && get_option( 'wpm_show_untranslated_strings' ) ) {
115+
if ( ( '' == $strings[ $language ] ) && get_option( 'wpm_show_untranslated_strings' ) ) {
116116
return $strings[ $languages[ $default_locale ] ];
117117
}
118118

@@ -250,7 +250,7 @@ function wpm_ml_array_to_string( $strings ) {
250250

251251
$languages = wpm_get_all_languages();
252252
foreach ( $strings as $key => $value ) {
253-
if ( in_array( $key, $languages, true ) && ! empty( $value ) ) {
253+
if ( in_array( $key, $languages, true ) && ( '' != $value ) ) {
254254
if ( wpm_is_ml_string( $value ) ) {
255255
$string = wpm_translate_string( $string );
256256
}

readme.txt

+6-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Contributors: valexar
44
Tags: localization, multilanguage, multilingual, translation, multilang
55
Requires at least: 4.7
66
Tested up to: 4.8.1
7-
Stable tag: 1.5.3
7+
Stable tag: 1.5.4
88
License: GPLv2 or later
99
License URI: http://www.gnu.org/licenses/gpl-2.0.html
1010

@@ -139,6 +139,11 @@ Compatible with multisite not tested.
139139

140140
== Changelog ==
141141

142+
= 1.5.4 =
143+
* fix save acf fields
144+
* fix translate strings with zero
145+
* fix save string with zero
146+
142147
= 1.5.3 =
143148
* fix switch language url for ssl
144149
* fix edit email in newsletter

wp-multilang.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
99
* Text Domain: wpm
1010
* Domain Path: /languages
11-
* Version: 1.5.3
11+
* Version: 1.5.4
1212
*
1313
* @package WPM
1414
* @category Core
@@ -42,7 +42,7 @@ final class WP_Multilang {
4242
*
4343
* @var string
4444
*/
45-
public $version = '1.5.3';
45+
public $version = '1.5.4';
4646

4747
/**
4848
* The single instance of the class.

0 commit comments

Comments
 (0)