Creating display keys in a Gosu editor
About this task
You can create a display key directly from within a Gosu editor by first typing a string literal and then converting it to a display key.
Procedure
- Place the cursor within the string, and then press Alt+Enter.
- Click Convert string literal to display key. Studio opens the Create Display Key dialog.
- In the Name text box, type the name of the display key. Studio fills in this text box with the string value, but you can change it.
- In the Values box, under the desired locale name, verify or change the string value.
- Click OK. Studio creates the new display key in the display key properties file. Studio also inserts a reference to that display key in place of the string literal in the Gosu code.
Example
For example, suppose that you enter the following in the Rules editor:
var errorString = "Failed to send"If you place the cursor within that string, then press Alt+Enter, and then click Convert string literal to display key, Studio opens the Create Display Key dialog.
If you name the new display key
SendFailed, then Studio
creates the following new display key in the display key properties file:
SendFailed=Failed to sendStudio also replaces the string literal in your Gosu code, and changes it to the following:
var errorString = DisplayKey.get("SendFailed")