Skip to content

Internationalisation#207

Open
OregSamSas wants to merge 22 commits intomainfrom
feature/186-i18n
Open

Internationalisation#207
OregSamSas wants to merge 22 commits intomainfrom
feature/186-i18n

Conversation

@OregSamSas
Copy link
Copy Markdown
Contributor

@OregSamSas OregSamSas commented Mar 26, 2026

Default view

image

Mobile view

image

Tasks

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Introduces i18next/react-i18next-based internationalisation into the shared common-frontend package and starts migrating the Disclaimer UI to use translated strings.

Changes:

  • Add i18next + browser language detection + react-i18next dependencies and an i18n initialization module with embedded EN/HU resources.
  • Update Disclaimer to use t() / <Trans /> for some disclaimer strings.
  • Adjust tsup config to avoid bundling node_modules dependencies.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
packages/common-frontend/tsup.config.ts Configures tsup to keep node_modules deps external (imported) during bundling.
packages/common-frontend/src/common/i18n.ts Adds i18next initialization and embedded EN/HU translation resources.
packages/common-frontend/src/client/components/Disclaimer.tsx Migrates parts of the Disclaimer UI from dictionary to i18next translations.
packages/common-frontend/package.json Adds i18next/react-i18next dependencies to the common frontend package.
package.json Adds i18next/react-i18next dependencies at the repo root.
package-lock.json Locks new i18n dependencies and their transitive deps.
apps/offline-frontend/src/App.tsx Imports the i18n init module as a side-effect.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@OregSamSas
Copy link
Copy Markdown
Contributor Author

@fraknoiadam Huge-huge sorry! I forgot to make this PR to a draft 😢 😳 I just wanted to make it available to follow my progress, but I'm far from doing anything mergable...

@OregSamSas OregSamSas marked this pull request as draft March 28, 2026 12:48
@OregSamSas OregSamSas self-assigned this Mar 28, 2026
…project's whole scope, finish localising Disclaimer and Header (added a language switcher as well)
@a-gondolkodas-orome a-gondolkodas-orome deleted a comment from Copilot AI Mar 28, 2026
@OregSamSas OregSamSas marked this pull request as ready for review March 28, 2026 21:51
@OregSamSas
Copy link
Copy Markdown
Contributor Author

Oh, it seems I messedc up with something, and reverting them won't work even 😭

@OregSamSas OregSamSas marked this pull request as draft March 28, 2026 22:35
Copy link
Copy Markdown
Member

@fraknoiadam fraknoiadam left a comment

Choose a reason for hiding this comment

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

It is a very good PR. This is a very hard task, but you managing it very well. I added some comments. Didn't check every file yet, especially not the language selector.

In online round we may don't want to enable multiple languages, only allow Hungarian. I don't know yet how that one could be resolved. Maybe it is better if the language selector is a different PR, and now hard code it to use Hungarian language. But this is just an idea, not a preference from my side.

Copy link
Copy Markdown
Member

@fraknoiadam fraknoiadam left a comment

Choose a reason for hiding this comment

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

I don't know whether you were waiting for reviews, but I had some time, so I made short review.

Also, please don't close the discussions. I will check whether they are implemented and close them.

{description}
<strong>Tudnivalók: </strong>Az "Új próbajáték kezdése" gombra kattintva próbajáték indul, ami a pontozásba nem számít bele. Bátran kérjetek próbajátékot, hiszen ezzel tudjátok tesztelni, hogy jól értitek-e a játék működését. Az "Új éles játék kezdése" gombra kattintva indul a valódi játék, ami már pontért megy.

<strong>{t('strategy:instructions')}</strong>{t('strategy:instructionDescription')}
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.

This one can be also in one t function. You can use formatting instead in the i18n.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Actually, I disagree, since these two strings are separated visually enough, and also, the header string might be reused somewhere else (I might even wrap the header into a different element)

.min(0, 'A válasz 0 és 9999 között van')
.max(9999, 'A válasz 0 és 9999 között van')
.required('Nem írtál semmi választ!')
.integer(t('error:integer'))
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.

I would write relay.error.integer

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I see your point from one point of view. But on the other hand, I think it shouldn't be relay specific. And I'd collect all errors under error.* since I think we should group messages in a way to have larger groups.

…x and one namespace in translation resources, remove redundant dependencies from root level package.json, define TS version for VS Code, add missing translation and rework string grouping, refrain from using dangerouslySetInnerHTML with <Trans />
…oad directly into JS from it, packaga.json was only reordered)
@OregSamSas OregSamSas marked this pull request as ready for review April 5, 2026 23:28
@OregSamSas
Copy link
Copy Markdown
Contributor Author

OregSamSas commented Apr 5, 2026

Also, please don't close the discussions. I will check whether they are implemented and close them.

Oh, sorry, didn't read your message through carefully enough. I resolve comments, if I implemented them in order to be free from them in VS Code editor, they're using a lot of space -- still if I've dealt with them already. But I'll stop doing this practice then of course. 🙇

@OregSamSas
Copy link
Copy Markdown
Contributor Author

OregSamSas commented Apr 5, 2026

Sadly, it doesn't seem to work on the online version yet...image

IDK why though, since translations are not app-related, they're in common-frontend
Update: I missed an npm run build, it seems

const teamstateString = localStorage.getItem(LOCAL_STORAGE_TEAMSTATE);
if (teamstateString === null) {
throw new Error('Váratlan hiba történt');
throw new Error(i18n.t('unexpected'));
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.

Suggested change
throw new Error(i18n.t('unexpected'));
throw new Error(i18n.t('error.unexpected'));

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.

3 participants