Skip to content

Add Localization API#58

Open
SpaceWalkerRS wants to merge 1 commit intogen2from
localization
Open

Add Localization API#58
SpaceWalkerRS wants to merge 1 commit intogen2from
localization

Conversation

@SpaceWalkerRS
Copy link
Member

This API will provide a stable alternative to Vanilla's localization system and language support.

The API includes:

  • L10n, a utility class for localizing translation keys, and querying the language used for localization.
  • LocalizationEvents, which contains events for language reloads.

Supported features include:

  • Localizing translation keys.
  • Listening for language reloads.
  • Support for both .lang and .json format translation files.
  • Support for translation files provided by resource packs.
  • Support for translations provided by mods directly.
  • Support for different fonts.

I reckon there will be two kinds of implementations of this. First, for versions 1.6 and later, the API will essentially just be a wrapper around the Vanilla system, given that the Vanilla system + OSL Resource Loader supports most features already.

Second, for versions before 1.6 and especially versions before 1.1, OSL will provide most functionality itself. It will handle fetching translation files from resource packs, language selection, and language reloads. A lot of this will be dormant, though, as the actual implementations for e.g. multiple language support (i.e. the actual translation files, language selection screen) is not within scope of this API.

@SpaceWalkerRS SpaceWalkerRS added the enhancement New feature or request label Feb 15, 2026
@SpaceWalkerRS
Copy link
Member Author

Once the implementation is finalized the translation-related code from the Resource Loader module can be removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant