Rename/translate the name of objects already created in the database

Hello everyone,

I'm trying to translate my game to other languages and I don't want to use external plugins.
My intention is that within the game you can choose the language and change both the titles of the menus and the objects/items that the player has.
I have managed to change the titles of the menus using the Script command:
Captura de pantalla 2022-02-22 a las 14.25.14.png


But I can't find the command to force the name of a particular object.
The objects are already created in the database (in Spanish) but if the player, within the game, changes the language to English, the object that they already have in the inventory has to be translated into the selected language. Both the name of the object and its description.

What js command is the one that adds the names to the objects? And which js file should I look at exactly?

I hope you understand what I mean.
Thank you all.
What you've done in your screenshot is override those methods for that play session. If the player closes and launches the game again, everything will load from the original data files, i.e. the changes will be lost.

You can change data for a database object like this:

$dataItems[1].name = "Potion"; $dataItems[1].description = "Looks tasty!"
Every type of object is stored in its own database array: $dataSkills, $dataArmors, etc. Each type is loaded from the corresponding file in the project's data folder. However, this approach still has the problem I just described: everything will reset when the player re-launches the game.

I think the most sensible options here are to either:
  • Use a plugin (e.g. for localisation / language-switching); or
  • Deploy one version per language.
Maybe explain why you don't want to use "external plugins"?
Thanks for your answer.
That was what she was looking for.

About what you say that if the player restarts the game and everything is deleted, I knew it. But in my game I have removed the title screen and created my own menu within an in-game map.
When the player enters the menu and returns to the title, it really only returns to a map where everything is saved in that session.
What you said can only happen if the player closes the game completely, then the language would restart.

I was looking for translation plugins but I really don't know much about javascript and I don't understand very well the use of those translation plugins.

Is it possible to save those preferences in some way? Or is it very complicated to do?

If it is not possible, what plugin do you recommend for the MZ and that has tutorials to understand it well?

Thanks!
Plugins may have extra stuff like parameters etc, but basically they just override/extend the existing methods, sort of like you're doing with those script calls. Localisation of an RPG Maker game is a bit complicated because by default the engine doesn't use a central database for its text, e.g. a Show Text command stores its text in the event/map data, not in the database. 😅

A simple way to implement multiple languages is to have one set of files per language, and reload when the language is changed. For on-demand resources (e.g. images, audio, movies) a plugin can redirect to the current language's version of the file when necessary. Different plugins may work differently. I did a quick search and found this one for MZ, looks like it has a demo, too:
If you want help to understand how to use a plugin, you can ask the plugin author, or make a new thread with a link to the plugin's page and an explanation of what you don't understand about it:

To make data persist from one session to the next, you could look for plugins that offer "persistent", "global", or "synced" switches/variables, i.e. the values of those switches/variables will be the same for all saves.

Without plugins...in your case, if it launches directly into a new game, maybe try to load the most recent save file? E.g. a Script command like this before showing the menu (untested):
JavaScript:
DataManager.loadGame(DataManager.latestSavefileId())
  .then(() => {
    $gameSystem.onAfterLoad();
    SceneManager._scene.fadeOutAll();
    if ($gameSystem.versionId() !== $dataSystem.versionId) {
      $gamePlayer.reserveTransfer($gameMap.mapId(), $gamePlayer.x, $gamePlayer.y);
      $gamePlayer.requestMapReload();
    }
    SceneManager.goto(Scene_Map);
  });
Then you can check a variable (e.g. 0 = Spanish, 1 = English, etc) and apply changes if necessary. I don't generally recommend applying overrides using script calls like you have done, but I think it should work. 😴
Plugins may have extra stuff like parameters etc, but basically they just override/extend the existing methods, sort of like you're doing with those script calls. Localisation of an RPG Maker game is a bit complicated because by default the engine doesn't use a central database for its text, e.g. a Show Text command stores its text in the event/map data, not in the database. 😅

A simple way to implement multiple languages is to have one set of files per language, and reload when the language is changed. For on-demand resources (e.g. images, audio, movies) a plugin can redirect to the current language's version of the file when necessary. Different plugins may work differently. I did a quick search and found this one for MZ, looks like it has a demo, too:
If you want help to understand how to use a plugin, you can ask the plugin author, or make a new thread with a link to the plugin's page and an explanation of what you don't understand about it:

To make data persist from one session to the next, you could look for plugins that offer "persistent", "global", or "synced" switches/variables, i.e. the values of those switches/variables will be the same for all saves.

Without plugins...in your case, if it launches directly into a new game, maybe try to load the most recent save file? E.g. a Script command like this before showing the menu (untested):
JavaScript:
DataManager.loadGame(DataManager.latestSavefileId())
  .then(() => {
    $gameSystem.onAfterLoad();
    SceneManager._scene.fadeOutAll();
    if ($gameSystem.versionId() !== $dataSystem.versionId) {
      $gamePlayer.reserveTransfer($gameMap.mapId(), $gamePlayer.x, $gamePlayer.y);
      $gamePlayer.requestMapReload();
    }
    SceneManager.goto(Scene_Map);
  });
Then you can check a variable (e.g. 0 = Spanish, 1 = English, etc) and apply changes if necessary. I don't generally recommend applying overrides using script calls like you have done, but I think it should work. 😴
Thank you for your advice.

In the end I was investigating the DK plugin and it seems better to work with it.

👍

Original thread: https://forums.rpgmakerweb.com/threads/rename-translate-the-name-of-objects-already-created-in-the-database.145146/