I am translating a website into different languages, and I have the following problem:
Through the backend, user can select via a dropdown, a value (text string) from a list of 50 options. This dropdown is stored in a custom field (by the way, managed with ACF PRO).
When a user visits the translated version of the site, I would like to display the translation of that text string.
At first I thought that using
$options_obj = get_field_object('user_options'); $options_value = get_field('user_options'); $options_label = $options_obj['choices'][$options_value]; echo __($options_label, 'my_text_domain');
And I put the 50 text strings translation (corresponding to all the selectable options) in a po / mo file, but as we know this won't work. Gettext don't translate variables.
How I could get the translated string? Do you have any ideas? Thank you.