Copy texts to and from Unity Localization
What this page is for
Section titled “What this page is for”If your game uses Unity’s Localization package, you can copy your story’s texts into a String Table Collection. You can also copy a String Table back into the story.
Two menu items open one window that does both. They exist only when the package is installed in the project, version 1.0.0 or later.
When you come here
Section titled “When you come here”- Your translators or your game already work in Unity’s String Tables.
- You want your Intrigues texts in a table without typing them again.
- You want a table’s translations merged into the story.
What you see
Section titled “What you see”Choose Tools > MrW > Intrigues > Unity Localization. The two items are Copy Intrigues Texts To A String Table… and Copy A String Table To Intrigues…. The window is titled Copy Intrigues Texts To A String Table or Copy A String Table To Intrigues, after the item you chose. The fields are the same:
| Field | What it is |
|---|---|
| Story | The Intrigues database whose texts are copied. It starts as the database you selected in Unity, if any. Hover text: The Intrigues database whose texts are copied. |
| String Table | The String Table Collection to use. Hover text: The String Table Collection of Unity’s Localization package. Copying into a table also offers New String Table…. |
| Name | Only for New String Table…: the name of the new collection. Hover text: The name of the new String Table Collection. It starts as Story. |
| The button | Copy Into The String Table or Read The String Table. It is off until a story is chosen, and while New String Table… is picked and Name is empty. |
A note under the fields says what the button will do. The result appears in a box at the bottom.
The window remembers nothing between sessions.
Do it, step by step
Section titled “Do it, step by step”Copy your texts into a table
Section titled “Copy your texts into a table”- Choose Copy Intrigues Texts To A String Table….
- Pick the Story and a String Table, or New String Table… and type a Name.
- Click Copy Into The String Table. For a new table, a folder panel asks for a folder, which must be inside the project’s Assets folder.
Named texts go under their name, and texts written in the story go under their id, which is # and 16 hex digits, with the text itself as the comment. A value that already exists in the table is overwritten, and an empty text never clears one. The result reads, for example, Copied 120 texts into the String Table ‘Story’ (4 new keys, 2 tables added). A language of the story that Unity has no locale for is listed as not copied. Add the locale.
To undo, use Undo in Unity’s Edit menu. One step takes the copy back, but a table the copy had to add stays.
Read a table into your story
Section titled “Read a table into your story”- Choose Copy A String Table To Intrigues….
- Pick the Story and the String Table, and click Read The String Table.
- The report window Import translations opens. Read it, and click Apply to merge.
Nothing is written before Apply. The report is the same one the Import… button of the Texts page opens.
To undo, use Undo in the Edit menu.
Show the table in the game
Section titled “Show the table in the game”Copying does not make the game read a table. For that, add the Unity Localization Bridge component. Its inspector has String Table, Follow Unity’s language and one line that points to this menu. See Use Unity’s Localization package and Localized Text and the Localization Bridge.
How it connects
Section titled “How it connects”The texts are the ones on the Texts page. Exporting a file for translators is another way: see Dialogs the Studio opens.
Mistakes and messages
Section titled “Mistakes and messages”| Message | What to do |
|---|---|
| This project has no String Table Collection yet. Make one in Unity’s Localization Tables window first. | Shown by Copy A String Table To Intrigues…. Make a collection. |
| The String Table has no texts to copy. | Fill the table, or pick another. |
| Choose a folder inside the project’s Assets folder. | Pick a folder under Assets for the new table. |
| Not copied, because no Unity locale stands for them: and a list | Add a locale in Unity’s Localization settings. |