Jump to content

[1.11.2] Lang file not loading properly?


IceMetalPunk

Recommended Posts

It's been awhile since the last time I've worked on any mods, so I'm probably overlooking something stupid here, but I can't seem to figure out the problem; so here I am.

The issue is simple: my language file isn't loading properly. None of the strings (or at least, the creative tab name and the item name for the one block I've added) are translating.

Here's a screenshot to show you:

lang_file_screenie.png?dl=1

 

I create the tab like this, for reference of the tab name:

public static CreativeTabs tab = new CreativeTabs("warpstone") {

		@Override
		public ItemStack getTabIconItem() {
			return new ItemStack(Item.getItemFromBlock(Warpstone.blocks.get("warpstone_ore")));
		}

	};

 

I set the unlocalized name of the block *and* ItemBlock to "warpstone_ore".

And in my mod's src folder, I have the file

main\resources\assets\warpstone\lang\en_us.lang

 

With these basic contents:

tile.warpstone_ore.name=Warpstone Ore
itemGroup.warpstone=Warpstone

 

And yet, as you can see from the screenshot, it's definitely not translating the names at all. What am I doing wrong?

Whatever Minecraft needs, it is most likely not yet another tool tier.

Link to comment
Share on other sites

Do you have a pack.mcmeta file in src/main/resources with pack_format set to 3?

 

If you don't, Forge will load your mod's resources using the LegacyV2Adapter IResourcePack wrapper. This means that your lang files will be loaded with the old mixed-case names (e.g. en_US.lang) rather than the new lower-case names (e.g. en_us.lang).

 

If you do, your lang files should be loaded with lower-case names. Try refreshing your IDE project (i.e. click the "Refresh all Gradle projects" button in IDEA's Gradle window or re-run the eclipse Gradle task) and/or rebuilding it.

  • Like 3

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

13 minutes ago, Choonster said:

Do you have a pack.mcmeta file in src/main/resources with pack_format set to 3?

 

If you don't, Forge will load your mod's resources using the LegacyV2Adapter IResourcePack wrapper. This means that your lang files will be loaded with the old mixed-case names (e.g. en_US.lang) rather than the new lower-case names (e.g. en_us.lang).

 

If you do, your lang files should be loaded with lower-case names. Try refreshing your IDE project (i.e. click the "Refresh all Gradle projects" button in IDEA's Gradle window or re-run the eclipse Gradle task) and/or rebuilding it.

Well. I had no idea that a pack.mcmeta file was required for mod resources to prevent it from loading legacy filenames. I added that, and lo and behold, it works now :)

Thank you! I learn something new everyday. A question about convention, though: is it better to include the pack.mcmeta file, or to leave it out and use the old mixed-case filenames instead? I'd assume using the new lower-case names with the pack file is preferred, but I'd like to be sure.

Whatever Minecraft needs, it is most likely not yet another tool tier.

Link to comment
Share on other sites

12 minutes ago, IceMetalPunk said:

Thank you! I learn something new everyday. A question about convention, though: is it better to include the pack.mcmeta file, or to leave it out and use the old mixed-case filenames instead? I'd assume using the new lower-case names with the pack file is preferred, but I'd like to be sure.

 

It's best to include the pack.mcmeta file so you're using the current resource pack format with lowercase names.

 

LegacyV2Adapter is only meant for loading resource packs designed for previous versions of Minecraft and could be removed at some point in the future, so it's best not to rely on it.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

10 minutes ago, Choonster said:

 

It's best to include the pack.mcmeta file so you're using the current resource pack format with lowercase names.

 

LegacyV2Adapter is only meant for loading resource packs designed for previous versions of Minecraft and could be removed at some point in the future, so it's best not to rely on it.

That's what I figured. Thanks for all your help! :)

Whatever Minecraft needs, it is most likely not yet another tool tier.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.