Please make sure to update to WPML 4.3.5 and check our list of Known Issues before reporting

Hi, Amit here, I am the WPML Support Manager, our current ticket queue is high, update your WPML plugins and make sure you meet the minimal requirements for running WPML before reporting an issue please - many tickets are resolved doing that

Please look at our updated list of Known Issues and you can also use our support search to find helpful information and of course review our documentation before opening a ticket.

If you do need to open a ticket please make sure to provide us with all the needed information as described in this page

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.

This topic contains 14 replies, has 3 voices.

Last updated by Sumit 3 years, 1 month ago.

Assigned support staff: Bernat Torras.

Author Posts
September 6, 2016 at 3:38 pm #1063454

Martino

I'm going crazy about this.
I know I followed almost all the instructions to the letter and I tried many different solutions both from WPML and ACF forums...

What I need is simple:
keep the select value stored in the DB and print the "label" from the same value with the correct language.

I've a conditional option so I want the value to be the same in both language but I need the label to be printed in the correct language as you see in the screenshot.

Here
hidden link
at the beginning you see "Rossi".
In the english version it should show "Red" but it always shows the Italian version of the label.

I'm using this code:

<?php if( get_field('tipo') ): ?>
<?php $field = get_field_object('tipo');
$value = $field['value'];
$label = $field['choices'][ $value ]; ?>
<?php echo $label; ?><?php endif; ?>

I'm willing to use any workaround available, if there is one.
But I need to force the output in english.
Is there a way to manually enter it via functions.php?

This is a main issue,
I can't go online with the translated version until I'm able to fix this.

Thanks,
Martino

September 7, 2016 at 9:32 am #1064872

Bernat Torras

Hi Martino,

Thanks for contacting support and provide a detailed description of your issue, I'll do my best to help you with this! 🙂

Could you please check these following steps?

1- Go to WPML>Translation Management>Multilingual Content Setup> Custom Posts and make sure "Field Groups" are set to 'Translate'

2- Edit your Field Goup and translate it to your secondary language

3- Add the same options and fields (with same field names but with translated labels) as in the original Field Group

4- Edit your wine in secondary language and make sure that the fields specified in the translated Field Group appear translated

5- Set the proper value to 'tipo' field and save the wine again.

6- Open your wine in frontend and check if the label appears translated.

Hope it solves your issue! 🙂

You can find more documentation about it here: https://wpml.org/documentation/theme-compatibility/setting-wpml-advanced-custom-fields/

Thanks,
Bernat

September 7, 2016 at 9:59 am #1064963

Martino

Hi Bernat,
thanks for the reply.

Unfortunately that's exactly what I've been trying for 2 days and it always shows me the italian label.

Please check the screenshots.

I'm really out of option now.
The only thing that comes to my mind is to create a value like this:
rossi : <span class="it">Rossi</span><span class="en">Red</span>
and to hide them via css.

But it's terrible...

September 7, 2016 at 10:03 am #1065056

Bernat Torras

Hi Martino,

Ok, then I think we'll need to take a deeper look at your configuration. Could you provide us backend and ftp credentials to let us take a deeper look at your issue? I'll enable you a private form on your next reply where you'll be able to share these credentials with us in a secure and private way.

Thanks,
Bernat

September 7, 2016 at 2:19 pm #1065819

Bernat Torras

Hi Martino,

Thanks for providing the credentials. 🙂

I've taken a quick look at your Fields Group configuration and I see that your English 'tipo' options have Italian labels! This is probably the reason they're appearing in Italian on your English pages. The values seem right (in english) but the labels are in Italian.

You should change them to English or update your code to display the values instead of the label.

Please review it and let us know if it fixes your issue! 🙂

Thanks,
Bernat

September 7, 2016 at 3:29 pm #1066110

Martino

Hi,
I'm sorry but that would only worsen the problem:
as far as i know the structure is
value : label
so in my case it should be

rossi : Rossi
for italian

and
rossi : Red
for english

where "rossi" is the common value and "Rossi" / "Red" is the language specific label.

The value shouldn't be translated. If I translate it for sure I'd get the right label string but it would mess up other part of the site where the query looks like this:

<?php 
$args = array (
'post_type'     => 'vini',
'meta_key'		=> 'tipo',
'meta_value'	=> 'passito'
);
$query = new WP_Query( $args );
if ( $query->have_posts() ) { ?>

which know works as multilingual but if I translate the value it wouldn't work anymore.

Also the conditional logic on ACF would be lost and I'd have to replicate manually on the english version of the field group.

September 7, 2016 at 3:42 pm #1066171

Martino

As you can see here (only if logged in)
hidden link
I used the official code and printed both value and label.

The english version show same value and same label.
hidden link
but in the field group, for "tipo" in english, the label is "Red".

September 7, 2016 at 4:06 pm #1066212

Bernat Torras

Hi Martino,

You're right, I misunderstood it. The issue is pretty strange as I'm not able to replicate it on a fresh instal. I think our best option will be to get a backup of your site and debug it.

Could you please provide us a backup? I'd suggest you to install and use 'Duplicator' plugin to generate the backup (package). Please let us know once its generated so we can download it directly from your backend and start debugging it.

Thanks,
Bernat

September 8, 2016 at 10:56 am #1068098

Martino

Hi Bernat,
thanks for the reply.

Duplicator is installed and there is a fresh package available.
Let me know if you need anything else or if you are good to go for debugging.

Thanks,
m.

September 9, 2016 at 10:38 am #1070737

Bernat Torras

Hi Martino,

I've been testing your issue and I confirm that this is a compatibility issue with WPML and Advanced Custom Fields Pro. I've tried with Advanced Custom Fields (free version) and it seems there is no problem to get the translated field label.

I've escalated the issue to our compatibility team. They'll contact the authors and make sure our plugins are 100% compatible again. I can't provide you an estimate date yet as this process also depends on the authors cooperation, but I'm sure they'll fix it as quick as possible. Maybe you could temporary switch to free version while we are waiting for any update on this?

Thanks,
Bernat

September 9, 2016 at 10:53 am #1070804

Martino

Thank for the reply.
Unfortunately I'm using some features only available on ACF Pro (like conditional logic) and switching back would hurt my site, I fear.

Is there any way to force the translation of the string?
Like
- get the string (always in italian)
- pass that string to string translation
- print the correct string based on language
just looking for a quick workaround...

September 9, 2016 at 11:34 am #1070926

Bernat Torras

Hi Martino,

Sure, you could use something like this to register the label as a translatable string and show the proper translation depending on the current language:

echo __($label,'acf_translation');

Be sure to render the page once and then translate the value in WPML>Strings Translation.

Let me know if it helps 🙂

Thanks,
Bernat

September 9, 2016 at 1:37 pm #1071173

Martino

Wow,
that's perfect.

I had already all the strings translated for template need so everything works correctly without scanning.

Thanks!

September 9, 2016 at 2:01 pm #1071291

Bernat Torras

Hi Martino,

Glad to know its finally working! 🙂

In any case, Compatibility team will continue working with ACF authors until Pro version is fully compatible.

Thanks,
Bernat

October 19, 2016 at 11:48 am #1118568

Sumit
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hi,

I am Sumit from 2nd tier support.

I am sorry for the delay. Please go to WPML > Translation Management > Multilingual content setup: then look for "custom fields" and click on "Show system fields" you will see a new field "_tipo" set it to "copy" and make sure "tipo" and "_tipo" both set to "copy" then save it. It will fix the issue.

Thanks