MoFile loader for Gamemaker Studio 2.3+
- Requirements
- Download
- Maintainers & Contribution
- Samples
- Setup
- Configuration
- Pulling Translation Strings From Code
- API
Release Version | Gamemaker Version |
---|---|
1.0.x | v2.3.0.x+ |
1.1.x | v2022.09.x.y+ |
- Download the exported local package
- Select Tools > Import Local Package
- Navigate to the saved package and select import
- Import all resources
This package is maintained by Paige Marincak. To contribute, please fork the repo and make pull requests.
Samples can be viewed here.
- Create a folder in your datafiles called TranslationFiles.
- Copy the sample.po and sample.mo files from the sample to the new folder.
- Add MofileGameStart() to the GameStart of an object that is created at the start of the game.
- Add MofileGameEnd() to the GameEnd of an object that is destroyed at the end of the game.
- Load your mofile at any point after MofileGameStart using MofileLoadLanguageFile("sample.mo")
Variable Name | Default Value | Description |
---|---|---|
MOFILE_INCLUDED_FILES_SUBDIRECTORY | "TranslationFiles" | Path to datafiles subdirectory where the mofiles are stored at runtime. |
MOFILE_USE_WORKING_DIRECTORY | true | Whether to preface MOFILE_INCLUDED_FILES_SUBDIRECTORY with the working_directory or not. |
If you would like to rename _ or _MofileMarkTranslation:
- Rename the functions as preferred in the code. Example: TL and TL_Marker.
- Open your Po File. (i.e. sample.po) Recommend using PoEdit.
- Translation > Properties > Sources keywords
- Change "_" to "TL" and "_MofileMarkTranslation" to "TL_Marker"
- Press Ok.
If you would like to use PoEdit to pull translation strings from your code, you will need to create a custom extractor as follows:
- Open PoEdit.
- File > Preferences > Extractors
- Click the + at the bottom.
- Create the Extractor with the following configuration and click OK:
Name | Value |
---|---|
Language | GML |
Extensions | *.gml |
Extraction Command | xgettext --language=C --add-comments=TRANSLATORS: --force-po -o %o %C %K %F |
Keywords List | -k%k |
Input File List | %f |
Charset | --from-code=%c |
- Open your Po File. (i.e. sample.po) Recommend using PoEdit.
- Press Update From Code
- New strings added and removed will be visible
- Save to generate a new MoFile.
Sets up the linkage between GML and the MoFile DLL. Should be called once at GameStart.
Frees the MoFile DLL. Should be called once at GameEnd.
Marks the provided value as a translatable string and returns the translation from the loaded MoFile. Feel free to rename this function to whatever shorthand makes the most sense. Be aware that you will need to update PoEdit grep configurations.
@param {String} value
Marks the provided value as a translatable string and returns the original value. Feel free to rename this function to whatever shorthand makes the most sense. Be aware that you will need to update PoEdit grep configurations.
@param {String} value
Loads the localization file represented by the provided filename and returns whether it was successful or not.
@param {String} filename