Page 1 of 1

Improvements in the area of ​​internationalization

Posted: Sun Jan 12, 2025 5:00 am
by mdsojolh444
Even though the “Multilingual” phase of the Gutenberg Project is still pending, there are still some interesting improvements in detail.

Checking the existence of translations
With the new has_translation() function, developers can efficiently check whether a translation exists - without having to load it first. This should improve performance, as the system avoids unnecessary loading times.

Improved warning system for early loading of translations
WordPress also introduces an improved warning system that informs you when translations are loaded too early. The core functions load_plugin_textdomain() and load_theme_textdomain() have been optimized to load translations only when they are actually needed. This not only avoids warning messages, but can also improve website performance.

Automatic translation of emails
Additionally, administrators will automatically receive emails in their twitter database preferred language if they use the official administrator email address as their personal email address.

The European Accessibility Act is coming: What it means for websites
Attention: You still have around nine months to get your online presence ready for the European Accessibility Act (EAA)! The four-year transition period for this Europe-wide accessibility directive ends on June 28, 2025. In this article, Jan Tissler gives you a compact overview of the EAA, learns the background and gives you practical tips on what you should definitely pay attention to now.

Improvements for developers
Update for Interactivity API
The Interactivity API receives an important update for dynamic page navigation. Developers can now more precisely control how the state of their interactive elements behaves during client-side navigation. The API introduces the new functions getServerState() and getServerContext() to respond specifically to changes in the page state. A typical use case is the development of interactive blocks such as quiz components: Here, developers can now specify exactly which properties should be updated when the page changes. The new functions return read-only objects that automatically update with the values ​​from the new HTML after each navigate() call.

Preview Options API
Using the Preview Options API, plugins can now extend the editor's preview functionality. For example, a newsletter plugin could add a dot to display a post as it would look in an email program. Or a social media plugin could show what the article preview looks like in various social networks. This is available in the post and page editor as well as the site editor.

Performance when registering multiple blocks
The new wp_register_block_metadata_collection() function optimizes performance when registering multiple blocks. Plugins can use it to bundle their block metadata in a single PHP manifest file instead of processing individual block.json files for each block. Integration into existing development workflows is extremely simple: The @wordpress/scripts package automatically generates the required manifest files using the new build-blocks-manifest command - a feature that only WordPress Core itself could use until now. Outlook: Support for themes is being discussed. There are plans to extend the concept to theme.json files, which would improve performance, especially with extensive theme configurations.

Plugin Template Registration API
With the new Plugin Template Registration API, developers can for the first time register their own block templates directly via their plugins and thus integrate them into the site editor. This important function was previously reserved for themes. The new API makes the process particularly easy with two central functions: register_block_template() can be used to create templates, while unregister_block_template() removes them again if necessary. Developers define the template name and can specify other parameters such as title, description, standard content and supported post types. The templates then appear seamlessly alongside all other templates in the site editor. At the same time, theme templates continue to take precedence over plugin templates: themes can therefore overwrite plugin templates if necessary.