# String Editor

### String resources

While script dialogs provide a multi-lingual interface in the form of [language overlays](dialog_editor/language_overlays), scripts can also use _string resources_ which provide an easy way for a script to support multiple languages for ad-hoc strings.

As a very simple example, consider the following VBScript fragment.

```
If DOpus.language = "francais" Then
  DOpus.Output "Une erreur s'est produite."
ElseIf DOpus.language = "deutsch" Then
  DOpus.Output "Ein Fehler ist aufgetreten."
ElseIf DOpus.language = "espanol" Then
  DOpus.Output "Ocurrió un error."
Else
  DOpus.Output "An error occurred."
End If
```

This tests the current language Opus is running in and prints an appropriate “hello” string in that language, or in English if the language isn’t known. That’s fine for a single string, but having to do that for every string in the script could be a lot of typing. Using string resources, the above script fragment reduces to:

```
DOpus.Output DOpus.Strings.Get("error")
```

### String editor

To add a new string resource language, switch to the _Resources_ tab in the script editor, right-click the script file in question, and choose **New Strings** from the context menu. Opus will prompt you to select the language you want to add strings for.

The string resource editor is a very simple grid with two columns. The _Name_ column lets you specify a name for the string - in the above example, this was set to "error". The _Translation_ column lets you provide the translation for the selected language.

![](https://3597805814-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3XSZSwWow0fDf6fQJobd%2Fuploads%2Fgit-blob-dcf546b159cb6b17524afa38abc8ec314270be25%2Fscripteditor_strings.png?alt=media)
