## Multiple Languages in a Single Game

Yes, you can now add translation data to your projects (one file for each language you want your game translated into) and provide games in multiple languages.

Use the SLUDGE Translation Editor to create the translations. Then you need to add the translation file(s) to your project using the project manager. Compile your game and the compiler will put all the languages into the one compiled game file, ready to be played.

Each translation file should have a different ID (you can set this using the translation editor). Players can then choose between languages by specifying the language in the dialog window that appears after starting the SLUDGE Engine (or by providing a command line parameter on Linux).

### Workarounds for difficult translations

In some situations, simply substituting one string for another may not be enough to translate a game into another language. You may have text saved as images, or want to provide alternative ways of building sentences for different languages. Take the following example:

    objectType cow ("cow") {
    }
    objectType lookAt ("Look at") {
       event default {
          say (ego, "What a lovely " + clickedObject + ".");
       }
    }

So, what would you translate the strings into? Well, I'd have thought something like...

cow -> la vache
Look at -> Voire
What a lovely -> C'est une beau
. -> .

Now, that's not going to work out quite right, is it? You'd end up with sentences like "C'est une beau la vache" and you'd get all manner of complaints. So, use the getLanguageID function to check which language you're using...

    objectType cow ("cow") {
    }
    objectType lookAt ("Look at") {
       event default {
          if (getLanguageID () == 0) {
             say (ego, "What a lovely " + clickedObject + ".");

          } else {
             say (ego, "SIMPLE LOOK AT PHRASE HERE");
          }
       }
    }

And, of course, add a translation for the new string...

SIMPLE LOOK AT PHRASE HERE -> Ce n'est pas tres interesant.

Of course, you can come up with more complicated ways around the problem, but chances are they'll be based on the above theory.

### See also:

getLanguageID

SLUDGE and this SLUDGE documentation are copyright Hungry Software and contributors 2000-2012