A point-an-click is a story and text based game, so you will probably translate your game to make it accessible to more players across the language barriers!
General game strings are translated using the normal method for importing translations with Godot Engine, outside of Escoria. The most common way is using the "Import" menu, then "Translation" option, and use a CSV file there. Escoria provides a basic csv file for general UI and game strings there, found in translations/general.csv (outside of the device/ directory). The translation file is exported to device/translations/general.*.po.
All game Items have a "tooltip", a text that appears on the HUD when the mouse enters the item. This text is configured in each item, but we also need to translate it. The translation id for an item tooltip text will be the global ID of the item with the suffix ".tooltip". For convenience we also provide a setting in "Project Settings" to specifiy the default tooltip language (default value is "en" for English), and we also allow custom translated tooltip strings, in case you'd like to change the value of an item's tooltip, with an animation. The rules for translating a tooltip are:
Inside an esc file, a string can include a translation ID. The format to include an id is id:"string". For example:
say player player_speak_1:"What do you mean?"
When displaying this dialog, the game will look for the "player_speak_1" id in the loaded translations, if not found it will display the text "What do you mean?". This string format can be used anywhere where a string is found.
To translate the strings in your esc files, we provide a script that runs through all the esc files in your project, and assigns translation IDs to any string that doesn't have one. It generates a csv file with them, and also creates a new version of your esc with the translations IDs included in your strings, with the extension ".esc.lockit".
The script can be found in tools/lockit.gd (outside of the "device" directory), and it's run using the Godot runtime, from the root of your project (the "device" directory):
godot -script ../tools/lockit.gd
After it runs, you will get a file called "strings.csv" with all the strings on your esc files, separated by file, and with some context information. You'll also have all the .esc.lockit files generated. The modifications made will look like this:
say player "this is a key"
say player key_look_1:"this is a key"
Assuming this is a file called "key.esc", inside the event "look", the "key_look_1" is generated.
After running the script, you'll have a lot of ".esc.lockit" files, and you need to use these on your game. Replacing is left as an exercise to the reader :-) An example on a UNIX command line:
for f in `find . |grep esc$`; do mv $f.lockit $f; done
Remember to backup your esc files before doing this, and doublechecking that the tool run correctly and all your files are correctly generated.
On the "strings.csv" file, you'll see multiple rows and columns like this:
"box_look_1","An old newspaper","player","scenes/test/box.esc:4, ", ""
"box_look_2","It's a box","player","scenes/test/box.esc:7, ", ""
The first 2 lines are separatorts to indicate a new file (box.esc) and a new event (look). Then you have a couple of rows with the string ID, the string content, the name of the character speaking (if it's a "say" command, otherwise the name of the command), and the path and line where the string was found. On the following columns, you can place your translated strings.
TODO : EXAMPLE FROM THE GAME
After you're done translating, you'll have a csv file with all your strings, but you can't use it directly as described in the first part of this chapter, because we have some extra rows to delimit the file and event where strings were found. Getting rid of these rows is left as exercise to the reader :-) An example on the UNIX shell:
grep -v "^#" strings.csv |grep -v "^$"|grep -v "^,*$" > strings_final.csv
This should get rid of all the lines that start with the "#" character. Remember to keep backups and make sure all you shell commands are running correctly.
After this, you should be able to import the "strings_translated_final.csv" file into Godot for translations.
Il y a une erreur de communication avec le serveur Booktype. Nous ne savons pas actuellement où est le problème.
Vous devriez rafraîchir la page.