~ Update: 2/18/2025 ~
Newest version - 3.9
- Many changes to the original version! There's Export/ImportPluginText functions near the bottom, with corresponding functions below them, that can be removed/used as examples as needed. This should still work standalone. By all means, let me know if it doesn't!
- I know I'm 'just' shy of 4.0, but we'll see if I make it. Depends on reported bugs ^_^
By default, this plugin will export all MV Engine 'shows up in game and needs to be translated' text to separate JSON files to a folder (/lang/base), and then import the JSON files from language folders you set up (/lang/eng for instance). It uses the same file structure as the files in the data/ folder (Actors.json, etc), but only pulls out/replaces the necessary text.
Also included is a Language selection in the Options menu. You can choose to use this one, or make use of one already in use from another plugin by supplying the proper 'symbol' name for the language command in that Options menu.
- Using an alternate plugins Language option isn't fully tested however, as these usually come from other localization plugins.
Importing of all text data happens automatically, based on the language selected. Haven't created any language folders? No problem, the game ignores the whole function and moves on.
~ The commands below all happen automatically now, no need to type anything in. ~
To use the export features, open the console window (f12 key) and type any of the following commands:
ZAM.GatherDataText();
- This builds JSON files for all of the Editor database sections. Actors, skills, item, system text, etc.
ZAM.GatherMapText();
- This builds a file for the currently active map and pulls out every bit of conversation text, whether it's a basic text window, scrolling screen text, or a choice window with multiple options.
ZAM.SaveAllMapsText();
- As you may expect, it does everything GatherMapText does, but for every existing map - excluding any map below one with a name you can set in the plugin settings. These are saved in separate JSON files per map.
Editing software:
For reading and editing the JSON files, I highly recommend software designed for programming, rather than, say, Notepad.
I use Atom myself, as it’s a light bit of software for fast coding. It’s extension library is also useful, especially for the purposes of this plug-in. You can edit the JSON directly, or if you’re hiring out, convert it to CSV, and then convert the final translation file back into JSON.
You can find the extensions in the programs library and install them easier that way, but the links give you some idea. Don’t need the converter, but pretty JSON is a must.
Further Customization:
So that's the basics, but this plugin can be extended to work with any other plugins you want. Those with javascript/plugin experience can probably work out the details, but don't worry if it doesn't make sense. There's a couple examples in the file that I commented out, and I'll do my best to help you work out your project's needs. With every problem fixes comes more examples for those after you ^_^.
Plugin Placement -- Below every plugin with any text you want translated. Very bottom works fine as well.
Terms of Use:
- Free for use in all commercial and non-commercial projects, so long as credit is given.
Updates: (3.9 newest)
SpoilerVersion 0.2
* - Added base functionality to export/import all Messages text from a map.
* -- Covers 'Show Text', 'Show Choices', and 'Show Scrolling Text' event options.
*
* Version 0.4
* - Added partial Database export.
* -- Covers Actors, Classes, Skills, Items, Weapons, Armors, and Enemies.
*
* Version 0.8
* - Added $dataSystem. All Database text should be exporting now. (Almost)
* -- Covers the Types and Terms database tabs. Added Currency Unit as well.
* - $data files load on new game, if they exist.
* - Properly searches for language folders and files for translations.
* Version 0.85
* - Map and $database files update after changing the language in options mid-game.
* Version 0.87
* - Fixed missing path check for language folders.
*
* Version 0.9
* - Added $dataCommonEvents. Last Database field. Pretty sure.
* - Added $dataMap.displayName to Map export file.
* - Now imports $dataMap.displayName. Adds to MapNameHUD plugin as well.
* Version 0.92
* - Added plugin text from all ZephAM plugins.
* - Fixed compatibility with YEP_MessageCore
* - Now includes SRD_AutoNameBox names in translation file.
* Version 0.93
* - SRD_AutoNameBox no_face names added to translation file.
* - CustomNaturalStats plugin text now in translation file.
* Version 0.94
* - CTB_ItemSceneEx item menu headers added to translation file.
* - MOG_TimeSystem day/month/season terms added to translation file.
* Version 0.99
* - Created function to export 'All' maps event text at once.
* Version 0.995
* - Combined speech lines from same window into single line/box.
*
* Version 1.0
* - Fixed combined speech lines for import from file.
* - Added \n line break to new speech lines.
* - Added notes for import formatting.
* Version 1.5
* - Export files now auto create in the proper format.
* - Corrected $dataSystem export/import formatting.
* - Fixed improper import formatting.
*
* Version 2.0
* - Adjusted translation import/export to new transposed style.
* - Changed multiple import/export files into one.
* - Line break for speech lines changed to <br>
* Version 2.1
* - Removed Face name lines from translation file (code 101)
* - Fixed mapEvents not always reading right due to event trigger.
* - Fixed systemText not reading right in non-EN languages.
* - Fixed text display not referencing proper event positio
* - Fixed CTB import/export typo
* - Fixed CommonEvents not loading/referencing translation text
* Version 2.2
* - Added check for www/ build version folder.
* Version 2.3
* - Fixed interpreter not giving correct eventId info.
* - Fixed function from YEP_CallEvent not returning the running EventId
* Version 2.5
* - Added toggle for auto export of translation file.
* - Removed unneeded line adjustment for common events.
* Version 2.55
* - Moved YEP_CallEvent fix over to MiscFixes plugin.
* Version 2.7
* - Added export/import of GabText during map event text.
* Version 2.75
* - Fix added to ensure auto-export only runs once.
* Version 2.8
* - If no translation file in lang/translations/ on auto export, create one.
* Version 2.85
* - Fixed map name assignment from translation file.
*
* Version 3.0
* - Fixed common event translation calls.
* - Fixed GabText translation calls.
* - Fixed different Event triggers causing bad translation calls.
* - Removed $gameMap._textfile as additional point of failure. Single ZAM._gameText source.
* Version 3.05
* - Fixed word wrap not activating.
* Version 3.1
* - Fixed event translation calls .
* - Game now creates a new lang/base/ and lang/translations/ TextData.json files on start TEMPORARY
* Version 3.15
* - Added www/ folder exception to SaveAllMapsText function
* Version 3.17
* - Added check for old maps for skip test.
* Version 3.2
* - Added check for 0 code during text data check.
* Version 3.3
* - Fixed event text not calling the correct page through CallEvent.
* Version 3.4
* - Added overwrite of EN parameter for lang/translations/TextData.json
* - Overwrite also adjusts for added/removed/changed data objects from lang/base/TextData.json
* Version 3.45
* - Fixed missing variable usage in CompareLangFile function
* Version 3.47
* - Fixed event sometimes calling the wrong page when near an event call/transfer
* Version 3.48
* - Test fix for gameInterpreter setup not finding $gameMap.event(eventId).
* Version 3.5
* - Fixed event text not always calling the right mapId for translation.
* - Added conditions to other event text types to sync call locations.
* Version 3.6
* - Tentative fix to better allow lang/translations/TextData.json translation file to be properly adjusted to changes.
* - Improved external file "TranslationChanges.txt" formatting.
* Version 3.65
* - Improved CompareLangFile testing for translation files.
* Version 3.67
* - Further improved CompareLangFile testing.
* Version 3.7
* - Fixed death transferring to Scene_Gameover not connecting variables for translation access.
* Version 3.75
* - Updated Import translation file to include potential for missing Base or Translation files.
* - Added condition to only run ExportText() during test mode
* - Fixed error in CompareJson variables
* Version 3.8
* - Fixed error in Translation Engine for text choices.
* - Added error catch for Translation Engine fails during map events.
* Version 3.85
* - Removed condition on ExportTest() during playtesting (Temporary?)
* Version 3.9
* - Adjusted to include ToolMap events.
Special Thanks:
@Woland - For his knowledge on professional standards and translation methods!
本贴来自国际rpgmaker官方论坛作者:ZephyrAM处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:
https://forums.rpgmakerweb.com/threads/localization-export-import-all-to-be-translated-text-to-json.148633/