Support » Plugin: Product Add-Ons WooCommerce » Javascript translations

  • Hi!

    I created .po and .mo files for the French translation.
    I put them in the plugin languages folder.

    Everything seems translated frontend, but backend the strings which are in the .js files, like adminGroups.js or adminGroup.js are not.

    Are you sure you have organized the localization correctly?

    Regards

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author bizswoop

    (@bizswoop)

    Thanks for reaching out about the translation support for the plugin.

    The plugin uses the WordPress.org translation platform workflow to load and generate the translations in the back-end admin and front-end.

    All translations to render correctly in the back-end admin need to be checked into the French repo for the plugin: https://translate.wordpress.org/locale/fr/default/wp-plugins/product-add-ons-woocommerce/

    Once the translations are 95% complete for the language under the Stable strings, when the WordPress General language settings are set to French, the translations for the plugin will automatically import and display for both the front-end and back-end admin strings.

    For example, Slovak has provided translations for the plugin, now when the language is set under the General settings, the translations are displaying in the back-end admin from the WordPress.org translation platform database, as shown as reference: https://ibb.co/NWdvs6g

    We’d love for you to contribute the French translations to the WordPress.org translation platform allowing other community members to enjoy the plugin in their native French language. The French polyglots team, https://make.wordpress.org/polyglots/teams/?locale=fr_FR can also help support the translation and approval of the translations to make them available for the plugin.

    We hope this helps clarify the translation process for the plugin and we look forward to seeing the French language translated for the community. Thank you for the support.

    Hi,

    I know this because I am an active member of the French Team.

    I just want to test the integration of translations in react.
    For that, adding a .mo file in the lang folder should work.
    However, this partially works, since the .js files are not translated.

    Regards

    Plugin Author bizswoop

    (@bizswoop)

    Great to hear you are an active member of the French Team.

    The plugin uses JSON files for the .js files from the supported wp-i18n JavaScript package workflow for internationalization support. As outlined in this post: https://make.wordpress.org/core/2018/11/09/new-javascript-i18n-support-in-wordpress/ and similar to the workflow used by block editor to load translation .js files for translation as outlined here: https://developer.wordpress.org/block-editor/developers/internationalization/#load-translation-file for the plugin.

    The translation files must be in the JED 1.x JSON format. Using the process to make a json file here: https://developer.wordpress.org/cli/commands/i18n/make-json/

    As a result the file name sample would be the following for product add-ons of the js translations:
    product-add-ons-woocommerce-fr_FR-[md5].json

    I hope that helps clarify how we are handling the translation files for the plugin. As part of the French Team, if you have recommendations on a different process we should be following, please let us know, we’d be happy to review and understand how it could be supported differently in the future.   

    Hi,
    Thank you for your answer.

    I don’t understand then why there is this in your code:

    
    wp_set_script_translations( 'za_group', 'product-add-ons-woocommerce', plugin_dir_path( PLUGIN_ROOT_FILE ) . 'lang' );

    or

    dirname (plugin_basename (PLUGIN_ROOT_FILE)). '/ lang /'

    If I create this lang folder in the plugin and put the .mo files there, they are not fully taken into account.

    (By the way, I’m telling you an error in type.php, line 15:
    the <p> tag is not properly closed.)

    Regards.

    Plugin Author bizswoop

    (@bizswoop)

    Yes, included in our code we support adding the language files to the Product Add-on plugin directory, if you include the /lang folder. Or you can also add the language files to the WordPress language directory.

    If you are adding the .mo files, unfortunately, as we mentioned before the .mo format is not supported for translations. For JS translations, you need to use the JED 1.x JSON format. If you add the JED 1.x JSON format to the language directory translations will be taken into account.

    Thank you for sharing the issue on <p> tag not properly closed. We appreciate it. We’ve now pushed a fix already for this issue, if you upgrade to 2.0.13 this tag is fixed.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.