Skip to content

Commit a1e8c2b

Browse files
run stored textual settings through i18n to allow translating saved values. closes #793
1 parent 5a87264 commit a1e8c2b

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

includes/forms/class-form.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,8 @@ protected function load_messages(array $post_meta = [])
296296
$message_text = $post_meta[ 'text_' . $key ][0];
297297
}
298298

299-
$messages[ $key ] = $message_text;
299+
// run final value through gettext filter to allow translation of stored setting values
300+
$messages[ $key ] = __($message_text, 'mailchimp-for-wp');
300301
}
301302

302303
return $messages;

includes/integrations/class-integration.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,11 @@ public function get_label_text()
175175
$label = $default_options['label'];
176176
}
177177

178+
// run saved value through gettext filter
179+
// this allows people to use a plugin like Loco Translate to translate this message
180+
// without updating the setting itself
181+
$label = __($label, 'mailchimp-for-wp');
182+
178183
/**
179184
* Filters the checkbox label
180185
*

0 commit comments

Comments
 (0)