From f7e00da2e721bb551e6327e37b54ca01d625e7a8 Mon Sep 17 00:00:00 2001 From: j v Date: Sat, 13 Jan 2024 20:43:39 -0800 Subject: [PATCH] Localized strings for EditorFile #377 --- Assets/VoxelEditor/EditorFile.cs | 23 ++++++------------- .../GUI/localization/GUIStringSet.cs | 20 ++++++++++++++++ 2 files changed, 27 insertions(+), 16 deletions(-) diff --git a/Assets/VoxelEditor/EditorFile.cs b/Assets/VoxelEditor/EditorFile.cs index eb9378af..2c5b407b 100644 --- a/Assets/VoxelEditor/EditorFile.cs +++ b/Assets/VoxelEditor/EditorFile.cs @@ -41,7 +41,7 @@ private IEnumerator LoadCoroutine() { var dialog = guiGameObject.AddComponent(); dialog.message = e.FullMessage; - dialog.yesButtonText = "Close"; + dialog.yesButtonText = GUIPanel.StringSet.Close; dialog.yesButtonHandler = () => { voxelArray.unsavedChanges = false; @@ -67,15 +67,8 @@ private IEnumerator LoadCoroutine() lastVersion = lastVersion.Substring(0, lastVersion.Length - 1); if (CompareVersions(lastVersion, "1.3.5") == -1) { - LargeMessageGUI.ShowLargeMessageDialog(guiGameObject, "N-Space has been updated!" - + " Check out the Doors Demo World in the help menu to see the new features.\n\n" - + "• New Scale behavior to change size of objects/substances\n" - + "• You can change the Pivot point of substances for rotation/scaling\n" - + "• Lights are visible in the editor, even when not selected\n" - + "• Objects can be placed inside walls or outside bounds\n" - + "• Fixed lag caused by larger substances\n" - + "• Button in the bottom right toggles pan/orbit with two fingers\n" - + "... and some more improvements / fixes!"); + LargeMessageGUI.ShowLargeMessageDialog(guiGameObject, + GUIPanel.StringSet.UpdateMessage_1_3_5); } } PlayerPrefs.SetString("last_editScene_version", Application.version); @@ -86,7 +79,7 @@ private IEnumerator LoadCoroutine() // for some reason it's necessary to wait two frames yield return null; yield return null; - string message = "There were some issues with reading the world:\n\n • " + + string message = GUIPanel.StringSet.WorldWarningsHeader + "\n\n • " + string.Join("\n • ", warnings.ToArray()); LargeMessageGUI.ShowLargeMessageDialog(guiGameObject, message); } @@ -146,10 +139,7 @@ public bool Save(bool allowPopups = true) { if (allowPopups) { - string message = "An error occurred while saving the file. " - + "Please send me an email about this, and include a screenshot " - + "of this message. chroma@chroma.zone\n\n" - + e.ToString(); + string message = GUIPanel.StringSet.UnknownSaveError + e.ToString(); var dialog = LargeMessageGUI.ShowLargeMessageDialog(GUIPanel.GuiGameObject, message); dialog.closeHandler = () => SceneManager.LoadScene(Scenes.MENU); voxelArray.unsavedChanges = false; @@ -212,7 +202,8 @@ void OnApplicationPause(bool pauseStatus) } catch (System.Exception e) { - DialogGUI.ShowMessageDialog(GUIPanel.GuiGameObject, "An error occurred while reading the file."); + DialogGUI.ShowMessageDialog(GUIPanel.GuiGameObject, + GUIPanel.StringSet.UnknownReadError); Debug.LogError(e); stream?.Dispose(); ShareMap.ClearFileWaitingToImport(); diff --git a/Assets/VoxelEditor/GUI/localization/GUIStringSet.cs b/Assets/VoxelEditor/GUI/localization/GUIStringSet.cs index bfb41b88..5c9b468d 100644 --- a/Assets/VoxelEditor/GUI/localization/GUIStringSet.cs +++ b/Assets/VoxelEditor/GUI/localization/GUIStringSet.cs @@ -277,6 +277,14 @@ public class GUIStringSet public virtual string AddInput => "Add Input"; + // Editor errors + public virtual string WorldWarningsHeader => + "There were some issues with reading the world:"; + public virtual string UnknownSaveError => + "An error occurred while saving the file. Please send me an email about this, and include a screenshot of this message. chroma@chroma.zone\n\n"; + public virtual string UnknownReadError => + "An error occurred while reading the file."; + // Help menu public virtual string HelpMenuTitle => "Help"; @@ -552,4 +560,16 @@ public class GUIStringSet "Play your game. Try jumping in the pit."; public virtual string TutorialPitBalls => "Now try making some balls with Physics behaviors. Then play the game and push them all into the pit. Enjoy."; + + // Update messages + public virtual string UpdateMessage_1_3_5 => +@"N-Space has been updated! Check out the Doors Demo World in the help menu to see the new features. + +• New Scale behavior to change size of objects/substances +• You can change the Pivot point of substances for rotation/scaling +• Lights are visible in the editor, even when not selected +• Objects can be placed inside walls or outside bounds +• Fixed lag caused by larger substances +• Button in the bottom right toggles pan/orbit with two fingers +... and some more improvements / fixes!"; }