Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translation keys v1 #105

Merged
merged 1 commit into from
Apr 13, 2024
Merged

Translation keys v1 #105

merged 1 commit into from
Apr 13, 2024

Conversation

mineLdiver
Copy link
Member

Current format of translation keys has serious flaws:

  1. Usage of colons for namespacing, which introduces manual escaping in lang files.
  2. It assumes that the second part of the translation key (first.second.third) is always the one that requries namespacing, making multi-level translation keys confusing.
  3. Automatic namespacing of translation keys imposes some limitations on the developer.

What this pull request changes:

  1. Colons are no longer being used in translation keys. Namespaces are instead their own parts. Example: item.namespace\:myItem.name -> item.namespace.myItem.name
  2. Automatic namespacing is now opt-in and requires specifying where the namespace is supposed to be via a placeholder. Example: item.namespace.myItem.name -> item.@.myItem.name
  3. StationAPI's own translation keys have been reformatted to be more consistent with vanilla. Example: stationapi\:achievementPage.myPage -> gui.stationapi.achievementPage.@.myPage
  4. StationAPI's own lang files are no longer loaded in an alternative way that avoids module's specific automatic namespacing, since automatic namespacing is now opt-in by default.
  5. Keybinds saving workaround is now removed, since colons are no longer used in translation keys and can no longer mess with Minecraft's options.txt parser.

@mineLdiver mineLdiver added the enhancement New feature or request label Apr 12, 2024
Copy link
Member

@calmilamsy calmilamsy left a comment

Choose a reason for hiding this comment

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

This removes a lot of workaround code, and is easy enough to do manually, or by using the @ key for your own modid, I'm for this, as folk can do their lang key files however they want.

@mineLdiver mineLdiver merged commit 3c2b69d into master Apr 13, 2024
@mineLdiver mineLdiver added this to the 2.0-alpha.2 milestone Apr 29, 2024
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
Status: No status
Development

Successfully merging this pull request may close these issues.

None yet

3 participants