Jump to content
Aveyond Studios Community
Sign in to follow this  
Ant

Tutorial: Localize your game

Recommended Posts

You can quickly switch the language your players see and hear when they play your game. So, if you want Spanish speakers to to have a Spanish version of your game and English speakers to have an English version of the game, you can do this without duplicating your project and replacing the text.

Step 1: Prepare the text

Spoiler

Text for each language is stored in a spreadsheet. Each translation has a key and a value. Your keys should be the same in all of your spreadsheets. This means that all keys in the English spreadsheet should be the exact same keys in the Spanish spreadsheet. The values assigned to the keys, however, should be different. So, if you have a key called greeting, the English value might be "Hello," and the Spanish value might be "Hola."

Let's go through the process of creating a localization spreadsheet and using it with HeroKit. We're going to use Google Sheets in this example. If you don't have a Google account, please create one.

  1. Open Google Sheets (https://docs.google.com/spreadsheets) and create a new spreadsheet.
  2. Give your spreadsheet a name (ex. English).
  3. In column A, enter your keys.
  4. In column B, enter your values.
  5. Your spreadsheet should look something like this:
    AwKeCYf.png
  6. Click File > Download As > Comma-seperated values (.csv)
    • If you are using something other than Google Sheets, save your file as CSV UTF-8.
  7. Save your CSV file somewhere on your computer.
  8. Drag your CSV file in to Unity and save it in this directory: [Your project name] > Assets > Game Assets > Localizations. 
    • To quickly create your project directory, go to Unity toolbar and choose HeroKit > Create Hero Project.

Step 2: Prepare the audio

Spoiler

You can play an audio file while a dialog message displays. If you would like to localize your audio files, follow these steps:

  1. In Unity, create a folder to contain the audio for a specific language (ex. English).
  2. Put the folder in this directory: [Your project name] > Assets > Game Assets > Localizations > Resources > Audio
  3. Drag your audio files into this folder. The files should only be for a specific language.
  4. Make sure that the name of each audio file matches its key in the CSV file.
    mxey7j7.png 

Step 3: Attach the Use Localization action to a hero object & test

Spoiler

To enable localization, you need to use an action on a hero object. In the example below, I created a hero object called Start Game HO that automatically localizes the game in English.

  1. Create a hero object. Name it Start Game HO.
  2. Add a state to it.
  3. Add an event to the state. The event needs to be set to Autoplay.
  4. Add a Use Localization action to the event.
    63nbShH.png
    • In the CSV file to localize field, choose the CSV file we just created (ex. English).
    • If you want to localize audio files, mark the Localize audio in message box and enter the directory of the audio files for a specific language. You only need to enter the directory that is inside the Resource directory. (ex. Audio/English).
  5. Add a Show Message action to the event.
    dd7Pon1.png
    • In the Message field, enter the key assigned to a value from your CSV file.
    • (Optional) In the Audio filed, enter any audio clip, but make sure it's name matches the same key in the CSV file.
  6. Drag your hero object into the Hierarchy tab and test your game. 
  7. If you run into problems, take a look at these sample scene that comes with HeroKit:
    • HeroKit > HeroKit Samples > Sample Scenes > Scenes > Scene 20 - Localization and Font Examples
    • HeroKit > HeroKit Samples > Sample Scenes > Scenes > Scene 22 - Dialog Examples

 

Share this post


Link to post
Share on other sites
Sign in to follow this  

×