Introduction to localization – SRPG Studio

Introduction to localization – SRPG Studio 1 -
Introduction to localization – SRPG Studio 1 -

When you want to translate games you developed into other languages, how would you go about doing that?

Introduction to localization

When you want to translate games you developed into other languages, how would you go about doing that? Probably the last thing you would want to do is make a project file for each language. In such a case, not only would you have to make a project file for the English version of your game, but you would have to make one for each language you plan on translating into (such as Japanese, etc.). If you were to do that, you would have to open and edit every project file any time you wanted to add or change anything, and it would be hard to manage. The only real difference between the project files is probably the text, so wouldn’t it be simpler if you could extract said text into separate files for editing?
We added the Localization feature to SRPG Studio with this priniciple in mind. The feature outputs JSON files containing the names of things like players and items, so all that needs to be done is changing the contents of said JSON files. JSON files are basically just text files, so you can open them in your favorite editor and search and replace text at will. This also makes it easy to compare past versions of text with the use of version control. Furthermore, a noticeable characterstic of these JSON files is that they only contain ids and text. With just one look you can tell what needs to be translated, which makes it easier to give these JSON files to professional translators.

Outputting data to JSON files

Now that we have the basic idea down, let’s see how we can actually create these JSON files. First, open SRPG Studio and click on “Localization” from the top menu. You should see 2 options appear.

Introduction to localization - SRPG Studio - Outputting data to JSON files - 69F172452

You’ll probably first want to select “Output Data in JSON Format”. The following dialog will appear when selected.

Introduction to localization - SRPG Studio - Outputting data to JSON files - AF937F083

Clicking on OK will create a Localization folder within the project folder, along with a folder containing all the necessary JSON files inside it. In our example, let’s suppose you are making your project in English and you want to release your game in Japanese. It might be easiest to understand what that folder contains if we were to name it “japanese”.
Up to this point, all the text data for your project has been output in JSON format to this “japanese” folder. Let’s see what’s inside.

Introduction to localization - SRPG Studio - Outputting data to JSON files - B1EE27827

You can probably guess from the image what each file conains just by looking at the name. For example, players.json contains only ids and text extracted from “Database/Players”. However, just because we named the folder “japanese”, it does not mean the contents of the JSON files have magically turned into Japanese. Since we are supposing the project is being made in English, naturally the JSON files will also be in English. We named this the “japanese” folder with the intention of eventually translating all that text into Japanese.

Editing JSON files

Let’s try localizing something. If you were to open the sample game 1 project and output its JSON, players.json would look like this.

{"id": 0,"name": "Nash","desc": "SRPG Studio world explorer","command": [],"msg": []},
{"id": 1,"name": "Lambert","desc": "Collaborator with Nash by order of Master","command": [],"msg": []},
{"id": 2,"name": "Lucy","desc": "Collaborator with Nash by order of Master","command": [],"msg": []},
{"id": 3,"name": "Helen","desc": "Person who waits for Nash's arrival","command": [],"msg": []}

As stated before, if you are developing your game in English, then it’s only natural that the output text is also in English. Localization sounds like some grand process, but it’s really just overwriting the contents of these JSON files. If you want to localize to Japanese, just change the file like below.

{"id": 0,"name": "ナッシュ","desc": "SRPG Studioの世界を探求する者","command": [],"msg": []},
{"id": 1,"name": "ランバート","desc": "マスターの命により、ナッシュに協力する者","command": [],"msg": []},
{"id": 2,"name": "ルーシー","desc": "マスターの命により、ナッシュに協力する者","command": [],"msg": []},
{"id": 3,"name": "ヘレン","desc": "ナッシュの到達を待つ者","command": [],"msg": []}

Just like that, players.json has been localized. Quite simple, right? When you open Nash’s unit menu in your game, it won’t display “Nash” anymore. Instead, “ナッシュ” should appear.

What about text within events?

It is quite perceptive of those who thought to themselves “Isn’t this exporting only the data from the database?”. Even if we replace all the text in the JSON files, we might have all the names of our data in Japanese, but our events would still be in English. To solve this, we just need to extract all event commands that contain text. Believe it or not, SRPG Studio has had this feature for a while. When the dialog is closed with the “Include Event Text in export” option selected, a folder called “_EventText” will be automatically generated for you, so you don’t need to manually export the text yourself. If you do want to export event text for localization manually, you can do it from the Resource menu under “Text File/Export”. Clicking on it will make the following dialog appear.

Introduction to localization - SRPG Studio - What about text within events? - 11371D123

Make sure to do the following 3 steps before selecting OK in this dialog.
1. Put a check in all check boxes
2. Name the last folder _EventText
3. Export as map id format
If you click OK having done these steps, there should now be a folder called _EventText on your desktop. Add it to your Localization/japanese folder and you’re all set.

Let’s make sure the in-game text has changed!

While it certainly is convenient to localize with just the use of text files and not have to edit the project file itself, it does not change the hard fact that translating is a time-consuming and costly process. It can feel so far off to wait to test play until localization is completely finished. Why not first try changing a little bit of text and testing it as you go to make sure it’s being reflected in-game? All you need to test play is to select the JSON folder to use for localization.

Introduction to localization - SRPG Studio - Let's make sure the in-game text has changed! - C42D66BCE

Select the menu item like in the image above to make the following dialog appear.

Introduction to localization - SRPG Studio - Let's make sure the in-game text has changed! - 450932B74

This dialog contains a list of all the folders inside the Localization folder. If you select “None”, your game will display text as you’ve input it in the project file (in our example, in English). This is expected behavior, as the localization files are not being referenced. On the other hand, if you select “japanese”, this means your game will reference the “japanese” folder when you test play it. After selecting “japanese”, check to make sure your localization changes are appearing as expected during test play.

What to do when releasing your game

Did you notice a file called localization.dat was created in the Localization folder when you test played? This file is actually the encrypted version of the JSON folder (for example, the “japanese” folder). Copy this file into the game folder like below to finish up the localization process.

Introduction to localization - SRPG Studio - What to do when releasing your game - 9B22954C9

However, the folder name selected from “Select JSON Folder” is saved in the project file, and localization.dat will automatically be copied over when you release your game, so there’s no need to manully copy it over. We recommend releasing your game right after test playing. That way, the latest localization.dat will be copied over.

Let’s check out the localized sample game!

SRPG Studio comes with a sample game, so this is a good way to confirm the effects of localizing. We’ve prepared a sample project that contains a Localization folder in the URL below.
This sample project has a “japanese” folder in the Localization folder. You will also notice that “japanese” is selected under “Select JSON Folder” in the editor. As a result, the text displayed during test play is in Japanese.

What about text inside of plugins?

For plugins, users will need to add conditional statements. For example, the offical plugin config-enemyunitspeed.js contains the following code.

getConfigItemTitle: function() {
 return 'Enemy Unit Speed';

For places that use text like this, add a conditional statement.

getConfigItemTitle: function() {
 var folder = root.getLocalizationFolder();
 if (folder === 'english') {
 return 'Enemy Unit Speed';
 else if (folder === 'japanese') {
 return '敵ユニットスピード';
 return '';

Calling root.getLocalizationFolder() will get the language the game is running in. In other words, it can be used to identify the name of the selected JSON folder, so you can return different text for each language.

What about text inside of custom parameters?

Only strings will be extracted and saved as an array of strings in the JSON files.

FAQ regarding other essential and minor details

-Q1 My game has voice acting. Is that a problem for localizaing?
-A1 Not at all. The name of the voice folder can also be localized. Presumably, you have created a voice folder for English voices and put voice files there. In order to localize, make a voice folder for Japanese voices and put Japanese voice files with the same name there. That way, there is no need to change the control characters (like vo[n1]) in message event commands.
-Q2 Can text data contain new lines? For example, the difficulty explanation uses 2 lines.
-A2 Yes, they can contain new lines. New lines are recorded as * in the JSON files. When game.exe loads localization.dat, all * are converted to new lines.
-Q3 Can text data contain double quotation marks?
-A3 As of now, double quotation marks pose a problem. You will need to surround text with ” (2 single quotation marks) instead. It is fine to use double quotation marks in event text.
-Q4 Are the format and names of the JSON files inside the Localization folder the final version? Is it all right to start translating right away?
-A4 Currently, the feature is still in the beta phase, but it is very likely that the format and names will be finalized as they are now. It might be a good idea to try editing a little bit of each type of file before going all out on one file.
-Q5 What data does titles.json contain? id3 and id4 are blank.
-A5 id3 is for the voice folder’s name. id4 is for Staff Roll.
-Q6 What data does texttags.json contain?
-A6 This file stores the tags used in the _EventText folder. If you are using the Steam version of SRPG Studio, you can get the texttags.json for each language by changing the language in Steam and outputting JSON.
-Q7 What’s the point of globalswitches.json and variables1.json. It feels like there wouldn’t be any opportunities to see switch and variable names in-game.
-A7 Switch and variable names can be seen if “Switches” is selected under “Game Layout / Command Layout”, so we decided to output them as well. Normally, there won’t be a need to edit these JSON files.
-Q8 Why does the constants folder have a JavaScript file instead of a JSON file?
-A8 This is because some text is defined via script rather than within the project file. Editing constants-stringtable.js is directly related to localizing. If you are using the Steam version of SRPG Studio, you can get the constants-stringtable.js for each language by changing the language in Steam.
-Q9 Do I need to run “Output Data in JSON Format” only once?
-A9 No. If you create any new data in SRPG Studio, you will need to output JSON again. For example, let’s say you added an original mapchip (id0) to mapchip resources. The terrain related to the mapchip will automatically be generated for you in SRPG Studio, but it will not automatically generate OriginalTerrain000.json in the Terrain folder. Because of that, you will need to output JSON and merge the contents with the previous JSON folders when adding data.
-Q10 Suppose I select the japanese folder, start a new game, and save. Will it be possible to load the save file in a different language?
-A10 When you save a game, the selected JSON folder’s name will be saved. Upon loading a save file, the name of the folder selected in SRPG Studio and the name of the folder saved in the save file will be compared. If they don’t match, the folder name selected in SRPG Studio will be used. In other words, if “japanese” is saved in the save file and “english” is selected in SRPG Studio, the names of players, etc. will be displayed according to the contents of “english”.
-Q11 Is it okay to change unit names (and descriptions) dynamically with things like unit.setName (or setDescription)?
-A11 Unit names (and descriptions) are saved to save files, but if you load a “japanese” save file with “english” selected, problems will arise. Names/descriptions set with unit.setName (setDescription) will be overwritten by the contents of the “english” folder.
-Q12 Descriptions and victory conditions can be set with the event commands “Change Unit Info” and “Change Map Info”. But I don’t see the text for these in the JSON folders. Why is that?
-A12 This is a dilemma we are currently tackling. We are searching for a solution, so stay tuned.

Written by SapphireSoft

This is all we can share for Introduction to localization – SRPG Studio for today. I hope you enjoy the guide! If you have anything to add to this guide or we forget something please let us know via comment! We check each comment! Don’t forget to check for MORE!

Be the first to comment

Leave a Reply

Your email address will not be published.