2.3.X | Localize Your Layouts

0. About

As of FancyMenu v2.3.0, you can localize your text elements (and even images, animations and more) to the game language.

1. How To Localize Text Elements

FancyMenu allows you to add your own localizations to the game.
These can then be used in the %local:localization.key% placeholder text value to localize a text to the current game language.

1.1. Add Your Localizations

1.1.1. Localization Directory

To add your own localization files, you first need to create a localization directory in .minecraft/config/fancymenu/custom_locals/.
This directory should have a unique name, like your username.

In this case, I will name the directory keksuccino.
So now I have my localization directory in .minecraft/config/fancymenu/custom_locals/keksuccino.

This is the directory where you will put all your localization files.

1.1.2. The First Localization File

Localization files are containing all your text content in different languages.
Every localization files is for a separate language.

This means that you put the same text content in multiple files, but in different languages.

To identify the same content across multiple files, you need to give them a unique key (like an ID).

Because you will most likely not localize your content to every language in the game, you will need a fallback language that gets used when the game is set to a language your content is not localized to.

This is why the first file you will create in your localization directory is the en_us.local file!
The en_us.local (US English) file is always the fallback language, so make sure to not forget to add it.

To do this, just open your localization directory and right-click into the folder to create a new text document.

Now you will need to turn on file extensions on Windows and maybe other systems, to see the .txt extension of your newly created text file.

Rename this text file to en_us.local (make sure to remove the old .txt extension).

Right-click it and click on Open with -> Choose another app (on Windows) and search and select your text editor in the list. Now enable the Always use this app to open .local files option at the bottom of the window and click OK.

Now you can open and edit .local files with your normal text editor.

1.1.3. Add Content To Localization Files

You just created your first localization file for the US English language.
This means, when the game language is set to US English, your text elements will be localized to the content in the en_us.local file (and in the case of this specific file, it will also get used if you don't have a localization file for the current game language).

But the file is empty, so none of your text elements can get any content from this file.
Lets change this.

Open your en_us.local file with your text editor.

There is one localization key + value per text line, so line breaks will not work.

To add a new value, just start with the unique key you've chosen for this value, followed by an equals sign and the actual value.

Keys need to be unique, so you can't use the same key for more than one value.
This doesn't count for the same value in different localization files.

Just like for the first value, you can now add all of your values to the localization file.

Now you have your first and most important localization file ready to be used in text elements.

1.1.4. Add More Languages

But your currently only have one language, so it's not really localization, right?

Well, no problem! Just like you've created and edited your en_us.local file, you can now make files for other languages!

In my example, I will create a file to localize my text content to German.

To do this, I will create a de_de.local file in my localization directory.

You've probably noticed at this point that the names of your localization files can't be random.
You always need to use the correct language code for the localization file as file name.

If you want to know the correct language code (aka. local code) for a language, check out this Minecraft wiki page.

Now I will add the exact same values as in the en_us.local file to my new de_de.local file, but will translate the values to German.

Make sure to only translate the value and not the key.

Now you have your default en_us.local file and one or more other localization files with the same values for other languages.

You can edit these files later to add more values or to edit existing ones.

1.2. Use Your Localizations

Your localization files are ready now, so lets see if they work.

To use your localizations in text elements, you just need to edit the content of a text element (like button labels, normal text, etc.) and click on the little PLUS (+) button at the right side of the text edit box and click on Other -> Localize Text.

This will add a new placeholder text value to your text edit box.

Now just replace the <localization.key> (including < >) with one of your own localization keys from your localization files.

You can also add normal text to the element.

Text elements with placeholder values will look a bit special in the editor, but they will look normal in the actual menu later.

And now you can switch the language to one of your other supported languages and see if the value changes to the new language.

And that's basically it. No other special things to know. Not too difficult, right?

2. How to Localize Non-Text Elements

Ha! Bold of you to assume you can only localize boring text elements!

FancyMenu also allows you to localize images and basically every element you want.

To do this, you will need to use visibility requirements.
The Is Game Language requirement, to be more specific.

Every element in your layout has its own visibility requirements.
To access the visibility requirements of an element, right-click the element and click on Visibility Requirements.

Now use the arrow buttons to switch to the Is Game Language requirement.

Click on the first button to enable the requirement and then write the correct language code you want to check for in the text box.

If you want to know the correct language code (aka. local code) for a language, check out this Minecraft wiki page.

You can choose between Show If and Show If Not. The first one will show the element if the game language is set to the choosen language and the second one will show the element if the language is not set to the choosen one.

In our case, we just need the Show If mode.

Now you can show, for example, a specific image for English and another one for German or other languages.
That way you can show an element with maybe some localized parts in it (like text) for the correct game language.