Skip to content

Commit

Permalink
run stored textual settings through i18n to allow translating saved v…
Browse files Browse the repository at this point in the history
…alues. closes #793
  • Loading branch information
dannyvankooten committed Jan 23, 2025
1 parent 5a87264 commit a1e8c2b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion includes/forms/class-form.php
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,8 @@ protected function load_messages(array $post_meta = [])
$message_text = $post_meta[ 'text_' . $key ][0];
}

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

return $messages;
Expand Down
5 changes: 5 additions & 0 deletions includes/integrations/class-integration.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,11 @@ public function get_label_text()
$label = $default_options['label'];
}

// run saved value through gettext filter
// this allows people to use a plugin like Loco Translate to translate this message
// without updating the setting itself
$label = __($label, 'mailchimp-for-wp');

/**
* Filters the checkbox label
*
Expand Down

0 comments on commit a1e8c2b

Please sign in to comment.