跳到内容 跳到侧边栏
Sun Mon Tue Wed Thu Fri Sat
12:00 – 20:00 12:00 – 20:00 12:00 – 20:00 12:00 – 20:00 12:00 – 20:00 - -
- - - - - - -

支持人员时区: Asia/Karachi (GMT+05:00)

標籤: 

本主题包含 0 則回覆 ,有 1 voice 。

最后由 Fabio Borella 1 weeks, 5 days前 更新。

协助者:: Noman.

作者 帖子
29 10 月, 2025 于 10:44 上午 #17528919

Fabio Borella

Background of the issue:
I’m trying to use the WordPress i18n JavaScript library to load translations for strings within a Gutenberg/React block. The block dynamically renders a form and automatically registers its field labels in WPML for translation. These strings appear correctly in WPML’s translation management interface and are being translated by translators. Typically, translations are registered using the wp_set_script_translations() function, but since these strings are generated dynamically, I can’t pre-build a .json file for each language to provide to WordPress.

Symptoms:
I’m not sure how to load these translated strings in WordPress so they can be dynamically consumed by the React block.

Questions:
How can I load translated strings in WordPress for dynamically registered strings in a Gutenberg/React block?

主题'[關閉] Gutenberg block translation in JS for dynamically registered strings'已关闭,不接受新回复。