• Good day.

    I’m creating a new block theme and thinking about correct way to make it localizable. I’ve found this proposal – https://github.com/WordPress/gutenberg/issues/27402 – but looks like it is not done yet.

    Is there any way to to translate the blocks’ content using something like __(‘Text’, ‘domain’) functions?

    Thank you for any suggestions,
    Serge

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter Serge Gusev

    (@serge-gusev)

    Re: Its all described in the handbook

    I’m not sure you understand me. I do not mean translating *.php or js files. I’m talking about block content.

    For example, I’m creating header using Gutenberg editor and adding a Paragraph block with content: “Yesterday all my trouble seemed so far away”. It is saved in the database.

    How can I add this content to a pot file?

    Wordpress itself does not (currently) support multilingualism for content. Not at any point. For that, there are plugins like https://wpml.org or https://www.ads-software.com/plugins/polylang/ – they allow you to do these translations, each in their own way.

    Just reading over this and wondering if everyone is on the same page.

    @serge-gusev, you said you were building a theme but also said you were saving blocks via the editor. Do you mean that you are developing the theme in the editor but will eventually want to store the block code in your theme templates?

    If so, it is possible to localize text strings from the theme. If this is what you’re going for, I can help with that.

    Thread Starter Serge Gusev

    (@serge-gusev)

    Re: but will eventually want to store the block code in your theme templates?

    No, I’m going to store data in the database (and scripts) and generate them during the theme activation.

    Really, I know to to generate .po files for PHP and JavaScript. I need solution for localization Gutenberg blocks stored in the database.

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