JavaScript strings are never translated, as `wp_set_script_translations` is never called
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 72/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- php, typescript, wordpress
- Ambito
- frontend, internationalization
Direzione di ricerca
Inizia ispezionando i percorsi di enqueue in class-editor-sidebar.php, class-dashboard-widget.php, class-post-list-stats.php, class-recommended-widget.php e nel codice della dashboard e della telemetria. Controlla ogni script handle inserito manualmente e verifica la riproduzione in Post Editor con una locale del sito tradotta. Il lavoro è completato quando le stringhe JavaScript in queste aree sono tradotte e il blocco Recommendations esistente e le traduzioni PHP continuano a funzionare.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the bug
The plugin marks its JavaScript strings as translatable and declares Text Domain: wp-parsely, but never calls wp_set_script_translations() for any script it enqueues itself. That call is what loads the .json translation files WordPress delivers for JavaScript, so without it every one of those strings renders in English regardless of the site's language.
There are 359 __() and 7 _n() calls across 74 TypeScript files. By surface:
| Location | Calls | Translated? |
|---|---|---|
src/content-helper |
333 | No |
src/js |
4 | No |
src/blocks |
22 | Yes |
The Recommendations block is fine because it is registered through register_block_type() with a block.json carrying "textdomain": "wp-parsely", and WordPress wires up script translations automatically in that case. Every other surface is enqueued by hand:
class-editor-sidebar.php— the Content Intelligence Editor Sidebarclass-dashboard-widget.phpclass-post-list-stats.phpclass-recommended-widget.php- the dashboard page and telemetry scripts
None of them follow their wp_enqueue_script() with a wp_set_script_translations().
PHP strings are unaffected — those load normally.
To Reproduce
- Set the site language to any locale with a
wp-parselytranslation. - Open the Post Editor and expand the Parse.ly sidebar.
- Every label, button and message is in English, while the surrounding WordPress UI is translated.
Expected behavior
Strings marked translatable are translated. For a wp.org-distributed plugin this needs no build step and no .pot in the repository — WordPress downloads the JSON from translate.wordpress.org, and each enqueued handle needs:
wp_set_script_translations( static::get_script_id(), 'wp-parsely' );
If translating the JavaScript UI is deliberately not a goal, the opposite is worth doing: the __() wrappers are misleading as they stand, since they imply a translation path that does not exist.
Environment
- wp-parsely 3.23.7 and earlier
Additional context
This is the mechanism behind #4546. The tone and persona labels were always marked translatable, but lived in JavaScript where translation is inert, so they were always English in practice. #4492 makes PHP the source of that vocabulary, where translation does work — which is what turned Formal into Formell and made a long-dormant inconsistency suddenly depend on the site's locale.
- Lingua principale
- PHP
- Stelle
- 67
- Fork
- 38
- Merge medio
- 1g 5h
- PR unite (30g)
- 79
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Parsely/wp-parsely
-
Bug Feature: Engagement Boost wp-parsely
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
Parsely/wp-parsely#4856 ·
I maintainer di solito rispondono entro 1 giorno
-
Bug Feature: Engagement Boost wp-parsely
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
Parsely/wp-parsely#4855 ·
I maintainer di solito rispondono entro 1 giorno
-
Bug Feature: Engagement Boost wp-parsely
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
Parsely/wp-parsely#4854 ·
I maintainer di solito rispondono entro 1 giorno
-
wp-parsely
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
Parsely/wp-parsely#4753 ·
I maintainer di solito rispondono entro 1 giorno
-
Bug wp-parsely
Difficoltà 4/5 3-5 giorni Idoneità per principianti 58/100
Parsely/wp-parsely#4663 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di Parsely/wp-parsely
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
parime/glpi-iso27001-management#1165 ·
I maintainer di solito rispondono entro 1 giorno
-
15.0
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
opnsense/plugins#5976 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
open-telemetry/opentelemetry-php-distro#176 ·
I maintainer di solito rispondono entro 2 giorni