Translating a game or an app can be boring and very dificult sometimes.
Now, with the Transalte plugin, it's a bit easy !
First, download the project from github, then extract it to a folder in your C2/plugin folder.
Restart construct 2.
The file is JSON. If you don't know JSON, you can read about it here
The format is simple :
It's the language by default, if you didn't choose anyone.
It's the list of supported languages. Don't put a language here if you didn't translate the all the fields (NOTE : If a field is not available in the selected langauge, default_language will be used)
play_button next_button greeting_text
You'll have to enter these name to retrieve the according translation. Make sure you choose simple names otherwise you'll have to keep an eye every time on your transaltion file.
Inside these names, you will have to enter the translation according to a key:value system.
Where key is your language and value is the translation.
I think it's all for this part :)
Now, let's go to the construct part !
The first you have to do, is to load the translation file you've just made.
For this, there are two ways.
Retrieving the file - Local
Put the file inside your project files and make an AJAX request (it's a native plugin) to retrieve it's data
Then load the retrieved value with the Load action of the transalte plugin.
Just put AJAX.LastData inside the field.
Retrieving the file - Distant
Imagine you don't want to translate the file yourself.
Put the file on a communautary website like github and instead of making an ajax request to a project file, make it to the raw url to the transaltion file.
You now just have to let people do the work on you public repository, validate the changes and the project is translated. No need to update the project.
CAUTION : If your project can also run offline make sure to have a copy of the file inside the project, otherwise, there probably be a problem when your user have no connection, haha ...
Make an update function that you can call directly on the begining of the layout and also when the user change the language.
Set the text of each of your object to
Note that this function take two parameters.
The first parameter is the string you defined in your JSON file.
The second parameters is to pass parameter to the string.
In my JSON file, I have defined that a field will take parameters :
The parameter are between "$"
To replace these parameters, fill the second parameter of the plugion action like this :
I think now you are ready ! If you have any questions fell free to ask onthe forum or on the c2 discord server
Based on a TheRealDannyyy idea.