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

[转载发布] GD Localization - Yet another L18N plugin

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

    连续签到: 2 天

    [LV.7]常住居民III

    7959

    主题

    864

    回帖

    3万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

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

    灌水之王

    发表于 3 天前 | 显示全部楼层 |阅读模式
    Hey!
    So I was working on this localization plugin for my own game, Foxblade, and decided I'd go ahead and throw it up on Github in case anyone else finds it useful.

    The plugin is designed to be really simple to use, so honestly there's not much to it. Localization files are stored in .csv files, designed to make it simple to edit in any standard spreadsheet application (Excel, OpenOffice, Google Sheets, etc), with a single key column and one translation column per language (based on specs provided by third party localization services, to make sure these files are as simple as possible for a third party to localize). It supports localizing all of the built-in RPG Maker text stuff (event text, event choices, scrolling text, party member names, menu items, battle text, items, skills, actions, etc). You can also localize image, video, and sound resources.

    You can specify as many language files to load on startup as you'd like (as an example you can split up localization files by category). It also supports loading language files for each map, so for example you can store localization for a specific map's events into a file named after the map and it will be automatically loaded when the player enters that map (it will be unloaded as soon as the player transitions to another map, to keep memory usage reasonable).

    Localization is also performed recursively, so any localized text can itself contain tokens which will be localized.

    Plugin Parameters

    • Directory for language files - this is the directory where language files should be stored, relative to your game's base directory. The default is to put files in /data/lang
    • Directory to search for per-map language files - this is the directory where per-map language files should be stored. They should be named the same as the map's name (NOT its display name) with ".csv" appended (for example, if your map is MAP001, the associated language file would be MAP001.csv and would be put in this directory). The default is to put per-map files in /data/lang/maps
    • Default files to load for localization - A list of default localization files which are loaded immediately on game startup
    • List of supported language codes - A list of language codes which are supported by the game. This is used by the options screen to show a list of languages to choose from.
    • Default language code - The default language to set. The default is "en-us"
    • Key column name - The name of the column to look for localization keys. The default is "Key"
    • Localize image & sound resources - If true, allows images, videos, & sound files to be redirected depending on the current language. The default is "true"
    • Strict error mode - When strict mode is enabled, if any key cannot be located in currently loaded localization files an error will be displayed. Otherwise, the error will be silently logged to the console. The default is "false"
    Usage

    Anywhere you'd put text which would be displayed to the player (actor names, nicknames, profiles, item names & descriptions, skill messages, event show text, system terms, etc), you can simply put in a token of the form {{PUT_KEY_HERE}}. The localization plugin will search all currently loaded localization data for a row with a key column value of PUT_KEY_HERE, and will substitute that token with the value of the current language column. If the key could not be found, or there is no language column for the current language, it will simply paste in the text PUT_KEY_HERE unless strict mode is enabled (in which case an error will be displayed and the game halted).

    You can also parameterize text. For example, if the localized text of PUT_KEY_HERE is "Test message: %1 %2 %3", you can do this: {{PUT_KEY_HERE:"parameter 1" "parameter 2" "parameter 3"}} and each quoted text will be used to replace %1, %2, and %3 respectively.

    For image, video, & sound resources, instead of defining an arbitrary key you will put the original path to the resource in the Key column, and put a redirected path in the language column.

    At runtime, calls to load these resources will automatically be redirected to the correct path depending on the selected language.

    Script API

    All of these can be called from a Script call in an event, or they can be called from other plugins.
                    JavaScript:       
    1. L18NManager.getLanguage(langCode)       // get the current language code
    2. L18NManager.setLanguage(langCode)       // set the current language code
    3. L18NManager.getLanguageList()           // get the list of supported languages
    4. L18NManager.loadLanguageFile(langFile)  // load translations from the given localization file
    5. L18NManager.localizeText(text)          // replace special tokens of the form {{KEY}} in the given text with translations fetched from all loaded localization files
    6. L18NManager.localizeResource(url)       // return the path to the localized version of the given resource url, or the original url if that resource is not localized or resource localization is disabled
    复制代码


    Anyway, the source code is here in case it's useful! You can do whatever you want, commercial or noncommercial. Attribution is not required, but appreciated.



    GitHub - GlaireDaggers/GD-Localization-For-RMMV: Localization plugin for RPG Maker MV

    Localization plugin for RPG Maker MV. Contribute to GlaireDaggers/GD-Localization-For-RMMV development by creating an account on GitHub.

                                            github.com                               






    本贴来自国际rpgmaker官方论坛作者:GlaireDaggers处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/gd-localization-yet-another-l18n-plugin.145927/

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有账号?立即注册

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

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

    本版积分规则

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

    幸运抽奖

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

    立即查看

    聊天机器人
    Loading...

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

    GMT+8, 2026-8-1 02:33 , Processed in 0.122920 second(s), 56 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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