Skip to content

Enable translations#296

Open
SarahW91 wants to merge 15 commits intoinveniosoftware:masterfrom
ulbmuenster:enable_translations
Open

Enable translations#296
SarahW91 wants to merge 15 commits intoinveniosoftware:masterfrom
ulbmuenster:enable_translations

Conversation

@SarahW91
Copy link
Copy Markdown

@SarahW91 SarahW91 commented Apr 2, 2026

Description

I think it would be beneficial to enable translations for this module. There are some rather prominent components, e.g. EmptyResults that can't be translated otherwise.

Adding the necessary scripts and dependencies adds this ability, e.g.:

image

What do you think? If you are generally okay with this, I'll start marking all strings in the module as translatable.

Checklist

@SarahW91 SarahW91 requested review from Samk13 and carlinmack April 2, 2026 13:30
@SarahW91 SarahW91 marked this pull request as draft April 2, 2026 13:32
@SarahW91 SarahW91 marked this pull request as ready for review April 2, 2026 13:32
Copy link
Copy Markdown
Member

@Samk13 Samk13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -0,0 +1,69 @@
import TRANSLATE_AF from "./af/translations.json";
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Member

@Samk13 Samk13 Apr 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SarahW91 SarahW91 force-pushed the enable_translations branch from c5af22a to e87f8a6 Compare April 13, 2026 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants