Multi language support

Get help using Construct 2

Post » Tue Mar 20, 2012 11:21 am

I searched the forum but couldn't find anything about this..
Is there any way to offer multi-language (localization) support in c2? It looks like I'm doomed to put several if conditions at the current state? Is there any other solution?


Thanks
B
29
S
9
G
6
Posts: 525
Reputation: 8,294

Post » Tue Mar 20, 2012 11:40 am

Nice question. Was wondering the same myself.
B
25
S
8
G
7
Posts: 184
Reputation: 6,040

Post » Tue Mar 20, 2012 12:06 pm

I only find it in
[code]Your Construct2 folder\languages\[/code]
B
97
S
22
G
179
Posts: 4,126
Reputation: 104,559

Post » Tue Mar 20, 2012 12:14 pm

But that is notr related to your creations, but C2 itself.
B
25
S
8
G
7
Posts: 184
Reputation: 6,040

Post » Tue Mar 20, 2012 12:30 pm

I thought of this myself and had a few ideas for current workarounds:

1. Arrays
You could define an array to hold all the languages.
On runtime, you can select the array corresponding to the selected language.
Problem with this, you have to manually edit the array every time something changes and you have to recompile.

2. Outsourced Languagefiles (maybe a simple PHP Script?)
You can setup language files on your server and you get the strings per AJAX GET or POST Request.
Problem, you need to know how to script such stuff :)
B
42
S
9
G
6
Posts: 437
Reputation: 5,626

Post » Tue Mar 20, 2012 2:22 pm

Outsourced language files are not viable as they require constant internet access and possibily a json parser to actually divide the language file that comes from php.

The array is a good idea but it's still in the same ballpark as making several if (ie not very "comfortable" to manage)
B
29
S
9
G
6
Posts: 525
Reputation: 8,294

Post » Tue Mar 20, 2012 4:18 pm

The "Configurations" feature was partly aimed at this. You can create a different configuration for each language, and edit object properties separately in each configuration, e.g. setting different Text strings. However it's not really a finished feature. Some kind of plugin to help with localisation might be necessary.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,630

Post » Wed Mar 21, 2012 11:26 am

I had a an idea which I'm using for my project.

It's not easy maybe, but I'm accustomed to working with arrays so for my mindset it's pretty easy.
You do something like this:

You write in a file
Dog,Cat,Flower
Cane,Gatto,Fiore
Perro,Gato,Flor
..

Then lerp to select language, if you name buttons and labels as numbers it's easier to then assign them using a for cycle.
B
29
S
9
G
6
Posts: 525
Reputation: 8,294

Post » Wed Mar 21, 2012 10:37 pm

Does the plugin loadJSON fit?
B
14
S
6
G
5
Posts: 173
Reputation: 4,742


Return to How do I....?

Who is online

Users browsing this forum: Zebbi and 21 guests