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

[Common] Add support for custom language files #191

Merged
merged 5 commits into from
Jan 5, 2024

Conversation

ScribbleTAS
Copy link
Member

First step for #174 is creating a way to load custom language files to legacy fabric.

Registering

I can seem to find a "all loaded modids" function in the FabricLoader so now you have to register your modid yourself...

LanguageManager.registerMod("modid");

Not the most elegant solution, but a good one if you want to reuse these classes in your mod...

Json support

I've learnt my lesson and maintaining .json and .lang files both at the same time is a nightmare. So why don't I just downpatch the json lang files from 1.14?

Even better, both formats are supported and the hirarchy is as follows:

  1. Resourcepack, .lang
  2. Resourcepack, .json
  3. Resource, .lang
  4. Resource, .json

Lang files are still more preferred in the hirarchy, so that old resourcepacks with .lang still work, but in 99% of cases you can just use .json.

As to why I'm still supporting .lang? Well for LoTAS I created seperate lang files... so if LoTAS is ever ported to legacyfabric on the fly, you can be sure that this will work as well.

Lowercase

All lang files (Except Resourcepack .lang) are now being lowercased... This doesn't make much sense in 1.12.2 but in 1.10, all lang files had to be in en_US.lang... So to prevent future headaches I made everything like 1.14.

@ScribbleTAS ScribbleTAS added Enhancement New feature or request Core Issue relates to core concepts labels Jan 5, 2024
@ScribbleTAS ScribbleTAS self-assigned this Jan 5, 2024
@ScribbleTAS ScribbleTAS requested a review from PancakeTAS January 5, 2024 20:50
Copy link
Member

@PancakeTAS PancakeTAS left a comment

Choose a reason for hiding this comment

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

better add them now then never

@ScribbleTAS
Copy link
Member Author

@PancakeTAS Indeed

@ScribbleTAS ScribbleTAS added Common Issue relates to the common package Translations Issue relates to i18n and removed Core Issue relates to core concepts labels Jan 5, 2024
@ScribbleTAS ScribbleTAS merged commit d6c7c07 into MinecraftTAS:develop Jan 5, 2024
2 checks passed
@ScribbleTAS ScribbleTAS deleted the translation/json branch January 6, 2024 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Common Issue relates to the common package Enhancement New feature or request Translations Issue relates to i18n
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants