Skip Navigation

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 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 -
- 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 5 replies, has 3 voices.

Last updated by Long Nguyen 1 year, 9 months ago.

Assisted by: Long Nguyen.

Author Posts
August 28, 2023 at 8:53 pm #14303345

chrisS-20

Hello, I have a custom ACF repeater field where some fields are numbers. I want these to use different numbers on the translated page(s). However, the number field does not show up in the Translation Editor.

I have tried both:
1. Switching the field group to Expert and setting that field to "Translatable"
2. As well as trying to make a new field that is "Text", but adding the number in there.

In the first case, it still did not show up in the Translation Editor. In the second case, if I add words to that new field, it shows up in the Translation Editor, but if I add just a number, it does not. Is this expected functionality? If so, how can I get it so that I can "translate" these number fields?

hidden link

August 29, 2023 at 6:35 am #14304085

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hi,

Thank you for contacting WPML support.

By default, the numeric value is not displayed in the Advanced Translation Editor (ATE).

Please try to add the code below to the file functions.php in the theme/child theme folder
❌ IMPORTANT: Please backup your database and website before proceeding ❌

/**
 * Allow translating numbers
 * @see https://wpml.org/forums/topic/wpbakery-post-grid-element-exclude-from-filter-list-category-reappears
 */
function wpmlsupp_7499_allow_translating_numbers( $is_translatable, $job_translate ) {
    $data = $job_translate['field_data'];
    if ( 'base64' === $job_translate['field_format'] ) {
        $data = base64_decode( $data );
    }
    if ( is_numeric( $data ) ) {
        return true;
    }
    return $is_translatable;
}
add_filter( 'wpml_tm_job_field_is_translatable', 'wpmlsupp_7499_allow_translating_numbers', 10, 2 );

and update the page > Update the translation. In ATE, you can search for the numeric value and translate it.

Please follow the documentation https://wpml.org/faq/how-to-translate-urls-shortcodes-and-html-attributes-using-the-advanced-translation-editor/

Let us know how it goes.

Regards,
Drazen

August 29, 2023 at 11:51 pm #14309455

chrisS-20

Hi, thanks for that snippet. I've found it to now be working only sometimes. To get those number fields to show up in ATE, I need to do some combination of resaving the page, re-editing the translation, clearing cache, etc. - multiple times, which isn't the most ideal. I also haven't been able to pinpoint exactly what combination of those actions makes it show up when searched in the ATE. This is the case for both existing pages, and brand new pages.

Any insights on why this may be is much appreciated!

August 30, 2023 at 4:23 am #14309845

Long Nguyen
WPML Supporter since 02/2022

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi Chris,

If you use the "Text" field and add only a number value, it is also considered a number and won't be displayed in Advanced Translation Editor (ATE).
But if you add some text value to the field, it is considered a string (text + number) and displayed in ATE properly.

After implementing the custom code, you need to re-translate the current pages. For new pages, you can just search for the number value in ATE to translate it.

I hope that makes sense.

August 30, 2023 at 6:00 pm #14315521

chrisS-20

Hi Long, thank you for the reply. Yes what you're saying does make sense. But my issue is that after adding that code, searching the number field is showing up only sometimes when I re-save/re-translate an existing page. While I actually haven't been able to get the number field showing up at all when searching in the ATE for new pages that I'm translating.

August 31, 2023 at 1:34 am #14316675

Long Nguyen
WPML Supporter since 02/2022

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi,

Please ensure the number field preference is set to Translate, refer to the documentation https://wpml.org/documentation/related-projects/translate-sites-built-with-acf/recommended-custom-fields-translation-preferences-for-acf-and-wpml/

If it still does not work, let me know a specific page that you are translating and a number value that does not display in ATE when searching for it. Then I would like to request temporary access (wp-admin and FTP) to your site to take a better look at the issue. It would be better to have a testing site where the issue is replicated. Your next reply is set to private to share the info.

❌ IMPORTANT: Please backup your database and website before proceeding ❌
You can use this plugin to create the backup: https://wordpress.org/plugins/duplicator/
✙ I would need your permission to de-activate and re-activate Plugins and the Theme to change configurations on the site if needed. This is also a reason the backup is critical.

Look forward to your reply.
Thanks

The topic ‘[Closed] Translation of ACF number field’ is closed to new replies.