As WPML does not provide a solution to translate [choices] fields I would like to add a custom function to register it within WPML, however I am not a star in php, but I have below but it doesn't register it in WPML String Translation:
$field = get_field_object( 'type_of_property' ); // acf field with choices
if (!empty($field['choices'])) {
foreach( $field['choices'] as $choice ){
do_action( 'wpml_register_single_string', 'ACF Domain', 'name'.$choice , $choice );
$acflabel= apply_filters( 'wpml_translate_single_string', $choice, 'ACF Domain', 'name'.$choice, NULL );
echo ' - ' . $acflabel;
}
}
Is above method going into the right direction or do I need to call all the choices within the type_of_property field?