Localization - roelofr/gmod-particlemaker GitHub Wiki
This plugin has a huge amount of options to tinker with. However, as not all people speak fluent English, some of these options may sound like complete gibberish to them. To help these users out, I've added a simple localization system that everyone can extend upon.
All the locale files can be found in the resource directory, which follows the exact same structure as the Garry's Mod main game. The system is pretty simple, but if you want more info, scroll to the bottom of this wiki page.
You can help by creating a merge request for your custom locale. Note that the files are located in the /resource/localisation/<lang>/particlemaker.properties
file, where <lang>
is your 2-char country code (en, nl, de etc). All languages that are available in-game are available to translate into and some have already been translated for you.
By creating a merge request with your translated string you accept that you publish them under the Apache 2 license and allow other to modify it if they think a translation can be improved upon. You can optionally add your name as a comment (start the line with a #
) to add some authorship to the file.
If you know of people who speak languages that have NOT been translated yet, please invite them to help the translation process, so we can make this addon (and with it, Garry's Mod itself) better for everyone.
Since Garry's Mod sadly doesn't have a language.getLocale()
method to easily get the active language, I've decided to use a tad more complex system. It works something like this:
- The engine is asked to translate a string that is unlikely to change (in our case,
new_game
) - The addon compares the resulting phrase with a list of stored combinations for each language (see here).
- After finding a phrase that matches the result from the engine, the language corresponding to that phrase is used. If none are found, English is assumed.
- The filesystem is searched for a
/resource/localisation/en/particlemaker.properties
, which is parsed to serve as the base for other files (as to never see untranslated strings). - The filesystem is searched for a
/resource/localisation/<lang>/particlemaker.properties
file, where<lang>
is the language code we found. - The results from 5 are merged with the results from 4 and all the lines are pushed into the engine's localisation system.
- The gamemode continues loading and will use the strings we loaded to build up the menu's and dialogs.