Creating a translation file

This tutorial will cover how to create a translation file for localization purposes and how to access the language data through VerlocityLanguage.

Overview
A translation file is an Object class that contains translation string IDs and the translated language.

Step 1
Create a language class, similiar to the example one below.

Example File
An example translation file (comes packed with Verloicty): package VerlocityEngine.languages {	public dynamic class verLangEnglish extends Object {		public function verLangEnglish:void {			this["VerlocityLoadFail"] = "Verlocity engine can only be created once!";

// Components this["ComponentSuccess"] = " component registered and loaded."; this["ComponentDuplicate"] = "Attempted to register component twice!"; this["ComponentLoadFail"] = "A component and cannot be created twice!";

// Generic this["GenericAddSuccess"] = " successfully added."; this["GenericAddFail"] = "Unable to add. "; this["GenericDuplicate"] = "Found duplicate, skipping.";

this["GenericMissing"] = " does not exist."; this["GenericRemove"] = "Removing "; this["GenericRemoveAll"] = "Removed all.";

// Pause menu this["verPauseTitle"] = "PAUSE"; this["verPauseResume"] = "RESUME"; this["verPauseQuality"] = "QUALITY"; this["verPauseQualityLow"] = "L"; this["verPauseQualityMedium"] = "M"; this["verPauseQualityHigh"] = "H"; this["verPauseVolume"] = "VOLUME"; this["verPauseAchivements"] = "ACHIEVEMENTS"; this["verPauseFullscreen"] = "FULLSCREEN";

// Achievement menu this["verAchievementsTitle"] = "ACHIEVEMENTS"; this["verAchievementsNone"] = "No achievements."; this["verAchievementsExit"] = "CLOSE";

// Messages this["VerlocityPause"] = "Game paused"; this["VerlocityUnpause"] = "Game resumed";

this["VerlocityVolumeMute"] = "Volume muted "; this["VerlocityVolumeUnmute"] = "Volume unmuted"; this["VerlocityVolumeDown"] = "Volume lowered "; this["VerlocityVolumeUp"] = "Volume raised ";

this["VerlocityFullscreenOn"] = "Fullscreen enabled"; this["VerlocityFullscreenOff"] = "Fullscreen disabled";

this["VerlocityQuality"] = "Quality set to "; this["VerlocityQualityH"] = "HIGH"; this["VerlocityQualityM"] = "MEDIUM"; this["VerlocityQualityL"] = "LOW"; }	} }

Step 2
Once you're finished writing translation language for your UI, you must replace any text present in your UI with: VerloictyLanguage.T( "TranslationID" );

"TranslationID" represents whichever translation string ID you specified in your class that works with your UI.

Step 3
To use your translation file, simply use the Set function, as follows:

// Create a new language file containing the following, name it verLangNew.as: this["GameOver"] = "GAME OVER, THANKS FOR PLAYING!";

//====end of verLangNew====

// Import the new translation file import VerloictyEngine.languages.verLangNew;

// Set the new translation file VerloictyLanguage.Set( new verLangNew );

// In your game or UI: trace( VerloictyLanguage.T( "GameOver" ) );

// Output: "GAME OVER, THANKS FOR PLAYING!"