Support » Plugin: WC - APG SMS Notifications » WPML Compatibility

Viewing 5 replies - 1 through 5 (of 5 total)
  • 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’]

    Plugin Author Art Project Group


    Thanks a lot for your reply Webdados.

    We’ll check your code and add it to WooCommerce – APG SMS Notifications.

    Kind regards.

    This is of course a very simplistic approach.

    Take a look at this: and this

    WPML also has a program to help developers achieve 100% compatibility.

    Plugin Author Art Project Group


    We provided 100% compatibility with all versions of WPML (WPML lower than version 3.2 and 3.2 or higher) on the next update of WooCommerce – APG SMS Notifications.

    Thank you for the help.

    Kind regards.

    You rock!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘WPML Compatibility’ is closed to new replies.