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 4 replies, has 2 voices.
Last updated by souhilH-2 4 years, 9 months ago.
Assisted by: Bruno.
Author | Posts |
---|---|
May 9, 2020 at 4:43 am #6093013 | |
souhilH-2 |
My site primary lang is English Secondary is french and Arabic too Please Check the screenshot....There is added checkout cities field in function.php file. we need to translate the cities filed Arabic too. how can i make it ? |
May 11, 2020 at 4:37 pm #6105757 | |
Bruno |
Thank you for contacting us. To translate strings, you must make them translatable using WordPress __() function: https://developer.wordpress.org/reference/functions/__/. For example: $cites = array( __('city 1', 'your-domain'), __('city 2', 'your-domain'), __('city 3', 'your-domain'), ); Please, let me know if I can help with any other questions you may have about it. I'll be happy to help. Thank you. |
May 12, 2020 at 10:08 am #6111271 | |
souhilH-2 |
Sorry I didn't get it,, And this is from Child themes' function.php file /** $cities = array( $city_args = wp_parse_args( array( $fields['shipping']['shipping_city'] = $city_args; wc_enqueue_js( " return $fields; } function filter_rest_allow_anonymous_comments() { |
May 12, 2020 at 3:27 pm #6114515 | |
Bruno |
You will need to wrap the strings in some function that allows you to translate them. You can see the official WordPress documentation: https://developer.wordpress.org/themes/functionality/internationalization/ Here is a small example (note the __() functions): /** * Change the checkout city field to a dropdown field. */ function ace_change_city_to_dropdown( $fields ) { $cities = array( __( 'Adrar', 'your-domain' ), __( 'Chlef', 'your-domain' ), ... In WPML > Theme and plugins localization, you can scan your plugin or theme (where this code is) and then translate them using String Translation. Please, let me know if I can help with any other questions you may have about it. I'll be happy to help. Thank you. |