Localization - Translate your project into several languages
JS Plugin Releases (RMMZ)Yep... I'm doing exactly what is in that post (or I think I'm doing it).
I think I'm missing some step... made a fresh game here to test again:
1. I went to plugin manager, DKTools, and changed File System to Mode 0: Nwjs + Stamp (not really changed... because it was in that).
so I made the translations in the language folder (locales/en/main.json and locales/pt/main.json)
2. I put an event in my map... to Run UpdateFileSystemStamp... after it executed, I receive the message: "System stamp updated!" and RPG Maker MZ said to me that the data was modified externally, so I reload the data.
I closed the game, disabled the event, and checked at the data folder, I have the Stamp.json there.
3. So i compiled the game to Browsers / Android / iOS
(Put to exclude non used files, because without this option itch.io complains about the amount of files).
In the Output game I checked something:
I have the Stamp.json in the data folder.
In locales folder in don't have en.json and pt.json. It is still /en/main.json and /pt/main.json.
I zipped everything and send it to server...
And again... "Uncaught Error: Localization file does not exist: locales\en.json"
If I try to run index.html in my machine, I received the same error.
What im missing?
Okay, I'll take a look
Version 1.2.1
I once again having this "Uncaught Error: Localization file does not exist: locales\en.json" problem but this time it was when I was running the game on Xcode iOS Emulator. On Android it runs fine. I did all the Stamp steps again but idk why it didn't work.
Unfortunately I do not have IOS and Mac to check the error, I will try to do something.
Version 1.3.0:
- Added language switcher function in messages. You can now view messages in different languages while playing. The function does not work when selecting an item or entering numbers. Don’t forget to customize the button to open the window.
- Help updated.
Version 1.3.1:
- Added support for CSV files. Now you can select the file format you want to use in your project in the plugin settings. Each format has its own pros and cons. For example, when using CSV, translate text into different languages in one file. You can also edit the translation with several people at the same time using online tools (for example, Google Docs).
- The plugin commands UpdateLocalizationTags and ExportAllText have been updated. Fixed a bug due to which these commands did not process plugin parameters. Also UpdateLocalizationTags now supports CSV format.
- Help updated.
Thanks for the CSV support
I'm having trouble when starting up the game in test mode. I believe I have followed the instructions provided. The only other plugins I have are VisuStella MZ ones. I'm running MZ 1.3.0, DKTools V1.1.3 and DKTools V1.3.1.
rmmz_managers.js:1968 TypeError: Cannot read property 'trim' of undefined
at DKTools_Localization.js:2778
at Array.forEach (<anonymous>)
at processCsvFile (DKTools_Localization.js:2771)
at async Promise.all (index 0)
at async Function._loadData (DKTools_Localization.js:2799)
at async Function.loadData (DKTools_Localization.js:2847)
at async Function.initialize (DKTools_Localization.js:2144)
at async Function.DKTools.StartupManager.initializeModules (DKTools_Localization.js:3116)
at async Function.initialize (DKTools.js:7670)
at async Function.SceneManager.initialize (DKTools.js:16683)
SceneManager.onError @ rmmz_managers.js:1968
rmmz_managers.js:1969
undefined undefined
SceneManager.onError @ rmmz_managers.js:1969
DKTools_Localization.js:2778 Uncaught (in promise) TypeError: Cannot read property 'trim' of undefined
at DKTools_Localization.js:2778
at Array.forEach (<anonymous>)
at processCsvFile (DKTools_Localization.js:2771)
at async Promise.all (index 0)
at async Function._loadData (DKTools_Localization.js:2799)
at async Function.loadData (DKTools_Localization.js:2847)
at async Function.initialize (DKTools_Localization.js:2144)
at async Function.DKTools.StartupManager.initializeModules (DKTools_Localization.js:3116)
at async Function.initialize (DKTools.js:7670)
at async Function.SceneManager.initialize (DKTools.js:16683)
VisuMZ_1_OptionsCore
Symbol: locale
JS Text:
return LocalizationParam.get('Options Command Name');
Accessibility
JS: Show/Hide
return Imported['DKTools_Localization'] && LocalizationParam.get('Show Options Command');
JS Draw
// Declare Constants
const index = arguments[1];
const title = this.commandName(index);
const rect = this.itemLineRect(index);
const halfWidth = rect.width / 2;
// Draw Command Name
this.resetFontSettings();
this.changePaintOpacity(true);
this.drawTextEx(title, rect.x, rect.y, halfWidth, 'left');
this.drawText(this.statusText(index), rect.x + halfWidth, rect.y, halfWidth, 'center');
// Draw Status Text
const off = 'OFF';
const on = 'ON';
this.changePaintOpacity(!value);
this.drawText(off, rect.x + halfWidth, rect.y, quarterWidth, "center");
this.changePaintOpacity(value);
this.drawText(this.statusText(index), rect.x + halfWidth, rect.y, halfWidth, 'center');
Note* I'll be purchasing a license once I know I can get it to run.
I'm having trouble when starting up the game in test mode. I believe I have followed the instructions provided. The only other plugins I have are VisuStella MZ ones. I'm running MZ 1.3.0, DKTools V1.1.3 and DKTools V1.3.1.
rmmz_managers.js:1968 TypeError: Cannot read property 'trim' of undefined
at DKTools_Localization.js:2778
at Array.forEach (<anonymous>)
at processCsvFile (DKTools_Localization.js:2771)
at async Promise.all (index 0)
at async Function._loadData (DKTools_Localization.js:2799)
at async Function.loadData (DKTools_Localization.js:2847)
at async Function.initialize (DKTools_Localization.js:2144)
at async Function.DKTools.StartupManager.initializeModules (DKTools_Localization.js:3116)
at async Function.initialize (DKTools.js:7670)
at async Function.SceneManager.initialize (DKTools.js:16683)
SceneManager.onError @ rmmz_managers.js:1968
rmmz_managers.js:1969
undefined undefined
SceneManager.onError @ rmmz_managers.js:1969
DKTools_Localization.js:2778 Uncaught (in promise) TypeError: Cannot read property 'trim' of undefined
at DKTools_Localization.js:2778
at Array.forEach (<anonymous>)
at processCsvFile (DKTools_Localization.js:2771)
at async Promise.all (index 0)
at async Function._loadData (DKTools_Localization.js:2799)
at async Function.loadData (DKTools_Localization.js:2847)
at async Function.initialize (DKTools_Localization.js:2144)
at async Function.DKTools.StartupManager.initializeModules (DKTools_Localization.js:3116)
at async Function.initialize (DKTools.js:7670)
at async Function.SceneManager.initialize (DKTools.js:16683)
VisuMZ_1_OptionsCore
Symbol: locale
JS Text:
return LocalizationParam.get('Options Command Name');
Accessibility
JS: Show/Hide
return Imported['DKTools_Localization'] && LocalizationParam.get('Show Options Command');
JS Draw
// Declare Constants
const index = arguments[1];
const title = this.commandName(index);
const rect = this.itemLineRect(index);
const halfWidth = rect.width / 2;
// Draw Command Name
this.resetFontSettings();
this.changePaintOpacity(true);
this.drawTextEx(title, rect.x, rect.y, halfWidth, 'left');
this.drawText(this.statusText(index), rect.x + halfWidth, rect.y, halfWidth, 'center');
// Draw Status Text
const off = 'OFF';
const on = 'ON';
this.changePaintOpacity(!value);
this.drawText(off, rect.x + halfWidth, rect.y, quarterWidth, "center");
this.changePaintOpacity(value);
this.drawText(this.statusText(index), rect.x + halfWidth, rect.y, halfWidth, 'center');
Note* I'll be purchasing a license once I know I can get it to run.
Version 1.3.2:
- Added delimiter setting for CSV files, by default - ";".
When using this plugin for localization can end-users add additional languages without needing to have access to RPG Maker or digging through the general source code files of the game?
Now there is no such possibility. The new language will have to be added by changing the plugins.js file.
How hard would it be to have the plugin save/read the list of languages to/from a "languages.js" file in the same folder as the language files?
I will add this capability in one of future update.
Hey, I have a problem with translation of pictures in exported project. I have translated some of the disclaimer texts and such in other languages, but despite putting them under different language such as pictures/ru with same name as the english one, it's not displaying the pictures in other languages?
This seems to work in the editor, but not exported project.
This seems to work in the editor, but not exported project.
Exported project on which platform? Pc, web, mobile?
Do you have a demo? You can send?
Do you mean the exported project?
No, project demo
Original thread: https://forums.rpgmakerweb.com/threads/localization-translate-your-project-into-several-languages.126316/