Title: Make block translatable
Last modified: December 9, 2025

---

# Make block translatable

 *  Resolved [Guido](https://wordpress.org/support/users/guido07111975/)
 * (@guido07111975)
 * [6 months, 1 week ago](https://wordpress.org/support/topic/make-block-translatable/)
 * Hi,
 * Currently rebuilding my block to support Block API version 3 and have a question
   about making the block translatable.
 * In `edit.js` I import support:
 *     ```wp-block-code
       import { __ } from '@wordpress/i18n';
       ```
   
 * The dependency is added to my `index.asset` file:
 *     ```wp-block-code
       array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-i18n', 'wp-server-side-render'), 'version' => '123456789');
       ```
   
 * I add a translatable string like:
 *     ```wp-block-code
       label={ __( 'Attributes', 'text-domain' ) }
       ```
   
 * Should I do more, or does WP generate the proper language pack files now?
   I normally
   include a POT file generated with Poedit (free version), but it does not index
   the `edit.js` file. So I’m in doubt.
 * Guido

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Moderator [threadi](https://wordpress.org/support/users/threadi/)
 * (@threadi)
 * [6 months, 1 week ago](https://wordpress.org/support/topic/make-block-translatable/#post-18748578)
 * Yes, that looks correct so far.
 * **If your plugin is in the WordPress repository**, it will take care of the translation
   and generate all the necessary language files. In this case, you don’t need to
   provide any language files, just upload the generated block files.
 * **If, on the other hand, you want to generate the language files yourself**, 
   you must proceed as follows:
 * Prerequisite: you need the [WP CLI](https://wp-cli.org/) executable on the command
   line.
    1. Create the .pot files by executing the following command in the main directory
       of your plugin on the command line: `wp i18n make-pot . languages/your-plugin-
       slug.pot`
    2. Then make the translations as usual using PoEdit and upload the finished .po
       and .mo files to your plugin’s languages directory.
    3. Run this command: `wp i18n make-json languages` – this will generate the json
       files containing the translations for the blocks.
    4. Finally, run this command: `wp i18n make-php languages` – this will generate
       the optimized PHP files for your PHP files.
 * Then you need to integrate the language files:
 *     ```wp-block-code
       add_action( 'init', function() { load_plugin_textdomain( 'your-plugin-slug', false, dirname( plugin_basename( __FILE__) ) . '/languages' );});
       ```
   
 * See also: [https://developer.wordpress.org/cli/commands/i18n/make-json/](https://developer.wordpress.org/cli/commands/i18n/make-json/)
 *  Thread Starter [Guido](https://wordpress.org/support/users/guido07111975/)
 * (@guido07111975)
 * [6 months, 1 week ago](https://wordpress.org/support/topic/make-block-translatable/#post-18748746)
 * Great, the plugin is listed on org, so I’m very pleased to hear I don’t have 
   to follow all those extra steps.
 * Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Make block translatable’ is closed to new replies.

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 2 replies
 * 2 participants
 * Last reply from: [Guido](https://wordpress.org/support/users/guido07111975/)
 * Last activity: [6 months, 1 week ago](https://wordpress.org/support/topic/make-block-translatable/#post-18748746)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
