Localisation - thesupersonic16/HedgeModManager GitHub Wiki

Localisation

Hedge Mod Manager supports localisation for most of its UI components, this means the UI can be translated into another language.

Table of Contents

How does the localisation system work

The localisation system is built using XAML to contain all the strings needed. These files are located in the HedgeModManager/Languages folder named preferably with the first two letters of the ISO 639-1 code for the language in lowercase followed by a dash (-) and then the first two letters of the ISO 3166-1 code for the region ending with the file extension of ".xaml". Examples are en-GB.xaml, en-US.xaml, zh-CN.xaml and es-MX.xaml

On first start-up Hedge Mod Manager will look at your system locale and check if a matching language file can be found. In case one is not found it will scan for the same language from a different region, otherwise it will fall back to the main language.

en-AU (English Australia) is the main language, it is always loaded with the lowest priority. This is so Hedge Mod Manager will fallback to its main language when a string is missing.

Hedge Mod Manager will also load any language files in the Languages folder if it exists next to the executable. It is very important all files in this folder do not belong to any other applications or else you will likely get a crash.

Creating a translation

Before translating, you will need to create a language file, to do this you will need to download en-AU.xaml or select the top language (English Australia) and hold shift and press F4 then rename the file to the language you are translating to.

After creating the language file, you will want to open it in a text editor, we recommend using VSCode. Once opened you will only need to translate the strings within the XML elements. If you do not understand, please learn the basics of XML or compare other language files. Do not translate the comments.

Note: Curly braces with a number inside like {0} are placeholders for data, please do not remove these unless it does not fit your language.

After you're done translating, you can start testing it by re-opening Hedge Mod Manager and in the language dropdown should be your language file name. Select it and mess with the UI and ensure everything fits and works.

Uploading the translation

Once you're done testing and completed translating the entire file, you will need to add your language to the Languages.xaml file and upload both(or more) files to your fork then make a Pull Request so it can be approved and added.

Updating translations

If you notice an error or the language file is missing strings, you may update the file and upload it. To do so, you will need to be connected to the Internet and select the language to be edited in Hedge Mod Manager and hold Shift and press F4, this will open an explorer window with the language file containing the old string and the new untranslated strings.

After you have finished translating all the new strings and tested if the file works inside Hedge Mod Manager, you will need to upload it to your fork and create a Pull Request for it to be approved and added.