Skip to content

Conversation

@Catizard
Copy link
Collaborator

This is a proposal for how we implement the i18n support for the in-game notifications:

  • Reuse the UIResources.properties & ResourceBundle mechanism. This commit adds 3 messages for example, one is a simple welcome message, two are IR send success/failed messages.
  • Introducing a simple structure to referencing the message key located at property files. See here. Although here's only one level, but it can be nested for more complex modules.

@Catizard Catizard requested a review from seraxis September 29, 2025 01:40
@Catizard Catizard force-pushed the feat/i18n_notification branch 2 times, most recently from 968881c to 9660e21 Compare November 23, 2025 04:10
@Catizard
Copy link
Collaborator Author

I uploaded a change as a new proposal for error messages, which includes a way to automatically setup and print error code. Demanding further discussion.

@Catizard Catizard changed the base branch from main to feat/log-rework November 23, 2025 04:17
@Catizard
Copy link
Collaborator Author

In most recent commit 0eb5b5f I filled several requirements from #159:

  • There will be two log files: a user facing, and developer facing log file
  • The developer log file must be in English
  • stdout should be in the per-locale i18n format

Here's a small explanation of the implementation:

I added a class named I18nLoggerFactory as a replacement of LoggerFactory, which returns a proxied Logger instance called DuplexLogger, which delegates log invokes to one or two log backends on demand. More specifically, if the user's locale is english or hasn't been translated, there'll be only one logging backend (i.e. previous behavior without this pr). Otherwise, there'll be two logging backends: one is root(based on user's locale, output to console and beatoraja_log.xml), one is named as en(forced to use english locale, output to beatoraja_log_en.xml).

The actual translation is happened inside the class I18nLogger, which is a proxy of Logger again and simply translating the message upon the ResourceBundle it constructed with.

There's one drawback of this implementation: we need to replace all LoggerFactory.getLogger call with our own I18nLoggerFactory.getLogger. And may have a slight impact on logging efficiency.

@Catizard Catizard force-pushed the feat/i18n_notification branch from 0eb5b5f to 7428275 Compare December 22, 2025 10:47
@Catizard
Copy link
Collaborator Author

Update: error code mechanism is reimplemented. Marking this pr as ready for review because it is now demanding discussion around the designs. If there's no issues about the design I'll be going to process the migration.

@Catizard Catizard marked this pull request as ready for review December 22, 2025 10:58
@Catizard Catizard force-pushed the feat/i18n_notification branch from 1680dff to 9bd3200 Compare December 22, 2025 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants