I18n Translations API for Yoopta #438
Replies: 1 comment
-
From what I've seen:
Currently, I see we add the default label directly in the template, for example in BlockOptions.ts:
I propose we treat all the default labels as translations. It will be easier to read, we can have all labels in one place, we could keep adding translations in another languages to give them out of the box and as a bonus if the user sets as the current language a language they are not providing, the keys will be shown instead, making it way easier for context translation. So the example would look like this:
In my original approach, I added a i18n folder to each plugin, with the default locales for every language we wanted to add. We could start by only adding English for now. Let me know your thoughts, I think having a TODO list will help us to stay organised. |
Beta Was this translation helpful? Give feedback.
-
I18n API for Yoopta
Hello everybody!
This discussion concerns frequently requested feature, the internationalization (i18n) for the editor.
At the moment, active work is underway in this PR (it is already at the final stage).
I would like to hear feedback from you and the community on the API for using i18n in Yoopta-Editor
@yoopta/i18n
- new package for i18nIt has the export of the following useful modules:
withTranslation
- required method for extending the editor's work with i18nuseTranslation
- hook for using language switching methods and translating texts by keysI18nYooEditor
- extended type forYooEditor
Usage
Example of translation data (example for
@/locales/es.json
)I18n API
With the withTranslation extension for the editor, Yoopta will have the following additional methods and keys:
Beta Was this translation helpful? Give feedback.
All reactions