M.U.G.E.N Documentation:Languages and Localization in M.U.G.E.N
M.U.G.E.N, (c) Elecbyte 1999-2009
Documentation for version 1.0 (2009)
Updated 19 October 2009
Overview[edit]
M.U.G.E.N is an English language program by default, but supports the capability to switch the language displayed in within the game. In order for motifs and characters to support being properly displayed for a particular language, the appropriate language strings must be added and configured for each of those motifs and characters. This process of configuring for a new language is called localization.
Examples of assets that can be localized are the victory quotes of characters, or the title logo shown in the title screen.
In M.U.G.E.N, the desired language is configured in mugen.cfg. The "Language" setting is located in the [Config] group. When the M.U.G.E.N runtime is started, the language setting will be loaded and used for the duration of the program.
[Config] Language = "en"
The language parameter is an ISO 639-1 code, which is a two-letter code that corresponds to a specific language. For example, to set your preferred language to Japanese:
[Config] Language = "ja"
A full list of valid ISO 639-1 codes can be viewed on Wikipedia at http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
All characters and motifs are required to support the English language by default. If a particular character or motif is not configured to support the language set in mugen.cfg, that character or motif will fall back to being displayed in English.
Language Mechanism[edit]
The language mechanism in M.U.G.E.N operates on the level of groups within definition files. Groups are blocks of text beginning with a line that has a string enclosed in square brackets ('[' amd ']'). For example:
[Group 1] Contents of Group 1. Another line in Group 1. This is the last line in Group 1. [Group 2] This line is in Group 2.
In order to localize a group for a target language, a copy of the group must first be made, and the target language's ISO 639-1 code followed by a period ('.') prepended to the name of the group. Groups without the language code are known as undecorated groups and groups whose name is prepended with the language code are known as localized groups. For example:
[Group A] This is the original Group A. This is called an undecorated group. The target language for undecorated groups must be English. [ja.Group A] This is Group A localized for Japanese. This is called a localized group that will be loaded when the preferred language is "ja".
Whenever M.U.G.E.N attempts to load a group that supports this language mechanism, the loader first scans the file for the localized group name. If found, that group will be loaded. If the localized group is not found, the loader then scans the file for the undecorated group name. Following the example above, if the preferred language is configured to "ja", an attempt to load [ja.Group A] will be made before attempting to load [Group A].
By this mechanism, only groups that need to have different contents based on the preferred language need to be localized. Groups that do not require different contents across languages may be left undecorated. In order to correctly display strings in undecorated groups regardless of preferred language, it is required that the language used for undecorated groups be English.
Certain groups cannot be localized using this mechanism. See Section "Groups Exempt From Localization" for details.
Localization Notes[edit]
- When localizing motifs, it may be required to localize the [Files] group in system.def in order to substitute an appropriate victory quote font for the target language. True Type fonts are required for text that contains non-ASCII characters.
- When localizing storyboard scenes, the undecorated portion of the localized group name must be an exact match of its English equivalent's group name, e.g. [Scene 3 hello] would be localized in Spanish as [es.Scene 3 hello], not [es.Scene 3 hola].
- It is recommended (but not required) that character and stage display names are written in English (more precisely, using the ASCII character set), in order to be displayed correctly across different motifs, as well as to maintain a consistent look within the game.
Groups Exempt From Localization[edit]
The following groups cannot be localized by the language mechanism described above.
- All groups in mugen.cfg.
- Character command and state groups, i.e. [Command], [State ...] and [Statedef ...]
- Individual backgrounds elements.