Conversation
Samk13
left a comment
There was a problem hiding this comment.
Thanks for this @SarahW91! this is a nice addition, enabling translations definitely makes sense.
Before merging, I'd prefer we align this a bit more with what we already have in invenio-app-rdm:
- use the more recent compileCatalog.js pattern (async/await, proper error handling, normalized output, etc..),
- generate the translations index (like _generatedTranslations.js) instead of maintaining messages/index.js manually.
This will keep things consistent across packages and avoid extra maintenance later on.
| @@ -0,0 +1,38 @@ | |||
| // This file is part of React-Searchkit | |||
There was a problem hiding this comment.
Could we align the scripts with the implementation we already use in invenio-app-rdm? https://github.com/inveniosoftware/invenio-app-rdm/blob/master/invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/scripts/compileCatalog.js
| @@ -0,0 +1,69 @@ | |||
| import TRANSLATE_AF from "./af/translations.json"; | |||
There was a problem hiding this comment.
There was a problem hiding this comment.
What I don't quite get is where the *.po files and language configs are coming from. Are they pulled from Transifex? because there seems to be no step to automatically generate them otherwise
There was a problem hiding this comment.
Yes, without Transifex yet, the new language has to be bootstrapped locally first.
In the current Invenio setup, init_catalog only adds the language to package.json; it does not create the .po file automatically.
Then extract_messages updates the extracted JSON and generates the English source files (translations.pot / messages/en/messages.po).
For any additional language, you still need to create messages//messages.po locally first, and only then compile_catalog can convert it to translations.json.
So the local dev flow is basically:
npm run init_catalog lang <lang>
npm run extract_messages # create/bootstrap messages/<lang>/messages.po
npm run compile_catalog lang <lang>Once Transifex is set up, that manual step (dev work) gets replaced by pulling the .po files from Transifex.
It makes me wonder where all these languages listed in this PR are coming from. Were they generated automatically, or are they copied manually from another package?
There was a problem hiding this comment.
I copied those over from https://github.com/inveniosoftware/react-invenio-deposit
c5af22a to
e87f8a6
Compare
Description
I think it would be beneficial to enable translations for this module. There are some rather prominent components, e.g.
EmptyResultsthat can't be translated otherwise.Adding the necessary scripts and dependencies adds this ability, e.g.:
What do you think? If you are generally okay with this, I'll start marking all strings in the module as translatable.
Checklist