设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 117|回复: 0

[转载发布] Iavra Game Localization - Core Engine, Database, Messages

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    2026-7-12 04:10
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    9071

    主题

    864

    回帖

    6万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    58883
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    68848

    灌水之王

    发表于 2026-8-1 09:58:51 | 显示全部楼层 |阅读模式
    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



    本贴来自国际rpgmaker官方论坛作者:Iavra处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/iavra-game-localization-core-engine-database-messages.40273/
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-8-17 22:16 , Processed in 0.113418 second(s), 55 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表