- Joined
- Apr 9, 2015
- Messages
- 1,797
- Reaction score
- 866
- First Language
- German
- Primarily Uses
Description
Allows to store all text content of your game in external files. Persists the current language in its own file and allows language switching at runtime.
Prerequisites
The Core engine is needed for the individual modules to work. Optionally, my Game.ini Acces script (Link) can be used to save the current language inside the Game.ini.
Features
Allows to load the text content of your game from external files and switch between multiple languages at runtime. The script is split into 3 parts: The Core engine, the Database module and the Messages module. Both modules need the engine to function, but can be used independently from each other.
The different features of the scripts are:
Core
- Loading of external text files from a configurable part.
- Possibility of splitting the data into multiple files, even withing categories with an optional DEEP_MERGE functionality.
- Option to evaluate the loaded data inside a seperate thread with $SAFE = 4, which acts as a sandbox.
- The current language can be stored inside its own file or inside the Game.ini by using another of my scripts.
- Extendable update method, which is called every time the current language is changed.
Database
- Localization of database entries, which include: Actors, Classes, Skils, Items, Weapons, Armors, Enemies, States, System, Terms, Vocab and Map names.
- Optional CLEAN_ACTORS mode, which removes the only trace of the script prior to saving, so it can be removed without having to start a new game.
- Older savegames will also be localized, making the script completely plug-and-play.
- Falls back to the default value (as given in the editor) if an attribute isn't provided in the language files.
Messages
- Introduces a new, configurable message code, which will be replaced with localized text loaded with the core engine.
- All basic message codes also work inside dynamically loaded text (though you need to double the backslashes, for example \\v[1] instead of \v[1]).
- Optional SUB_INCLUDES mode, which allows to cross-include other localized text, so terms like city names can be kept at a central place.
How to Use
Language files are formatted as ruby hashes. An example file looks like this:
{ :messages => { :a => "Localized message text \\:", :b => "which also includes another text entry and displays a variable: \\v[1]" }, :actors => { 1 => { :name => "Name of Actor 1" } }, :maps => { 1 => "Display name of Map 1" }, :terms => { :command_new_game => "New Game command" }}Multiple files can be defined and will be merged together on game start. If a category appears in multiple files, all but one occurence of it will be lost unless DEEP_MERGE is set to true. In this case the script will merge the entries together.The current language can be read and changed by using:
IAVRA::I18N.languageIAVRA::I18N.language = :en # "en" works, tooConfigurationCore
- LANGUAGES: Contains the supported languages in symbol form. The entries will also be used as prefixes to load the language files on startup.
- FILE_PATH: %s will in turn be replaced with the string representation of a language (so, :en => "en") and be used as a file glob to determine which files should be loaded.
- PERSISTENCE: The file which is used to store the current language. This variable will be ignored, if the Game.ini Access script is present.
- DEEP_MERGE: If set to true, this will cause the language files to be combined with a recursive merge instead of a normal merge.
- SANDBOX: If set to true, a sandboxed eval (inside a thread with $SAFE = 4) will be used to read the language files instead of a regular eval.
Database
- CLEAN_ACTORS: As actors are stored inside $game_actors and not directly read from $data_actors, their localized attributes will, be default, be stored inside save files. Setting this to true causes the script to revert them to default before saving and re-localize them afterwards, leaving no trace inside the save files.
Messages
- MESSAGECODE: The message code, which is used to load localized text. The default is ":", which translates to "\:". Can be configured to allow compatibility with other scripts, that might be using this code.
- SUB_INCLUDES: If set to true, text entries in language files can reference other text entries (using the message code defined above). If set to false, our message code will be replaced with empty strings instead.
Terms of Use
Free to use for both commercial and non-commercial games. Please give credit.
Credits
Iavra
FAQ
Q: Will the message module auto-wrap my text to fit inside the message boxes?
A: No, i decided not to do this, since there are already other scripts that do this way better, than i ever could and that should be fully compatible.
Q: Does this include a menu that can be used to change the current language?
A: No, at this point the language is only change directly via script calls. If there is enough interest, i will write an additional module or plugin for Yanfly's System Options.
Q: Do i really have to write my language files in this strange syntax?
A: Currently, yes. Ruby hashes allow a lot of freedom to the expense of being more complicated than other file formats. If there is interest, i might write an external tool to manage the files, which will also marshal them, so you can put them inside the Data folder and include them in the encryption process. I certainly won't do this before IGMC, though.
Q: I don't want that localization stuff. Can i just use the script to load external text?
A: Sure you can! Set LANGUAGES = [] and PERSISTENCE = "". Note, that the "%s" in FILE_PATH will be replaced with an empty string in this case.
Changelog
- 1.00: Release version.
Download
Core engine: http://pastebin.com/n4wEwnBs
Database module: http://pastebin.com/WWWt5eGu
Messages module: http://pastebin.com/nbscF0W7
Allows to store all text content of your game in external files. Persists the current language in its own file and allows language switching at runtime.
Prerequisites
The Core engine is needed for the individual modules to work. Optionally, my Game.ini Acces script (Link) can be used to save the current language inside the Game.ini.
Features
Allows to load the text content of your game from external files and switch between multiple languages at runtime. The script is split into 3 parts: The Core engine, the Database module and the Messages module. Both modules need the engine to function, but can be used independently from each other.
The different features of the scripts are:
Core
- Loading of external text files from a configurable part.
- Possibility of splitting the data into multiple files, even withing categories with an optional DEEP_MERGE functionality.
- Option to evaluate the loaded data inside a seperate thread with $SAFE = 4, which acts as a sandbox.
- The current language can be stored inside its own file or inside the Game.ini by using another of my scripts.
- Extendable update method, which is called every time the current language is changed.
Database
- Localization of database entries, which include: Actors, Classes, Skils, Items, Weapons, Armors, Enemies, States, System, Terms, Vocab and Map names.
- Optional CLEAN_ACTORS mode, which removes the only trace of the script prior to saving, so it can be removed without having to start a new game.
- Older savegames will also be localized, making the script completely plug-and-play.
- Falls back to the default value (as given in the editor) if an attribute isn't provided in the language files.
Messages
- Introduces a new, configurable message code, which will be replaced with localized text loaded with the core engine.
- All basic message codes also work inside dynamically loaded text (though you need to double the backslashes, for example \\v[1] instead of \v[1]).
- Optional SUB_INCLUDES mode, which allows to cross-include other localized text, so terms like city names can be kept at a central place.
How to Use
Language files are formatted as ruby hashes. An example file looks like this:
{ :messages => { :a => "Localized message text \\:", :b => "which also includes another text entry and displays a variable: \\v[1]" }, :actors => { 1 => { :name => "Name of Actor 1" } }, :maps => { 1 => "Display name of Map 1" }, :terms => { :command_new_game => "New Game command" }}Multiple files can be defined and will be merged together on game start. If a category appears in multiple files, all but one occurence of it will be lost unless DEEP_MERGE is set to true. In this case the script will merge the entries together.The current language can be read and changed by using:
IAVRA::I18N.languageIAVRA::I18N.language = :en # "en" works, tooConfigurationCore
- LANGUAGES: Contains the supported languages in symbol form. The entries will also be used as prefixes to load the language files on startup.
- FILE_PATH: %s will in turn be replaced with the string representation of a language (so, :en => "en") and be used as a file glob to determine which files should be loaded.
- PERSISTENCE: The file which is used to store the current language. This variable will be ignored, if the Game.ini Access script is present.
- DEEP_MERGE: If set to true, this will cause the language files to be combined with a recursive merge instead of a normal merge.
- SANDBOX: If set to true, a sandboxed eval (inside a thread with $SAFE = 4) will be used to read the language files instead of a regular eval.
Database
- CLEAN_ACTORS: As actors are stored inside $game_actors and not directly read from $data_actors, their localized attributes will, be default, be stored inside save files. Setting this to true causes the script to revert them to default before saving and re-localize them afterwards, leaving no trace inside the save files.
Messages
- MESSAGECODE: The message code, which is used to load localized text. The default is ":", which translates to "\:". Can be configured to allow compatibility with other scripts, that might be using this code.
- SUB_INCLUDES: If set to true, text entries in language files can reference other text entries (using the message code defined above). If set to false, our message code will be replaced with empty strings instead.
Terms of Use
Free to use for both commercial and non-commercial games. Please give credit.
Credits
Iavra
FAQ
Q: Will the message module auto-wrap my text to fit inside the message boxes?
A: No, i decided not to do this, since there are already other scripts that do this way better, than i ever could and that should be fully compatible.
Q: Does this include a menu that can be used to change the current language?
A: No, at this point the language is only change directly via script calls. If there is enough interest, i will write an additional module or plugin for Yanfly's System Options.
Q: Do i really have to write my language files in this strange syntax?
A: Currently, yes. Ruby hashes allow a lot of freedom to the expense of being more complicated than other file formats. If there is interest, i might write an external tool to manage the files, which will also marshal them, so you can put them inside the Data folder and include them in the encryption process. I certainly won't do this before IGMC, though.
Q: I don't want that localization stuff. Can i just use the script to load external text?
A: Sure you can! Set LANGUAGES = [] and PERSISTENCE = "". Note, that the "%s" in FILE_PATH will be replaced with an empty string in this case.
Changelog
- 1.00: Release version.
Download
Core engine: http://pastebin.com/n4wEwnBs
Database module: http://pastebin.com/WWWt5eGu
Messages module: http://pastebin.com/nbscF0W7
Last edited by a moderator: