# Change Languages at Runtime Using the API

To change languages displayed at runtime with the API, use the associated localization methods described in the table below.

To change a language at runtime using the GUI, see Change Language at Runtime by Creating a Project Localization Page.

Function | Description | Input(s) | Output(s)
$Localization.LoadLanguage() | Changes the selected language at runtime to the language specified by the input. If the language is successfully loaded, it updates the value of $Localization.CurrentLanguage to the loaded language. Throws an exception if the input languageName is invalid. If the loaded language doesn't have a translation available, the translation reverts to using the default language | string languageName | void
$Localization.CurrentLanguage | Gets the currently loaded language at runtime. This tag is read-only. | None | string

## Using API Calls to Access Localization Methods

Do the following before making these sample API calls to test localization functionality.

1. In the Project Explorer GUI, open the Localization pane by double-clicking System > Localization.
2. Using the Tag Manager, create a tag named $Localization.Greeting.
3. Add a Language named French.
4. Using the Project Localization, edit the Default String and Translation values as appropriate.
5. Create your program and use the example API calls coded below as neccessary in your application.

// Display localization tag on UI

$HMI.ShowMessage($Localization.Greeting);

// $Localization.Greeting has a default value of "Hello"

// Popup message saying "Hello" will appear

// Load another language

$Localization.LoadLanguage("French");

// Display localization tag on UI again

$HMI.ShowMessage($Localization.Greeting);

// $Localization.Greeting has a translation in French "Bonjour"

// Popup message saying "Bonjour" will appear