This is a must nowadays.
Basically the developer needs to:
1) Detect active WPML and WPML String Translation:
$wpml_active = function_exists('icl_object_id') && function_exists('icl_register_string');
2) Register the needed strings with WPML String Translation once they’re saved / set by the user:
– apg_sms_settings[mensaje_pedido]
– apg_sms_settings[mensaje_recibido]
– apg_sms_settings[mensaje_procesando]
– apg_sms_settings[mensaje_completado]
Something like this:
if ($wpml_active) {
icl_register_string('apg_sms', 'mensaje_pedido', $configuracion['mensaje_pedido']);
icl_register_string('apg_sms', 'mensaje_recibido', $configuracion['mensaje_recibido']);
icl_register_string('apg_sms', 'mensaje_procesando', $configuracion['mensaje_procesando']);
icl_register_string('apg_sms', 'mensaje_completado', $configuracion['mensaje_completado']);
}
This should be done immediately after the settings are saved to the database and you should ONLY register configurations that are really needed to be translated, and in your plugin I think this 4 are the only ones.
3) Now the user can set the messages in English on APG SMS settings screen (as he always has) and can then go to WPML > String Translation to translate them to whatever extra languages he has on his website.
4) When using this settings to send the message, you must make sure you’re getting the correct language. (Example on the apg_sms_procesa_estados function):
$mensaje_pedido = ( $wpml_active ? icl_translate('apg_sms', 'mensaje_pedido', $configuracion['mensaje_pedido']) : $configuracion['mensaje_pedido'] );
(...)
And then use the $mensaje_pedido variable on apg_sms_envia_sms / apg_sms_procesa_variables function instead of the original $configuracion[‘mensaje_pedido’]