Support

Account

Home Forums General Issues Can't display WPML translated select choices

Solved

Can't display WPML translated select choices

  • Hi,

    I’m using WMPL 3.3.6 and ACF 4.4.4

    I translated the choices of a select field but when calling get_field(‘field_name’) or get_field_object(‘field_name’)[‘value’] It always displays the original non-translated value.

    It outputs the translated version of label by calling get_field_object(‘field_name’)[‘label’] but the value always displays untranslated.

    Am I doing something wrong or is this known to not work?
    Thank you in advance for your help.

    Niko

  • Hi @optionniko

    The choices value is not supposed to be translated. It’s like the ID of the choices that is saved in the database. Translating this kind of thing will mostly create confusion in the future. That’s why you have the label.

    Also, could you please check this page: https://www.advancedcustomfields.com/resources/multilingual-custom-fields/?

    Thanks!

  • Hi James,

    let me briefly explain my situation where an option to translate choices would be more than welcome. I use ACF select fields mainly for products (woocommerce). I have a select field for product’s materials:
    – mat_1 : Aluminum
    – mat_2 : Stainless steel
    – mat_3 : Glass and aluminium

    This is for my default English language, but I also need the same choices for Slovenian language.

    But fortunately I’ve found a solution that worked out great:
    First I set all fields to Copy (in Edit Field Group) and Copy from translation to original (in WPML Translation Management/Multilingual Content Setup).
    Then I wrote if ICL_LANGUAGE_CODE != ‘en’ to output translated string from POT file otherwise normally echo get_field().

    Thanks!

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Can't display WPML translated select choices’ is closed to new replies.