[bug]: Translations unusable and saved without plugin prefix

Aperta
#86 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 6 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
38/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
react, typescript

Direzione di ricerca

Start with the generated admin entry in src/cli/commands/plugin/init/files/admin.ts and inspect how PLUGIN_ID, useIntl(), and getTranslation relate to translations/en.json. Compare this with the prefixPluginTranslations usage linked in the issue. Done means getTranslation returns the correct string for the current locale with plugin-prefixed messages.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

issue: bug
What version of @strapi/sdk-plugin are you using?

Npm version
9.8.1
Node.js version
18.18.2
React version:
18.3.1
@strapi/sdk-plugin version
5.3.1

What's Wrong?

My understanding is that a plugin should use translations with the plugin name as a prefix, hence the use of PLUGIN_ID to get the translation.
It seems that before a prefixPluginTranslations function was used to "add" the prefix to each translated string (e.g. users-permissions plugin).

To Reproduce

We can see that this is not working because there's no functionality to add this prefix.
We can also check the messages object from the useIntl() hook to see how its being saved (after adding some strings to /translations/en.json for example).

Expected Behaviour

The getTranslation function should return the correct string for the current locale.

Lingua principale
TypeScript
Stelle
24
Fork
13
Merge medio
5g 3h
PR unite (30g)
5

Preparare l'ambiente

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di strapi/sdk-plugin

Tutte le issue di strapi/sdk-plugin

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.