This is the technical support forum for WPML - the multilingual WordPress plugin.
Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
- | 8:00 – 13:00 | 9:00 – 13:00 | 9:00 – 13:00 | 8:00 – 12:00 | 8:00 – 12:00 | - |
- | 14:00 – 17:00 | 14:00 – 18:00 | 14:00 – 18:00 | 13:00 – 17:00 | 13:00 – 17:00 | - |
Supporter timezone: Europe/Zagreb (GMT+01:00)
Tagged: Documentation request
This topic contains 26 replies, has 2 voices.
Last updated by Bruno Kos 5 months, 3 weeks ago.
Assisted by: Bruno Kos.
Author | Posts |
---|---|
May 6, 2024 at 11:46 am #15596991 | |
adrienR-5 |
Sure, you can proceed Bruno |
May 6, 2024 at 12:03 pm #15597154 | |
Bruno Kos Supporter
Languages: English (English ) German (Deutsch ) French (Français ) Timezone: Europe/Zagreb (GMT+01:00) |
Escalated to Compatibility team |
May 8, 2024 at 12:37 pm #15606131 | |
Bruno Kos Supporter
Languages: English (English ) German (Deutsch ) French (Français ) Timezone: Europe/Zagreb (GMT+01:00) |
Can you try this: - Go to WPML > String Translation It would seem this is the only solution for translating dropdown items. |
May 8, 2024 at 6:07 pm #15607507 | |
adrienR-5 |
Hello Bruno, All of them are translated inside WPML > String Translation. Could you make the english translation working on this test website, that's all I'm asking, so I can replicate that to the live website. Nothing so far seems to work to translate all of these custom fields. Thanks! |
May 9, 2024 at 7:26 am #15608938 | |
Bruno Kos Supporter
Languages: English (English ) German (Deutsch ) French (Français ) Timezone: Europe/Zagreb (GMT+01:00) |
But is it not working already? URLs and ticket seems to be correct now on hidden link? |
May 9, 2024 at 8:39 am #15609444 | |
adrienR-5 |
We were talking about the subfield "description" of my Meta Box group field, those are still the "FR" translation and not the "EN" I added inside string translation. |
May 9, 2024 at 12:13 pm #15610327 | |
Bruno Kos Supporter
Languages: English (English ) German (Deutsch ) French (Français ) Timezone: Europe/Zagreb (GMT+01:00) |
I am checking this with our 2nd tier as well, will keep you posted. |
May 14, 2024 at 5:44 am #15623267 | |
Bruno Kos Supporter
Languages: English (English ) German (Deutsch ) French (Français ) Timezone: Europe/Zagreb (GMT+01:00) |
We are unsure why it works with the title, but not with the description. The solution we suggest is to use the option_XX filter to register these sub-values as a new string and then translate the values on front-end. The workaround provided involves modifying the global settings option to handle translations using WPML in your WordPress site's functions.php file. This method registers certain strings for translation and applies those translations dynamically. Here’s how you can apply this workaround: 1. Add the following code to your functions.php file: // WPML Workaround for compsupp-7350 function modify_global_settings_option($option) { if ( class_exists('Sitepress') ) { // Set the keys and sub-keys to register/translate $keys_to_modify = [ //'header__live_news' => ['header__live_news_titre', 'header__live_news_description'] 'header__live_news' => [ 'header__live_news_description'] ]; // Loop through each specified parent key foreach ($keys_to_modify as $parent_key => $sub_keys) { // Check if the parent key exists in the option if (isset($option[$parent_key]) && is_array($option[$parent_key])) { // Loop through each item under the parent key foreach ($option[$parent_key] as $index => $item) { // Loop through each specified sub-key for modifications foreach ($sub_keys as $sub_key) { // Check if the sub-key exists in the item and modify it if (isset($item[$sub_key])) { $string = $item[$sub_key]; $textdomain = 'WordPress'; $string_name = 'Option-string:'.substr($string, 0, 80); if ( apply_filters('wpml_default_language', NULL ) == apply_filters( 'wpml_current_language', NULL )) { do_action( 'wpml_register_single_string', $textdomain, $string_name, $string ); } // Apply the translation to the string $result = apply_filters('wpml_translate_single_string', $string , $textdomain, $string_name); $option[$parent_key][$index][$sub_key] = $result; } } } } } } return $option; } add_filter('option_global-settings', 'modify_global_settings_option'); 2. Visit the page with the strings in the original language to register the strings. 3. Go to WPML String Translator and translate the strings. The textdomain will be 'WordPress' and the name will be formatted like 'Option-string:FR - Header | Live news - Description2'. 4. Adjust the language settings of the string as necessary, for example, changing from French to English. This should allow for the dynamic registration and translation of specified strings within your global settings. Does it work? |
May 17, 2024 at 9:15 am #15638414 | |
adrienR-5 |
I don't see myself having to do this on every MB custom fields I have in my settings page + going with the WPML string translation... Let me know when a 100% integration is done between MB and WPML, at this point that's the best solution for me... In the meantime I'll duplicate all my MB custom fields in my settings page (for every language)... Thanks! |
May 20, 2024 at 12:09 pm #15645539 | |
Bruno Kos Supporter
Languages: English (English ) German (Deutsch ) French (Français ) Timezone: Europe/Zagreb (GMT+01:00) |
We will probably need cooperation from MetaBox developers about this, I sent all this information to our compatibility team to see if we can push these changes. |
May 21, 2024 at 10:05 am #15649511 | |
adrienR-5 |
I think Meta Box team will gladly help on this. |
May 21, 2024 at 12:38 pm #15650492 | |
Bruno Kos Supporter
Languages: English (English ) German (Deutsch ) French (Français ) Timezone: Europe/Zagreb (GMT+01:00) |
We suggest you contact Metabox support as this may help speed up the process of such integration (as they will have to implement this into their plugin). |