Nada Al-Shehari
Nada Al-Shehari

Reputation: 11

Having a flash game that allows the user to choose a language

I'm creating a flash game (adobe animate and actionscript 3), and after the splash screen it should ask the user for a preferred language (choosing between two), and then it will take them to the home screen that's in the chosen language, and since I'm new to this field, I'm not sure how I'm supposed to implement it? any tips, please.

Upvotes: 0

Views: 44

Answers (1)

Organis
Organis

Reputation: 7316

Create a localization data file (XML or JSON or CSV format, whichever is easy for you to work with). Develop your app so that all texts are obtained from that file via some kind of ids and none (not strictly, some initial texts like "Loading..." can still be in code) are hardcoded. When time is right, make a copy of localization file and translate the texts but leave the ids.

For example, en.xml:

<language>
    <entry id="game">Game</entry>
    <entry id="go">Go!</entry>
</language>

Then, ru.xml:

<language>
    <entry id="game">Игра</entry>
    <entry id="go">Вперёд!</entry>
</language>

The files have the same structure, same ids, everything, but the texts. When your app starts it should decide which one of the files is to load (or maybe load all of them and which one is to use), thus all the app texts will feature the appropriate language.

Upvotes: 2

Related Questions