Phileas's Language Localisation

Plugin name: Phileas's Language Localisation

Author: Phileas

Version: 1.3.3 for MZ

Release date:
1.0.0 - 2024.November.09
1.1.0 - 2024.November.16
1.2.0 - 2024.November.29
1.2.3 - 2025.January.04
1.2.4 - 2025.January.12
1.2.5 - 2025.January.19
1.2.6 - 2025.January.20
1.2.7 - 2025.January.26
1.3.0 - 2025.February.15
1.3.1 - 2025.March.15
1.3.2 - 2025.April.06
1.3.3 - 2025.May.03


Plugin description:
The plugin allows to translate all the text in the game into many languages.

To support custom fonts, install the Phileas's Custom Fonts plugin.

Use the Phileas's Text Wrap plugin to automatically move words to a new line.

If you are using the Phileas's Options Manager plugin, place it above the real plugin in the Plugin Manager menu.

INSTALLATION
Spoiler: INSTALLATION
For the plugin to work, you need to install Phileas's File Manager.
If you need commands to export and import language data to XLSX, then install the XLSX library.
You can delete the library file before deploying the game to save space.

MANUAL
Spoiler: MANUAL
1. Configure the "Languages" parameter. Set the language codes. It is important that they are unique.

2. Create a "languages" folder in the root of the project.

3. In the "languages" folder, create language folders, name each folder must match the language code.

4. Create a "main.json" file in each language folder. It will store the root properties of the language dictionary. There must be an object (curly brackets) at the root of this file.

5. You can add other localization files. It is important that the list of files in each language data folder matches. You can create subfolders of any level.

6. At the root of the file should be either an object (curly brackets) or an array (square brackets).

7. Fill in the localization files with text. The structures of all objects must match, only the final string values can differ.

8. To use localized text in the game, type a line like this in the right place:

${<text code>}

<text code>
The text code should lead to the value in the localization files.

9. The properties specified in "languages/<text code>/main.json", will be at the root of the localization dictionary. For example, if main is set like this:


JSON:
{
       "yes": "Yes"
}

To use this value, type this:
${yes}

10. If the property is specified in another file, then you need to specify the path to the file before its name. For example, if you have a file with the path "../languages/<text code>/chapter_1/dialogues.json" and such a structure:


JSON:
{
    "point_0": "Реплика"
}

To use this value, type this:
${chapter_1.dialogues.point_0}

11. In addition to objects, you can use arrays. Let's change the example from point 9:

JSON:
{
       "point_0":
       [
           "Hello",
           "Bye"
       ]
}

To use these values, type this:
${chapter_1.dialogues.point_0[0]}
${chapter_1.dialogues.point_0[1]}

12. The array can be located right at the root of the localization file (except for the "main.json"). Let's change the example from paragraph 10:

JSON:
[
       [
           "Hello",
           "Bye"
       ]
]

To use these values, type this:
${chapter_1.dialogues[0][0]}
${chapter_1.dialogues[0][1]}

13. You can optionally nest objects and arrays into each other. The nesting level is unlimited!

14. You can also use the translated text inside the translated text:


JSON:
"first_text": "Simple example",
"second_text": "The first text is ${first_text}."

15. To use control symbols to set text, use a variable,
icon, and more, add a second slash:

\C[0] -> \\C[0] OR \V[1] -> \\V[1] OR \. -> \\.

16. The plugin provides the following commands:
  • "Set the language" - changes the current language localization.


LOCALIZED RESOURCES (MEDIA)
You can use different files (audio, images, video) for each language.
The function works for all types of images (animations, pictures, tilesets and others), all types of audio (BGM, BGS, ME, SE) and video (movies).

Manual:
  1. The language specified first in the "Languages" parameter is considered the default language. For example, the default language may be with the code "en".
  2. Place the media file to the directory you need. This should be a file for the default language. For example, you can execute an image in the "img/pictures" directory. Let it be "a.png":
    "img/pictures/a.png"
  3. If you want another image for a different language to appear instead of this image, create a folder in the same directory. Its name must match the code of the desired language. Example:
    "img/pictures/ru".
  4. In this new directory, create a media file with the same name and relative path:
    "img/pictures/ru/a.png".
  5. In the "Show Picture" command, select the file for the default language. If a second language is enabled in the game settings, a picture for this language will appear.
  6. You don't have to create a separate file for each language. If a file for any language is not found, the file for the default language will be used.
  7. You can use subfolders. Then the relative paths must match. Example:
    "img/pictures/sub_folder/b.png"
    "img/pictures/ru/sub_folder/b.png"

COMPATIBILITY WITH OTHER PLUGINS
The plugin is compatible with "Phileas's Text Wrap".
Place this plugin under "Phileas's Text Wrap" in the Plugin Manager.

The plugin is compatible with "TAA_BookMenu".
Place this plugin under "TAA_BookMenu" in the Plugin Manager.

If you are using "Phileas's Language Localization", "Phileas's Text Wrap" and "TAA_BookMenu" at the same time, arrange them exactly in this order in the Plugin Manager:
  1. TAA_BookMenu
  2. Phileas_TextWrap
  3. Phileas_LanguageLocalisation

How it looks like:
Spoiler: How it looks like
2024-11-11_04-57-41.png


2024-11-11_04-57-51.png


2024-11-11_04-58-05.png


2024-11-11_05-12-05.png


2024-11-11_04-57-41.png

DEMO PROJECT
Download
Launch online

Code

License

This plugin is released under MIT license.
This means that you can freely use the plugin in non-commercial and commercial games and even edit it.
But be sure to include me in the credits!

Compatibility:
If there are any problems, write to me.
1.1.0

Added the ability to use localized media files (images, audio, video).
Updated the demo project.
Instructions under the spoiler, added to the first post:

Spoiler: MANUAL
LOCALIZED RESOURCES (MEDIA)
You can use different files (audio, images, video) for each language.
The function works for all types of images (animations, pictures, tilesets and others), all types of audio (BGM, BGS, ME, SE) and video (movies).

Manual:
  1. The language specified first in the "Languages" parameter is considered the default language. For example, the default language may be with the code "en".
  2. Place the media file to the directory you need. This should be a file for the default language. For example, you can execute an image in the "img/pictures" directory. Let it be "a.png":
    "img/pictures/a.png"
  3. If you want another image for a different language to appear instead of this image, create a folder in the same directory. Its name must match the code of the desired language. Example:
    "img/pictures/ru".
  4. In this new directory, create a media file with the same name and relative path:
    "img/pictures/ru/a.png".
  5. In the "Show Picture" command, select the file for the default language. If a second language is enabled in the game settings, a picture for this language will appear.
  6. You don't have to create a separate file for each language. If a file for any language is not found, the file for the default language will be used.
  7. You can use subfolders. Then the relative paths must match. Example:
    "img/pictures/sub_folder/b.png"
    "img/pictures/ru/sub_folder/b.png"
1.2.0
  • Added data export to XLSX and import from XLSX.
  • If the language is not selected when starting the game, the plugin displays the language selection menu.
Updated the demo project.
A couple of screenshots of the new export to XLSX feature.
This is how the localization files look like:

2024-11-30_23-24-44.png
2024-11-30_23-25-02.png


The result is a table like this:

2024-11-30_23-25-46.png


For convenience, the file data is divided into tabs.
1.2.3

Expanded customization of the language selection menu.
Now you can disable it. Then the first time you start the game, the first language from the "Languages" parameter will be set.
1.2.6
Added compatibility with the TAA_BookMenu plugin.
Added to the description:

COMPATIBILITY WITH OTHER PLUGINS
The plugin is compatible with "Phileas's Text Wrap".
Place this plugin under "Phileas's Text Wrap" in the Plugin Manager.
The plugin is compatible with "TAA_BookMenu".
Place this plugin under "TAA_BookMenu" in the Plugin Manager.
If you are using "Phileas's Language Localization", "Phileas's Text Wrap" and "TAA_BookMenu" at the same time, arrange them exactly in this order in the Plugin Manager:
  1. TAA_BookMenu
  2. Phileas_TextWrap
  3. Phileas_LanguageLocalisation
1.2.7
Fixed a floating bug in loading language data. Sometimes, after starting the game, text codes were displayed instead of a part of the text.
1.3.0
  • I've moved the XLSX library code to a separate file. You can download it here.
  • Fixed a floating bug when displaying the title screen.
  • The plugin now works correctly in the browser and mobile platform versions. But you need to install Phileas's File Manager.
  • Deleted the language files parameter. Now the plugin automatically scans the directories and generates a list of these files. It works on all platforms.
1.3.1
Now, in the language selection menu, you can adjust the horizontal padding of the item text.
1.3.2
Added file filtering by the "json" extension to the automatic generation of the localization file list. Previously, when there was no filtering, the plugin did not work correctly on MacOS: system files were added to the file list.
1.3.3
Fixed config loading.

Original thread: https://forums.rpgmakerweb.com/threads/phileass-language-localisation.173148/