Jump to content
GlaireDaggers

GD Localization - Simple l18n extension for RMMV

Recommended Posts

Hi all! This is an addon I've been making and maintaining alongside my game. Something I noticed was that RPG Maker is pretty lacking when it comes to localization support - text is scattered across tons of different JSON files and is very tightly integrated with other game data. It makes it tough for a third party to localize, and also ties localization to game data in a way that makes it extremely tough to switch languages without basically switching to a different copy of the game.

So GD Localization resolves this by centralizing all of a game's localization data into simple csv files in the data/lang folder. It makes it simple and easy to edit a game's localizations in any standard spreadsheet app (OpenOffice, Excel, Google Sheets, etc), and also makes it easy to switch languages at runtime (you can switch languages from script commands in an event, and GD Localization also adds a new language option to RPG Maker's built in options window). GD Localization also adds support for localizing image, sound, and video resources too.

 

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.

The format of the localization spreadsheets is simple: the top row of your spreadsheet contains column names, and should at least contain a Keys column as well as one column per language code. I also recommend having a Description column to notate the purpose & context of the text, and a Comment column to notate any other details - for example, MSG_OBTAIN_ITEM might include a comment specifying that %1 is the name of the item that was obtained. Each following row contains a text key which will be replaced, and one translation for each language. See the included example spreadsheets for details.

 

Installation

Download the repository as a ZIP (Code -> Download Zip button) and extract it somewhere. Copy the js/plugins/GDLocalization.js file into your game's plugins folder, then optionally copy the data/lang folder into your game's data folder.

 

Script calls

These can be called either from event script calls, or from other plugins

L18NManager.getLanguage(langCode)       // get the current language code
L18NManager.setLanguage(langCode)       // set the current language code
L18NManager.getLanguageList()           // get the list of supported languages
L18NManager.loadLanguageFile(langFile)  // load translations from the given localization file
L18NManager.localizeText(text)          // replace special tokens of the form {{KEY}} in the given text with translations fetched from all loaded localization files
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!

GD Localization For RMMV

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted