• Kyle Cho

    (@feelool007)


    Hi there,

    I currently develop my own block editor plugin and follow this guidance to provide translations. There’s a directory called languages containing all translation files such as .mo and .json. Everything works fine before upgrading to 6.5.

    After upgrading to 6.5, my own translations aren’t loaded and fallback to the default language (English). I’ve tried the suggestion in this post, using translation_file_format and load_translation_file filters, but nothing works for me.

    Could anyone help?

    • This topic was modified 6 months ago by Kyle Cho.
Viewing 1 replies (of 1 total)
  • I also use the following code in my plugins in 6.5 without any problems:

    Per init-Hook:

    load_plugin_textdomain( 'domain-slug', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );

    And:

    add_action( 'enqueue_block_editor_assets', function() {
      wp_set_script_translations( 'script-handle-editor-script', 'text-domain', trailingslashit( plugin_dir_path( __FILE__ ) ) . 'languages/' );
    } );

    Make sure that the language files are named correctly. This was always a stumbling block for me in the beginning.

    The correct name would be e.g.: plugin-slug-de_AT.mo

    Also note that you don’t have to make the effort for plugins that are added to the WordPress repository. WordPress and the repository take care of everything for them. Translations are done there via https://translate.www.ads-software.com.

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