diff --git a/Assets/RedBlueGames/MulliganRenamer/Editor/ExtensionsAndUtilities/EditorCoroutineUtility.cs b/Assets/RedBlueGames/MulliganRenamer/Editor/ExtensionsAndUtilities/EditorCoroutineUtility.cs new file mode 100644 index 0000000..5912761 --- /dev/null +++ b/Assets/RedBlueGames/MulliganRenamer/Editor/ExtensionsAndUtilities/EditorCoroutineUtility.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections; +using UnityEditor; +using UnityEngine; + +public static class EditorCoroutineUtility +{ + /// + /// Starts a Coroutine using Unity Editor's update loop. This is useful for EditorWindows + /// which aren't MonoBehaviours and therefore can't use Coroutines. + /// Utility function adapted from https://forum.unity.com/threads/using-unitywebrequest-in-editor-tools.397466/#post-4485181 + /// + /// + /// + public static void StartBackgroundTask(IEnumerator update, Action onEnd = null) + { + EditorApplication.CallbackFunction closureCallback = null; + + closureCallback = () => + { + try + { + if (update.MoveNext() == false) + { + if (onEnd != null) + { + onEnd(); + } + + EditorApplication.update -= closureCallback; + } + } + catch (Exception ex) + { + if (onEnd != null) + { + onEnd(); + } + + Debug.LogException(ex); + EditorApplication.update -= closureCallback; + } + }; + + EditorApplication.update += closureCallback; + } +} \ No newline at end of file diff --git a/Assets/RedBlueGames/MulliganRenamer/Editor/ExtensionsAndUtilities/EditorCoroutineUtility.cs.meta b/Assets/RedBlueGames/MulliganRenamer/Editor/ExtensionsAndUtilities/EditorCoroutineUtility.cs.meta new file mode 100644 index 0000000..db4c6fa --- /dev/null +++ b/Assets/RedBlueGames/MulliganRenamer/Editor/ExtensionsAndUtilities/EditorCoroutineUtility.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e2209f9be6a614dc78f4f72ca8a413e6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/RedBlueGames/MulliganRenamer/Editor/GUI/ManagePresetsWindow.cs b/Assets/RedBlueGames/MulliganRenamer/Editor/GUI/ManagePresetsWindow.cs index 220ff80..f9a68c6 100644 --- a/Assets/RedBlueGames/MulliganRenamer/Editor/GUI/ManagePresetsWindow.cs +++ b/Assets/RedBlueGames/MulliganRenamer/Editor/GUI/ManagePresetsWindow.cs @@ -53,7 +53,7 @@ public void PopulateWithPresets(List presets) var copySerialized = JsonUtility.ToJson(preset); var copy = JsonUtility.FromJson(copySerialized); this.presetsToDraw.Add(copy); - this.uniqueNames.Add(copy, LocaleManager.Instance.GetTranslation("preset") + " " + i); + this.uniqueNames.Add(copy, LocalizationManager.Instance.GetTranslation("preset") + " " + i); } this.reorderableList.list = this.presetsToDraw; @@ -76,7 +76,7 @@ private void OnEnable() private void DrawHeader(Rect rect) { - GUI.Label(rect, LocaleManager.Instance.GetTranslation("savedPresets"), EditorStyles.label); + GUI.Label(rect, LocalizationManager.Instance.GetTranslation("savedPresets"), EditorStyles.label); } private void DrawElement(Rect rect, int index, bool isActive, bool isFocused) @@ -147,7 +147,7 @@ private void OnGUI() EditorGUILayout.BeginHorizontal(); GUILayout.Space(50.0f); EditorGUILayout.LabelField( - LocaleManager.Instance.GetTranslation("errorNoSavedPresets"), + LocalizationManager.Instance.GetTranslation("errorNoSavedPresets"), EditorStyles.wordWrappedLabel); GUILayout.Space(50.0f); EditorGUILayout.EndHorizontal(); @@ -160,13 +160,13 @@ private void HandleElementRemoved(UnityEditorInternal.ReorderableList list) var indexToRemove = list.index; var elementToDelete = this.presetsToDraw[indexToRemove]; var popupMessage = string.Format( - LocaleManager.Instance.GetTranslation("areYouSureDelete"), elementToDelete.Name + LocalizationManager.Instance.GetTranslation("areYouSureDelete"), elementToDelete.Name ); - if (EditorUtility.DisplayDialog(LocaleManager.Instance.GetTranslation("warning"), + if (EditorUtility.DisplayDialog(LocalizationManager.Instance.GetTranslation("warning"), popupMessage, - LocaleManager.Instance.GetTranslation("deletePreset"), - LocaleManager.Instance.GetTranslation("no"))) + LocalizationManager.Instance.GetTranslation("deletePreset"), + LocalizationManager.Instance.GetTranslation("no"))) { this.presetsToDraw.RemoveAt(indexToRemove); this.reorderableList.index = 0; diff --git a/Assets/RedBlueGames/MulliganRenamer/Editor/GUI/MulliganRenamerPreviewPanel.cs b/Assets/RedBlueGames/MulliganRenamer/Editor/GUI/MulliganRenamerPreviewPanel.cs index 473b2ee..5100b88 100644 --- a/Assets/RedBlueGames/MulliganRenamer/Editor/GUI/MulliganRenamerPreviewPanel.cs +++ b/Assets/RedBlueGames/MulliganRenamer/Editor/GUI/MulliganRenamerPreviewPanel.cs @@ -296,10 +296,10 @@ private void InitializeGUIContents() { this.guiContents = new GUIContents(); - this.guiContents.DropPrompt = new GUIContent(LocaleManager.Instance.GetTranslation("noObjectsSpecified")); - this.guiContents.DropPromptHintInsideScroll = new GUIContent(LocaleManager.Instance.GetTranslation("addMoreObjectsDragHere")); - this.guiContents.DropPromptHint = new GUIContent(LocaleManager.Instance.GetTranslation("addMoreObjectsDragPanel")); - this.guiContents.DropPromptRepeat = new GUIContent(LocaleManager.Instance.GetTranslation("toRenameMoreObjects")); + this.guiContents.DropPrompt = new GUIContent(LocalizationManager.Instance.GetTranslation("noObjectsSpecified")); + this.guiContents.DropPromptHintInsideScroll = new GUIContent(LocalizationManager.Instance.GetTranslation("addMoreObjectsDragHere")); + this.guiContents.DropPromptHint = new GUIContent(LocalizationManager.Instance.GetTranslation("addMoreObjectsDragPanel")); + this.guiContents.DropPromptRepeat = new GUIContent(LocalizationManager.Instance.GetTranslation("toRenameMoreObjects")); } private void InitializeGUIStyles() @@ -464,7 +464,7 @@ public Vector2 Draw(Rect previewPanelRect, Vector2 previewPanelScrollPosition, B var removeAllButtonRect = new Rect(addSelectedObjectsButtonRect); removeAllButtonRect.width = 100.0f; removeAllButtonRect.x -= (removeAllButtonRect.width + buttonSpacing); - if (GUI.Button(removeAllButtonRect, LocaleManager.Instance.GetTranslation("removeAll"))) + if (GUI.Button(removeAllButtonRect, LocalizationManager.Instance.GetTranslation("removeAll"))) { if (this.RemoveAllClicked != null) { @@ -525,14 +525,14 @@ private void DrawPreviewPanelContentsEmpty(Rect previewPanelRect) string noun; if (this.NumPreviouslyRenamedObjects == 1) { - noun = LocaleManager.Instance.GetTranslation("object"); + noun = LocalizationManager.Instance.GetTranslation("object"); } else { - noun = LocaleManager.Instance.GetTranslation("objects"); + noun = LocalizationManager.Instance.GetTranslation("objects"); } - var renameSuccessContent = new GUIContent(string.Format("{0} {1} {2}", this.NumPreviouslyRenamedObjects, noun, LocaleManager.Instance.GetTranslation("renamed"))); + var renameSuccessContent = new GUIContent(string.Format("{0} {1} {2}", this.NumPreviouslyRenamedObjects, noun, LocalizationManager.Instance.GetTranslation("renamed"))); EditorGUI.LabelField(labelRect, renameSuccessContent, this.guiStyles.RenameSuccessPrompt); GUI.contentColor = oldColor; @@ -561,8 +561,8 @@ private Vector2 DrawPreviewPanelContentsWithItems( previewPanelScrollPosition.x = 0; } - string originalNameColumnHeader = LocaleManager.Instance.GetTranslation(previewContents.RenameStepIndex < 1 ? "original" : "before"); - string newNameColumnHeader = LocaleManager.Instance.GetTranslation("after"); + string originalNameColumnHeader = LocalizationManager.Instance.GetTranslation(previewContents.RenameStepIndex < 1 ? "original" : "before"); + string newNameColumnHeader = LocalizationManager.Instance.GetTranslation("after"); this.DrawPreviewHeader( scrollLayout.HeaderRect, -previewPanelScrollPosition.x, @@ -645,7 +645,7 @@ private void DrawPreviewHeader( if (thirdColumnWidth > 0.0f) { - EditorGUI.LabelField(thirdColumnRect, LocaleManager.Instance.GetTranslation("finalName"), EditorStyles.boldLabel); + EditorGUI.LabelField(thirdColumnRect, LocalizationManager.Instance.GetTranslation("finalName"), EditorStyles.boldLabel); } GUI.EndGroup(); @@ -846,7 +846,7 @@ private bool DrawDividerAndCheckResize(Rect rect, bool alreadyDragging, out bool private void DrawAddSelectedObjectsButton(Rect buttonRect) { EditorGUI.BeginDisabledGroup(DisableAddSelectedObjectsButton); - if (GUI.Button(buttonRect, LocaleManager.Instance.GetTranslation("addSelectedObjects"))) + if (GUI.Button(buttonRect, LocalizationManager.Instance.GetTranslation("addSelectedObjects"))) { if (this.AddSelectedObjectsClicked != null) { @@ -1135,7 +1135,7 @@ public PreviewRowModel this[int index] else { throw new System.IndexOutOfRangeException( - LocaleManager.Instance.GetTranslation("errorTryingToAccessModel") + index); + LocalizationManager.Instance.GetTranslation("errorTryingToAccessModel") + index); } } } @@ -1172,7 +1172,7 @@ public static PreviewPanelContents CreatePreviewContentsForObjects( } else { - info.WarningMessage = LocaleManager.Instance.GetTranslation("warningNewNameMatchesExisting"); + info.WarningMessage = LocalizationManager.Instance.GetTranslation("warningNewNameMatchesExisting"); } } else @@ -1232,11 +1232,11 @@ private static string GetWarningMessageForRenamePreview(RenamePreview preview) { if (preview.HasInvalidEmptyFinalName) { - return LocaleManager.Instance.GetTranslation("assetBlankName"); + return LocalizationManager.Instance.GetTranslation("assetBlankName"); } else if (preview.FinalNameContainsInvalidCharacters) { - return LocaleManager.Instance.GetTranslation("nameIncludeInvalidCharacter"); + return LocalizationManager.Instance.GetTranslation("nameIncludeInvalidCharacter"); } else { diff --git a/Assets/RedBlueGames/MulliganRenamer/Editor/GUI/MulliganRenamerWindow.cs b/Assets/RedBlueGames/MulliganRenamer/Editor/GUI/MulliganRenamerWindow.cs index 5d6c17b..2a50134 100644 --- a/Assets/RedBlueGames/MulliganRenamer/Editor/GUI/MulliganRenamerWindow.cs +++ b/Assets/RedBlueGames/MulliganRenamer/Editor/GUI/MulliganRenamerWindow.cs @@ -232,7 +232,7 @@ public void AddItemsToMenu(GenericMenu menu) { menu.AddItem( new GUIContent( - LocaleManager.Instance.GetTranslation("preferences")), + LocalizationManager.Instance.GetTranslation("preferences")), false, () => this.ShowPreferencesWindowForCurrentUnityVersion()); } @@ -266,7 +266,7 @@ private void OnEnable() EditorApplication.update += this.CacheBulkRenamerPreview; EditorApplication.update += this.CacheValidSelectedObjects; - LocaleManager.Instance.LanguageChanged += this.HandleLanguageChanged; + LocalizationManager.Instance.LanguageChanged += this.HandleLanguageChanged; // Sometimes, GUI happens before Editor Update, so also cache a preview now. this.CacheBulkRenamerPreview(); @@ -358,7 +358,7 @@ private void OnDisable() EditorApplication.update -= this.CacheBulkRenamerPreview; EditorApplication.update -= this.CacheValidSelectedObjects; - LocaleManager.Instance.LanguageChanged -= this.HandleLanguageChanged; + LocalizationManager.Instance.LanguageChanged -= this.HandleLanguageChanged; } private void CacheRenameOperationPrototypes() @@ -491,15 +491,15 @@ private void OnGUI() renameButtonSize.x, renameButtonSize.y); - if (GUI.Button(renameButtonRect, LocaleManager.Instance.GetTranslation("rename"))) + if (GUI.Button(renameButtonRect, LocalizationManager.Instance.GetTranslation("rename"))) { var popupMessage = string.Concat( - LocaleManager.Instance.GetTranslation("renameWarningNotRenamed")); + LocalizationManager.Instance.GetTranslation("renameWarningNotRenamed")); var renamesHaveNoWarnings = !BulkRenamePreview.HasWarnings; - if (renamesHaveNoWarnings || EditorUtility.DisplayDialog(LocaleManager.Instance.GetTranslation("warning"), + if (renamesHaveNoWarnings || EditorUtility.DisplayDialog(LocalizationManager.Instance.GetTranslation("warning"), popupMessage, - LocaleManager.Instance.GetTranslation("rename"), - LocaleManager.Instance.GetTranslation("cancel"))) + LocalizationManager.Instance.GetTranslation("rename"), + LocalizationManager.Instance.GetTranslation("cancel"))) { var undoGroupBeforeRename = Undo.GetCurrentGroup(); try @@ -515,9 +515,9 @@ private void OnGUI() catch (System.OperationCanceledException e) { var errorMessage = string.Concat( - LocaleManager.Instance.GetTranslation("failToRenameMulligan"), + LocalizationManager.Instance.GetTranslation("failToRenameMulligan"), e.Message); - if (EditorUtility.DisplayDialog(LocaleManager.Instance.GetTranslation("error"), errorMessage, "Ok")) + if (EditorUtility.DisplayDialog(LocalizationManager.Instance.GetTranslation("error"), errorMessage, "Ok")) { Undo.RevertAllDownToGroup(undoGroupBeforeRename); } @@ -558,7 +558,7 @@ private void DrawToolbar(Rect toolbarRect) this.DrawBreadcrumbs(this.IsShowingPreviewSteps, breadcrumbRect); EditorGUI.BeginDisabledGroup(this.NumRenameOperations <= 1); - var buttonText = LocaleManager.Instance.GetTranslation("previewSteps"); + var buttonText = LocalizationManager.Instance.GetTranslation("previewSteps"); var previewButtonSize = new Vector2(150.0f, toolbarRect.height); var previewButtonPosition = new Vector2(toolbarRect.xMax - previewButtonSize.x, toolbarRect.y); var toggleRect = new Rect(previewButtonPosition, previewButtonSize); @@ -609,7 +609,7 @@ private void DrawBreadcrumbs(bool isShowingPreviewSteps, Rect rect) else { var breadcrumbeOptions = - new PreviewBreadcrumbOptions() { Heading = LocaleManager.Instance.GetTranslation("result"), HighlightColor = Color.clear, Enabled = true, UseLeftStyle = true }; + new PreviewBreadcrumbOptions() { Heading = LocalizationManager.Instance.GetTranslation("result"), HighlightColor = Color.clear, Enabled = true, UseLeftStyle = true }; var breadcrumbSize = breadcrumbeOptions.SizeForContent; breadcrumbSize.y = rect.height; DrawPreviewBreadcrumb(new Rect(rect.position, breadcrumbSize), breadcrumbeOptions); @@ -660,7 +660,7 @@ private void DrawOperationsPanel(Rect operationPanelRect) buttonRect.height = buttonSize.y; buttonRect.width = buttonSize.x; - if (GUI.Button(buttonRect, LocaleManager.Instance.GetTranslation("addOperation"))) + if (GUI.Button(buttonRect, LocalizationManager.Instance.GetTranslation("addOperation"))) { // Add enums to the menu var menu = new GenericMenu(); @@ -686,24 +686,24 @@ private void DrawOperationsPanelHeader(Rect headerRect) headerLabelRect.x += 2.0f; headerLabelRect.width -= 2.0f; - var headerLabel = LocaleManager.Instance.GetTranslation("renameOperation"); + var headerLabel = LocalizationManager.Instance.GetTranslation("renameOperation"); var renameOpsLabel = new GUIContent(headerLabel); EditorGUI.LabelField(headerLabelRect, renameOpsLabel, headerLabelStyle); - var localeButtonsRect = new Rect(headerRect); - localeButtonsRect.width = 80.0f; - localeButtonsRect.x = headerRect.width - localeButtonsRect.width; + var preferencesButtonRect = new Rect(headerRect); + preferencesButtonRect.width = 80.0f; + preferencesButtonRect.x = headerRect.width - preferencesButtonRect.width; - if (GUI.Button(localeButtonsRect, LocaleManager.Instance.GetTranslation("preferences"), EditorStyles.toolbarButton)) + if (GUI.Button(preferencesButtonRect, LocalizationManager.Instance.GetTranslation("preferences"), EditorStyles.toolbarButton)) { this.ShowPreferencesWindowForCurrentUnityVersion(); } var presetButtonsRect = new Rect(headerRect); presetButtonsRect.width = 80.0f; - presetButtonsRect.x = headerRect.width - presetButtonsRect.width - localeButtonsRect.width; + presetButtonsRect.x = headerRect.width - presetButtonsRect.width - preferencesButtonRect.width; var useDebugPresets = Event.current.shift; - if (GUI.Button(presetButtonsRect, LocaleManager.Instance.GetTranslation("presets"), EditorStyles.toolbarDropDown)) + if (GUI.Button(presetButtonsRect, LocalizationManager.Instance.GetTranslation("presets"), EditorStyles.toolbarDropDown)) { var menu = new GenericMenu(); var savedPresetNames = new string[this.ActivePreferences.SavedPresets.Count]; @@ -724,8 +724,8 @@ private void DrawOperationsPanelHeader(Rect headerRect) } menu.AddSeparator(string.Empty); - menu.AddItem(new GUIContent(LocaleManager.Instance.GetTranslation("saveAs")), false, () => this.ShowSavePresetWindow()); - menu.AddItem(new GUIContent(LocaleManager.Instance.GetTranslation("managePresets")), false, () => this.ShowManagePresetsWindow()); + menu.AddItem(new GUIContent(LocalizationManager.Instance.GetTranslation("saveAs")), false, () => this.ShowSavePresetWindow()); + menu.AddItem(new GUIContent(LocalizationManager.Instance.GetTranslation("managePresets")), false, () => this.ShowManagePresetsWindow()); if (useDebugPresets) { menu.AddItem(new GUIContent("DEBUG - Delete UserPrefs"), false, () => @@ -735,7 +735,7 @@ private void DrawOperationsPanelHeader(Rect headerRect) }); menu.AddItem(new GUIContent("DEBUG - Reload Languages"), false, () => { - LocaleManager.Instance.Initialize(); + LocalizationManager.Instance.Initialize(); }); } @@ -825,7 +825,7 @@ private void DrawRenameOperations(Rect operationsRect) default: { - Debug.LogError(string.Format(LocaleManager.Instance.GetTranslation("errorUnrecognizedListButton"), buttonClickEvent)); + Debug.LogError(string.Format(LocalizationManager.Instance.GetTranslation("errorUnrecognizedListButton"), buttonClickEvent)); return; } } @@ -847,7 +847,7 @@ private void OnAddRenameOperationConfirmed(object operation) var operationDrawerBinding = operation as RenameOperationDrawerBinding; if (operationDrawerBinding == null) { - throw new System.ArgumentException(LocaleManager.Instance.GetTranslation("errorAddNewOpNotSub"), operation.GetType().ToString()); + throw new System.ArgumentException(LocalizationManager.Instance.GetTranslation("errorAddNewOpNotSub"), operation.GetType().ToString()); } this.AddRenameOperation(operationDrawerBinding); @@ -917,11 +917,11 @@ private void DrawReviewPrompt(Rect rect) color = new AddStringOperationDrawer().HighlightColor; if (RBPackageSettings.IsGitHubRelease) { - reviewPrompt = string.Format("{0}", LocaleManager.Instance.GetTranslation("thankYouForSupport")); + reviewPrompt = string.Format("{0}", LocalizationManager.Instance.GetTranslation("thankYouForSupport")); } else { - reviewPrompt = string.Format("{0}", LocaleManager.Instance.GetTranslation("thankYouForReview")); + reviewPrompt = string.Format("{0}", LocalizationManager.Instance.GetTranslation("thankYouForReview")); } } else @@ -930,11 +930,11 @@ private void DrawReviewPrompt(Rect rect) if (RBPackageSettings.IsGitHubRelease) { - reviewPrompt = string.Format("{0}", LocaleManager.Instance.GetTranslation("thankYouForUsing")); + reviewPrompt = string.Format("{0}", LocalizationManager.Instance.GetTranslation("thankYouForUsing")); } else { - reviewPrompt = string.Format("{0}", LocaleManager.Instance.GetTranslation("thankYouForPurchasing")); + reviewPrompt = string.Format("{0}", LocalizationManager.Instance.GetTranslation("thankYouForPurchasing")); } } @@ -968,7 +968,7 @@ private void DrawReviewBanner(Rect rect, Color color, string prompt, bool showBu labelRect.width = (buttonRect.x - rect.x) - (buttonPaddingLR + labelPaddingL); GUI.Label(labelRect, prompt, reviewStyle); - if (showButton && GUI.Button(buttonRect, LocaleManager.Instance.GetTranslation("openAssetStore"))) + if (showButton && GUI.Button(buttonRect, LocalizationManager.Instance.GetTranslation("openAssetStore"))) { this.ActivePreferences.HasConfirmedReviewPrompt = true; Application.OpenURL("https://assetstore.unity.com/packages/slug/99843"); @@ -993,7 +993,7 @@ private void ShowSavePresetWindow() savePresetPosition.x = this.position.x + (this.position.width / 2.0f); savePresetPosition.y = this.position.y + (this.position.height / 2.0f); this.activeSavePresetWindow = - EditorWindow.GetWindowWithRect(savePresetPosition, true, LocaleManager.Instance.GetTranslation("savePreset"), true); + EditorWindow.GetWindowWithRect(savePresetPosition, true, LocalizationManager.Instance.GetTranslation("savePreset"), true); this.activeSavePresetWindow.minSize = windowMinSize; this.activeSavePresetWindow.maxSize = new Vector2(windowMinSize.x * 2.0f, windowMinSize.y); this.activeSavePresetWindow.SetName(this.CurrentPresetName); @@ -1021,7 +1021,7 @@ private void ShowManagePresetsWindow() } var existingWindow = this.activePresetManagementWindow; - this.activePresetManagementWindow = EditorWindow.GetWindow(true, LocaleManager.Instance.GetTranslation("managePresets"), true); + this.activePresetManagementWindow = EditorWindow.GetWindow(true, LocalizationManager.Instance.GetTranslation("managePresets"), true); this.activePresetManagementWindow.PopulateWithPresets(this.ActivePreferences.SavedPresets); // Only subscribe if it's a new, previously unopened window. diff --git a/Assets/RedBlueGames/MulliganRenamer/Editor/GUI/MulliganUserPreferencesWindow.cs b/Assets/RedBlueGames/MulliganRenamer/Editor/GUI/MulliganUserPreferencesWindow.cs index ed12ce6..7ede9a0 100644 --- a/Assets/RedBlueGames/MulliganRenamer/Editor/GUI/MulliganUserPreferencesWindow.cs +++ b/Assets/RedBlueGames/MulliganRenamer/Editor/GUI/MulliganUserPreferencesWindow.cs @@ -39,8 +39,9 @@ public class MulliganUserPreferencesWindow : EditorWindow private const float MaxWidth = 550.0f; - private MulliganUserPreferences ActivePreferences; + private MulliganUserPreferences activePreferences; + private LanguageRetriever languageRetriever; private static GUIStyle SampleDiffLabelStyle { @@ -59,48 +60,55 @@ public static MulliganUserPreferencesWindow ShowWindow() { return EditorWindow.GetWindow( true, - LocaleManager.Instance.GetTranslation("preferenceWindowTitle"), + LocalizationManager.Instance.GetTranslation("preferenceWindowTitle"), true); } private void OnEnable() { - ActivePreferences = MulliganUserPreferences.LoadOrCreatePreferences(); + // Note that Enable is not called when opened as Preference item (via SettingsProvider api) + // We implement it for old versions of Unity that just use a traditional EditorWindow for settings + this.activePreferences = MulliganUserPreferences.LoadOrCreatePreferences(); + this.languageRetriever = new LanguageRetriever(); } private void OnGUI() { - DrawPreferences(this.ActivePreferences); + DrawPreferences(this.activePreferences, this.languageRetriever); } /// /// Draw the Preferences using Unity GUI framework. /// /// Preferences to draw and update - public static void DrawPreferences(MulliganUserPreferences preferences) + public static void DrawPreferences(MulliganUserPreferences preferences, LanguageRetriever languageRetriever) { // I override LabelWidth (and MaxWidth) just to look more like Unity's native preferences EditorGUIUtility.labelWidth = LabelWidth; var prefsChanged = false; - var newLanguage = DrawLanguageDropdown(LocaleManager.Instance.CurrentLanguage); - if (newLanguage != LocaleManager.Instance.CurrentLanguage) + EditorGUILayout.BeginHorizontal(GUILayout.MaxWidth(MaxWidth)); + var newLanguage = DrawLanguageDropdown(LocalizationManager.Instance.CurrentLanguage); + if (newLanguage != LocalizationManager.Instance.CurrentLanguage) { - LocaleManager.Instance.ChangeLocale(newLanguage.LanguageKey); + LocalizationManager.Instance.ChangeLanguage(newLanguage.Key); } + DrawUpdateLanguagesButton(languageRetriever); + EditorGUILayout.EndHorizontal(); + EditorGUILayout.Space(); EditorGUILayout.Space(); - GUILayout.Label(LocaleManager.Instance.GetTranslation("preferencesDiffLabel"), EditorStyles.boldLabel); + GUILayout.Label(LocalizationManager.Instance.GetTranslation("preferencesDiffLabel"), EditorStyles.boldLabel); EditorGUI.BeginChangeCheck(); preferences.InsertionTextColor = EditorGUILayout.ColorField( - LocaleManager.Instance.GetTranslation("preferencesInsertionText"), + LocalizationManager.Instance.GetTranslation("preferencesInsertionText"), preferences.InsertionTextColor, GUILayout.MaxWidth(MaxWidth)); preferences.InsertionBackgroundColor = EditorGUILayout.ColorField( - LocaleManager.Instance.GetTranslation("preferencesInsertionBackground"), + LocalizationManager.Instance.GetTranslation("preferencesInsertionBackground"), preferences.InsertionBackgroundColor, GUILayout.MaxWidth(MaxWidth)); EditorGUILayout.Space(); @@ -109,11 +117,11 @@ public static void DrawPreferences(MulliganUserPreferences preferences) EditorGUILayout.Space(); preferences.DeletionTextColor = EditorGUILayout.ColorField( - LocaleManager.Instance.GetTranslation("preferencesDeletionText"), + LocalizationManager.Instance.GetTranslation("preferencesDeletionText"), preferences.DeletionTextColor, GUILayout.MaxWidth(MaxWidth)); preferences.DeletionBackgroundColor = EditorGUILayout.ColorField( - LocaleManager.Instance.GetTranslation("preferencesDeletionBackground"), + LocalizationManager.Instance.GetTranslation("preferencesDeletionBackground"), preferences.DeletionBackgroundColor, GUILayout.MaxWidth(MaxWidth)); EditorGUILayout.Space(); @@ -124,7 +132,7 @@ public static void DrawPreferences(MulliganUserPreferences preferences) prefsChanged = true; } - if (GUILayout.Button(LocaleManager.Instance.GetTranslation("preferencesReset"), GUILayout.Width(150))) + if (GUILayout.Button(LocalizationManager.Instance.GetTranslation("preferencesReset"), GUILayout.Width(150))) { preferences.ResetColorsToDefault(EditorGUIUtility.isProSkin); prefsChanged = true; @@ -136,29 +144,56 @@ public static void DrawPreferences(MulliganUserPreferences preferences) } } - private static LocaleLanguage DrawLanguageDropdown(LocaleLanguage currentLanguage) + private static void DrawUpdateLanguagesButton(LanguageRetriever retriever) + { + EditorGUI.BeginDisabledGroup(!retriever.IsDoneUpdating); + var useDebugPresets = Event.current.shift; + var buttonText = LocalizationManager.Instance.GetTranslation("updateLanguages"); + if (useDebugPresets) + { + buttonText = string.Concat(buttonText, "*"); + } + + if (GUILayout.Button(buttonText)) + { + retriever.UpdateLanguages(useDebugPresets); + } + + EditorGUI.EndDisabledGroup(); + } + + private static Language DrawLanguageDropdown(Language currentLanguage) { var content = new GUIContent( - LocaleManager.Instance.GetTranslation("language"), - LocaleManager.Instance.GetTranslation(" languageTooltip")); - var languages = new GUIContent[LocaleManager.Instance.AllLanguages.Count]; - for (int i = 0; i < LocaleManager.Instance.AllLanguages.Count; ++i) + LocalizationManager.Instance.GetTranslation("language"), + LocalizationManager.Instance.GetTranslation(" languageTooltip")); + var languages = new GUIContent[LocalizationManager.Instance.AllLanguages.Count]; + for (int i = 0; i < LocalizationManager.Instance.AllLanguages.Count; ++i) { - var language = LocaleManager.Instance.AllLanguages[i]; - languages[i] = new GUIContent(language.LanguageName); + var language = LocalizationManager.Instance.AllLanguages[i]; + languages[i] = new GUIContent(language.Name); } var currentLanguageIndex = GetLanguageIndex(currentLanguage); - var newIndex = EditorGUILayout.Popup(content, currentLanguageIndex, languages, GUILayout.MaxWidth(MaxWidth)); - return LocaleManager.Instance.AllLanguages[newIndex]; + if (currentLanguageIndex >= 0 && currentLanguageIndex < LocalizationManager.Instance.AllLanguages.Count) + { + var newIndex = EditorGUILayout.Popup(content, currentLanguageIndex, languages, GUILayout.MaxWidth(MaxWidth)); + return LocalizationManager.Instance.AllLanguages[newIndex]; + } + else + { + Debug.Log("Can't draw LanguageDropdown as the CurrentLanguage was not found in LocalizationManager." + + " Restarting Unity should fix this. This should not happen in production, please report it on GitHub issues."); + return LocalizationManager.Instance.CurrentLanguage; + } } - private static int GetLanguageIndex(LocaleLanguage language) + private static int GetLanguageIndex(Language language) { var currentLanguageIndex = -1; - for (int i = 0; i < LocaleManager.Instance.AllLanguages.Count; ++i) + for (int i = 0; i < LocalizationManager.Instance.AllLanguages.Count; ++i) { - if (LocaleManager.Instance.AllLanguages[i] == language) + if (LocalizationManager.Instance.AllLanguages[i].Key == language.Key) { currentLanguageIndex = i; break; @@ -197,10 +232,10 @@ private static void DrawSampleInsertionLabel(Rect rect, MulliganUserPreferences }; var renameResult = new RenameResult(); - renameResult.Add(new Diff(LocaleManager.Instance.GetTranslation("exampleThisIs") + " ", DiffOperation.Equal)); - renameResult.Add(new Diff(LocaleManager.Instance.GetTranslation("exampleSampleText"), DiffOperation.Insertion)); - renameResult.Add(new Diff(" " + LocaleManager.Instance.GetTranslation("exampleWithWords") + " ", DiffOperation.Equal)); - renameResult.Add(new Diff(LocaleManager.Instance.GetTranslation("exampleInserted"), DiffOperation.Insertion)); + renameResult.Add(new Diff(LocalizationManager.Instance.GetTranslation("exampleThisIs") + " ", DiffOperation.Equal)); + renameResult.Add(new Diff(LocalizationManager.Instance.GetTranslation("exampleSampleText"), DiffOperation.Insertion)); + renameResult.Add(new Diff(" " + LocalizationManager.Instance.GetTranslation("exampleWithWords") + " ", DiffOperation.Equal)); + renameResult.Add(new Diff(LocalizationManager.Instance.GetTranslation("exampleInserted"), DiffOperation.Insertion)); MulliganEditorGUIUtilities.DrawDiffLabel(rect, renameResult, false, diffLabelStyle, SampleDiffLabelStyle); } @@ -216,10 +251,10 @@ private static void DrawSampleDeletionLabel(Rect rect, MulliganUserPreferences p }; var renameResult = new RenameResult(); - renameResult.Add(new Diff(LocaleManager.Instance.GetTranslation("exampleThisIs") + " ", DiffOperation.Equal)); - renameResult.Add(new Diff(LocaleManager.Instance.GetTranslation("exampleSampleText"), DiffOperation.Deletion)); - renameResult.Add(new Diff(" " + LocaleManager.Instance.GetTranslation("exampleWithWords") + " ", DiffOperation.Equal)); - renameResult.Add(new Diff(LocaleManager.Instance.GetTranslation("exampleDeleted"), DiffOperation.Deletion)); + renameResult.Add(new Diff(LocalizationManager.Instance.GetTranslation("exampleThisIs") + " ", DiffOperation.Equal)); + renameResult.Add(new Diff(LocalizationManager.Instance.GetTranslation("exampleSampleText"), DiffOperation.Deletion)); + renameResult.Add(new Diff(" " + LocalizationManager.Instance.GetTranslation("exampleWithWords") + " ", DiffOperation.Equal)); + renameResult.Add(new Diff(LocalizationManager.Instance.GetTranslation("exampleDeleted"), DiffOperation.Deletion)); MulliganEditorGUIUtilities.DrawDiffLabel(rect, renameResult, true, diffLabelStyle, SampleDiffLabelStyle); } diff --git a/Assets/RedBlueGames/MulliganRenamer/Editor/GUI/SavePresetWindow.cs b/Assets/RedBlueGames/MulliganRenamer/Editor/GUI/SavePresetWindow.cs index 439d63b..6bc5deb 100644 --- a/Assets/RedBlueGames/MulliganRenamer/Editor/GUI/SavePresetWindow.cs +++ b/Assets/RedBlueGames/MulliganRenamer/Editor/GUI/SavePresetWindow.cs @@ -93,20 +93,20 @@ private void OnGUI() } EditorGUI.BeginDisabledGroup(!IsNameValid(this.enteredName)); - if (GUILayout.Button(LocaleManager.Instance.GetTranslation("save")) || (hitEnter && IsNameValid(this.enteredName))) + if (GUILayout.Button(LocalizationManager.Instance.GetTranslation("save")) || (hitEnter && IsNameValid(this.enteredName))) { var saveAndClose = false; if (this.existingPresetNames.Contains(this.enteredName)) { var popupMessage = string.Format( - LocaleManager.Instance.GetTranslation("errorPresetNameAlreadyExists"), + LocalizationManager.Instance.GetTranslation("errorPresetNameAlreadyExists"), this.enteredName ); - saveAndClose = EditorUtility.DisplayDialog(LocaleManager.Instance.GetTranslation("warning"), + saveAndClose = EditorUtility.DisplayDialog(LocalizationManager.Instance.GetTranslation("warning"), popupMessage, - LocaleManager.Instance.GetTranslation("replace"), - LocaleManager.Instance.GetTranslation("no")); + LocalizationManager.Instance.GetTranslation("replace"), + LocalizationManager.Instance.GetTranslation("no")); } else { diff --git a/Assets/RedBlueGames/MulliganRenamer/Editor/Locale/LocaleManager.cs b/Assets/RedBlueGames/MulliganRenamer/Editor/Locale/LocaleManager.cs deleted file mode 100644 index e7bc16c..0000000 --- a/Assets/RedBlueGames/MulliganRenamer/Editor/Locale/LocaleManager.cs +++ /dev/null @@ -1,145 +0,0 @@ -/* MIT License - -Copyright (c) 2019 Murillo Pugliesi Lopes, https://github.com/Mukarillo - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -*/ - -namespace RedBlueGames.MulliganRenamer -{ - using System; - using System.Collections.Generic; - using UnityEditor; - using UnityEngine; - - /// - /// At the constructor we load the the previous language that the user used - /// using english as the default. This will cache the language and it's translations - /// also we load all the languages by accesing the JSON files inside LocaleLanguagesPath path - /// this is used to show the available languages to the user - /// - public class LocaleManager - { - private static LocaleManager _Instance; - - private const string LocaleKey = "RedBlueGames.MulliganRenamer.Locale"; - - public event System.Action LanguageChanged; - - public static LocaleManager Instance - { - get - { - if (_Instance == null) - { - _Instance = new LocaleManager(); - } - - return _Instance; - } - } - - public LocaleLanguage CurrentLanguage - { - get - { - return currentLanguage; - } - } - - public List AllLanguages - { - get - { - return allLanguages; - } - } - - private LocaleLanguage currentLanguage; - private List allLanguages; - - private LocaleManager() - { - this.Initialize(); - } - - /// - /// Gets all the languages stored in the project for Mulligan - /// - /// A List of LocaleLanguages, loaded from disk. - public static List LoadAllLanguages() - { - var loadedLanguages = new List(); - var jsons = Resources.LoadAll("MulliganLanguages"); - foreach (var json in jsons) - { - var language = JsonUtility.FromJson(json.text); - if (!string.IsNullOrEmpty(language.LanguageKey)) - { - loadedLanguages.Add(language); - } - } - - return loadedLanguages; - } - - /// - /// (Re)Initialize the LocaleManager. This loads the languages and sets the language to English, if unset. - /// - public void Initialize() - { - this.CacheAllLanguages(); - this.ChangeLocale(EditorPrefs.GetString(LocaleKey, "en")); - } - - private void CacheAllLanguages() - { - this.allLanguages = LoadAllLanguages(); - } - - /// - /// Change the current Locale so that Translations are of the new, specified languages - /// - /// LanguageKey to change to - public void ChangeLocale(string languageKey) - { - EditorPrefs.SetString(LocaleKey, languageKey); - this.currentLanguage = allLanguages.Find(x => x.LanguageKey == languageKey); - if (this.LanguageChanged != null) - { - this.LanguageChanged.Invoke(); - } - } - - /// - /// Get the translated string for the specified key in the current language. - /// - /// Key whose value we will retrieve - /// The value stored at the key in the current language - public string GetTranslation(string localeKey) - { - if (this.currentLanguage == null) - { - throw new Exception("Current Language is not set"); - } - - return this.currentLanguage.GetValue(localeKey); - } - } -} \ No newline at end of file diff --git a/Assets/RedBlueGames/MulliganRenamer/Editor/Locale.meta b/Assets/RedBlueGames/MulliganRenamer/Editor/Localization.meta similarity index 100% rename from Assets/RedBlueGames/MulliganRenamer/Editor/Locale.meta rename to Assets/RedBlueGames/MulliganRenamer/Editor/Localization.meta diff --git a/Assets/RedBlueGames/MulliganRenamer/Editor/Locale/LocaleLanguage.cs b/Assets/RedBlueGames/MulliganRenamer/Editor/Localization/Language.cs similarity index 55% rename from Assets/RedBlueGames/MulliganRenamer/Editor/Locale/LocaleLanguage.cs rename to Assets/RedBlueGames/MulliganRenamer/Editor/Localization/Language.cs index 209f7ee..84ed46f 100644 --- a/Assets/RedBlueGames/MulliganRenamer/Editor/Locale/LocaleLanguage.cs +++ b/Assets/RedBlueGames/MulliganRenamer/Editor/Localization/Language.cs @@ -23,6 +23,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE namespace RedBlueGames.MulliganRenamer { + using System.Linq; using System.Collections.Generic; using UnityEngine; @@ -31,55 +32,64 @@ namespace RedBlueGames.MulliganRenamer /// you can get a translated content by its key calling Get method /// [System.Serializable] - public class LocaleLanguage - { + public class Language + { // These are assigned through Unity's serialization / deserialization. // So we Ignore warning about Unassigned field. - #pragma warning disable 0649 - [SerializeField] - private string languageName; - [SerializeField] - private string languageKey; - [SerializeField] - private List elements; - #pragma warning restore 0649 +#pragma warning disable 0649 + [SerializeField] + private string name; - public string LanguageName - { - get - { - return languageName; - } - } + [SerializeField] + private string key; - public string LanguageKey - { - get - { - return languageKey; - } - } + [SerializeField] + private int version; - public List Elements - { - get - { - return elements; - } - } + [SerializeField] + private List elements; +#pragma warning restore 0649 - public bool IsActive - { - get - { - return LocaleManager.Instance.CurrentLanguage == this; - } - } + /// + /// The Version of the language, used to determine whether or not data has been updated. + /// This should be incremented when changes are made. + /// + public int Version + { + get + { + return this.version; + } + } - public string GetValue(string key) - { - var locale = elements.Find(x => x.Key.Equals(key)); - return locale != null ? locale.Value : "A0"; - } - } + public string Name + { + get + { + return name; + } + } + + public string Key + { + get + { + return key; + } + } + + public List Elements + { + get + { + return elements; + } + } + + public string GetValue(string key) + { + var language = elements.Find(x => x.Key.Equals(key)); + return language != null ? language.Value : "A0"; + } + } } \ No newline at end of file diff --git a/Assets/RedBlueGames/MulliganRenamer/Editor/Locale/LocaleLanguage.cs.meta b/Assets/RedBlueGames/MulliganRenamer/Editor/Localization/Language.cs.meta similarity index 100% rename from Assets/RedBlueGames/MulliganRenamer/Editor/Locale/LocaleLanguage.cs.meta rename to Assets/RedBlueGames/MulliganRenamer/Editor/Localization/Language.cs.meta diff --git a/Assets/RedBlueGames/MulliganRenamer/Tests/Editor/LocaleManagerTests.cs b/Assets/RedBlueGames/MulliganRenamer/Editor/Localization/LanguageBookmarks.cs similarity index 54% rename from Assets/RedBlueGames/MulliganRenamer/Tests/Editor/LocaleManagerTests.cs rename to Assets/RedBlueGames/MulliganRenamer/Editor/Localization/LanguageBookmarks.cs index 83dea35..3c044cb 100644 --- a/Assets/RedBlueGames/MulliganRenamer/Tests/Editor/LocaleManagerTests.cs +++ b/Assets/RedBlueGames/MulliganRenamer/Editor/Localization/LanguageBookmarks.cs @@ -1,6 +1,6 @@ /* MIT License -Copyright (c) 2020 Murillo Pugliesi Lopes, https://github.com/Mukarillo +Copyright (c) 2016 Edward Rowe, RedBlueGames Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -21,37 +21,28 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +using System.Collections.Generic; +using UnityEngine; + namespace RedBlueGames.MulliganRenamer { - using NUnit.Framework; - using System; - - public class LocaleManagerTests + public class LanguageBookmarks { - private LocaleLanguage languageBeforeTest; - - [SetUp] - public void Init() - { - this.languageBeforeTest = LocaleManager.Instance.CurrentLanguage; - } - - [TearDown] - public void Cleanup() + // These are assigned through Unity's serialization / deserialization. + // So we Ignore warning about Unassigned field. +#pragma warning disable 0649 + [SerializeField] + private List languageUrls; +#pragma warning restore 0649 + + /// + /// + /// + public List LanguageUrls { - LocaleManager.Instance.ChangeLocale(this.languageBeforeTest.LanguageKey); - } - - [Test] - public void ChangeLanguage() - { - foreach (var language in LocaleManager.Instance.AllLanguages) + get { - LocaleManager.Instance.ChangeLocale(language.LanguageKey); - - Assert.That( - language.LanguageKey.Equals(LocaleManager.Instance.CurrentLanguage.LanguageKey), - "LocaleManager did not change language to specified language, " + language.LanguageName + "."); + return this.languageUrls; } } } diff --git a/Assets/RedBlueGames/MulliganRenamer/Editor/Localization/LanguageBookmarks.cs.meta b/Assets/RedBlueGames/MulliganRenamer/Editor/Localization/LanguageBookmarks.cs.meta new file mode 100644 index 0000000..183874b --- /dev/null +++ b/Assets/RedBlueGames/MulliganRenamer/Editor/Localization/LanguageBookmarks.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 58d93b52a9da64460b9a3c44dbc7224e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/RedBlueGames/MulliganRenamer/Editor/Localization/LanguageRetriever.cs b/Assets/RedBlueGames/MulliganRenamer/Editor/Localization/LanguageRetriever.cs new file mode 100644 index 0000000..95f9994 --- /dev/null +++ b/Assets/RedBlueGames/MulliganRenamer/Editor/Localization/LanguageRetriever.cs @@ -0,0 +1,239 @@ +/* MIT License + +Copyright (c) 2020 Edward Rowe + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + +namespace RedBlueGames.MulliganRenamer +{ + using System.Collections; + using System.Collections.Generic; + using UnityEditor; + using UnityEngine; + + /// + /// This class is responsible for getting, or retrieving, the up to date languages from the web. + /// + public class LanguageRetriever + { + private static readonly string BookmarksURIRelease = "https://raw.githubusercontent.com/redbluegames/unity-mulligan-renamer/master/LanguageBookmarks.json"; + + private static readonly string BookmarksURIStaging = "https://raw.githubusercontent.com/redbluegames/unity-mulligan-renamer/languages-from-web-tested/LanguageBookmarks.json"; + + public bool IsDoneUpdating { get; private set; } + + public LanguageRetriever() + { + this.IsDoneUpdating = true; + } + + public void UpdateLanguages(bool useStagingLink = false) + { + EditorCoroutineUtility.StartBackgroundTask(this.UpdateLanguagesAsync(useStagingLink), this.HandleUpdateComplete); + } + + private IEnumerator UpdateLanguagesAsync(bool useStagingLink = false) + { + EditorUtility.DisplayProgressBar( + LocalizationManager.Instance.GetTranslation("languageUpdateProgressTitle"), + LocalizationManager.Instance.GetTranslation("languageUpdateProgressMessage1"), + 0.0f); + this.IsDoneUpdating = false; + + LanguageBookmarks bookmarks = null; + { + var bookmarkRetriever = new JSONRetrieverWeb(useStagingLink ? BookmarksURIStaging : BookmarksURIRelease); + var bookmarkFetchOp = bookmarkRetriever.GetJSON(3); + while (bookmarkFetchOp.Status == AsyncStatus.Pending) + { + yield return null; + } + + if (bookmarkFetchOp.Status != AsyncStatus.Success) + { + ShowDisplayDialogForFailedOp(bookmarkFetchOp); + yield break; + } + + bookmarks = bookmarkFetchOp.ResultData; + } + + var languages = new List(); + { + for (int i = 0; i < bookmarks.LanguageUrls.Count; ++i) + { + var url = bookmarks.LanguageUrls[i]; + var uri = new System.Uri(bookmarks.LanguageUrls[i]); + string filename = System.IO.Path.GetFileName(uri.LocalPath); + + // Add one because we finished downloading Bookmarks. + var percentComplete = (i + 1) / (float)(bookmarks.LanguageUrls.Count + 1); + EditorUtility.DisplayProgressBar( + LocalizationManager.Instance.GetTranslation("languageUpdateProgressTitle"), + string.Format( + LocalizationManager.Instance.GetTranslation( + "languageUpdateDownloadingLanguages"), + filename), + percentComplete); + + var languageRetriever = new JSONRetrieverWeb(url); + var languageFetchOp = languageRetriever.GetJSON(3); + while (languageFetchOp.Status == AsyncStatus.Pending) + { + yield return null; + } + + if (languageFetchOp.Status != AsyncStatus.Success) + { + ShowDisplayDialogForFailedOp(languageFetchOp); + yield break; + } + + languages.Add(languageFetchOp.ResultData); + } + } + + EditorUtility.DisplayProgressBar( + LocalizationManager.Instance.GetTranslation("languageUpdateProgressTitle"), + LocalizationManager.Instance.GetTranslation("languageUpdateSavingChanges"), + 1.0f); + EditorUtility.ClearProgressBar(); + + var reports = LocalizationManager.Instance.AddOrUpdateLanguages(languages); + EditorUtility.DisplayDialog( + LocalizationManager.Instance.GetTranslation("languageUpdateProgressTitleSuccess"), + BuildDisplayStringForReport(reports), + LocalizationManager.Instance.GetTranslation("ok")); + } + + private static void ShowDisplayDialogForFailedOp(AsyncOp op) + { + var message = BuildDisplayStringForAsyncOp(op); + EditorUtility.ClearProgressBar(); + EditorUtility.DisplayDialog( + LocalizationManager.Instance.GetTranslation("languageUpdateProgressTitleFail"), + message, + LocalizationManager.Instance.GetTranslation("ok")); + } + + private static string BuildDisplayStringForAsyncOp(AsyncOp op) + { + string message = string.Empty; + if (op.Status == AsyncStatus.Timeout) + { + message = LocalizationManager.Instance.GetTranslation("languageUpdateTimeout"); + } + else if (op.Status == AsyncStatus.Failed) + { + message = string.Format( + LocalizationManager.Instance.GetTranslation("languageUpdateFail"), + op.FailureCode, + op.FailureMessage); + } + else + { + // Nothing to display for success or otherwise + } + + return message; + } + + private static string BuildDisplayStringForReport(List reports) + { + var updatedStringBuilder = new System.Text.StringBuilder(); + var addedLanguageStringBuilder = new System.Text.StringBuilder(); + var unchangedStringBuilder = new System.Text.StringBuilder(); + foreach (var report in reports) + { + if (report.Result == LocalizationManager.LanguageUpdateReport.UpdateResult.Updated) + { + if (updatedStringBuilder.Length > 0) + { + updatedStringBuilder.AppendLine(); + } + + updatedStringBuilder.AppendFormat( + string.Format( + LocalizationManager.Instance.GetTranslation("languageUpdated"), + report.Language.Name, + report.PreviousVersion, + report.NewVersion)); + } + else if (report.Result == LocalizationManager.LanguageUpdateReport.UpdateResult.Added) + { + if (addedLanguageStringBuilder.Length > 0) + { + addedLanguageStringBuilder.AppendLine(); + } + + addedLanguageStringBuilder.AppendFormat( + string.Format( + LocalizationManager.Instance.GetTranslation("languageAdded"), + report.Language.Name)); + } + else + { + if (unchangedStringBuilder.Length > 0) + { + unchangedStringBuilder.AppendLine(); + } + + unchangedStringBuilder.AppendFormat( + string.Format( + LocalizationManager.Instance.GetTranslation("languageUnchanged"), + report.Language.Name)); + } + } + + var message = new System.Text.StringBuilder(); + if (addedLanguageStringBuilder.Length > 0) + { + message.Append(addedLanguageStringBuilder); + } + + if (updatedStringBuilder.Length > 0) + { + if (message.Length > 0) + { + message.AppendLine(); + } + + message.Append(updatedStringBuilder); + } + + if (message.Length == 0) + { + message.Append(LocalizationManager.Instance.GetTranslation("languageAllUpToDate")); + } + else + { + message.AppendLine(); + message.Append(unchangedStringBuilder); + } + + return message.ToString(); + } + + private void HandleUpdateComplete() + { + this.IsDoneUpdating = true; + } + } +} \ No newline at end of file diff --git a/Assets/RedBlueGames/MulliganRenamer/Editor/Localization/LanguageRetriever.cs.meta b/Assets/RedBlueGames/MulliganRenamer/Editor/Localization/LanguageRetriever.cs.meta new file mode 100644 index 0000000..82de59e --- /dev/null +++ b/Assets/RedBlueGames/MulliganRenamer/Editor/Localization/LanguageRetriever.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9f2a074bcf1db48299f7d89f04cb6db3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/RedBlueGames/MulliganRenamer/Editor/Localization/LocalizationManager.cs b/Assets/RedBlueGames/MulliganRenamer/Editor/Localization/LocalizationManager.cs new file mode 100644 index 0000000..37f7eaf --- /dev/null +++ b/Assets/RedBlueGames/MulliganRenamer/Editor/Localization/LocalizationManager.cs @@ -0,0 +1,281 @@ +/* MIT License + +Copyright (c) 2019 Murillo Pugliesi Lopes, https://github.com/Mukarillo, +and Edward Rowe. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + +namespace RedBlueGames.MulliganRenamer +{ + using System; + using System.Collections.Generic; + using System.Linq; + using UnityEditor; + using UnityEngine; + + /// + /// Manages the loading and serving of languages. Use this to get translated strings + /// for the user's current language. + /// + public class LocalizationManager + { + private static LocalizationManager _Instance; + + private const string LanguagePrefKey = "RedBlueGames.MulliganRenamer.Locale"; + + private const string LanguageFoldername = "MulliganLanguages"; + + public event System.Action LanguageChanged; + + public static LocalizationManager Instance + { + get + { + if (_Instance == null) + { + _Instance = new LocalizationManager(); + } + + return _Instance; + } + } + + public Language CurrentLanguage + { + get + { + return this.currentLanguage; + } + } + + public List AllLanguages + { + get + { + return this.allLanguages; + } + } + + private Language currentLanguage; + private List allLanguages; + + private LocalizationManager() + { + this.Initialize(); + } + + /// + /// Gets all the languages stored in the project for Mulligan + /// + /// A List of LocaleLanguages, loaded from disk. + public static List LoadAllLanguages() + { + var loadedLanguages = new List(); + var jsons = Resources.LoadAll(LanguageFoldername); + foreach (var json in jsons) + { + var language = JsonUtility.FromJson(json.text); + if (!string.IsNullOrEmpty(language.Key)) + { + loadedLanguages.Add(language); + } + } + + // We may want control over the sorting, instead of just using the order they + // are loaded in Resources.LoadAll + SortLanguages(loadedLanguages); + + return loadedLanguages; + } + + /// + /// (Re)Initialize the LocaleManager. This loads the languages and sets the language to English, if unset. + /// + public void Initialize() + { + this.CacheAllLanguages(); + this.ChangeLanguage(EditorPrefs.GetString(LanguagePrefKey, "en")); + } + /// + /// Change the current Locale so that Translations are of the new, specified languages + /// + /// LanguageKey to change to + public void ChangeLanguage(string languageKey) + { + var language = this.allLanguages.FirstOrDefault(x => x.Key == languageKey); + if (language != null) + { + EditorPrefs.SetString(LanguagePrefKey, languageKey); + this.currentLanguage = language; + + if (this.LanguageChanged != null) + { + this.LanguageChanged.Invoke(); + } + } + } + + /// + /// Adds new languages and update existing ones that are new or newer versions, using the specified languages. + /// + /// Languages to update + public List AddOrUpdateLanguages(IEnumerable languages) + { + // Need to reload the languages in the LocalizationManager so that we compare + // the new languages against up to date ones. For example, if the user deletes a + // language or adds their own in the same session. Mostly this is just a use-case in testing. + this.Initialize(); + + var languageUpdateReports = new List(); + + foreach (var language in languages) + { + var report = LocalizationManager.Instance.UpdateLanguage(language); + languageUpdateReports.Add(report); + } + + // Resort the languages in case they got reshuffled + SortLanguages(this.allLanguages); + + return languageUpdateReports; + } + + /// + /// Get the translated string for the specified key in the current language. + /// + /// Key whose value we will retrieve + /// The value stored at the key in the current language + public string GetTranslation(string languageKey) + { + if (this.currentLanguage == null) + { + throw new Exception("Current Language is not set"); + } + + return this.currentLanguage.GetValue(languageKey); + } + + private void CacheAllLanguages() + { + this.allLanguages = LoadAllLanguages(); + } + + private LanguageUpdateReport UpdateLanguage(Language newLanguage) + { + var report = new LanguageUpdateReport(); + report.Language = newLanguage; + Language existingLanguage = this.allLanguages.FirstOrDefault((l) => l.Key == newLanguage.Key); + if (existingLanguage == null) + { + report.Result = LanguageUpdateReport.UpdateResult.Added; + this.SaveLanguageToDisk(newLanguage); + } + else if (newLanguage.Version > existingLanguage.Version) + { + report.Result = LanguageUpdateReport.UpdateResult.Updated; + report.PreviousVersion = existingLanguage.Version; + report.NewVersion = newLanguage.Version; + this.SaveLanguageToDisk(newLanguage); + } + else + { + report.Result = LanguageUpdateReport.UpdateResult.NoChange; + } + + // newLanguage is a new language instance, even if it's the same "language", so + // we need to update the reference for the CurrentLanguage to the new one. + // Note this is not really "changing languages" so we don't fire the callback or update PrefKey + if (this.CurrentLanguage.Key == newLanguage.Key) + { + this.currentLanguage = newLanguage; + } + + return report; + } + + private void SaveLanguageToDisk(Language language) + { + var directory = GetPathToLanguages(); + var json = JsonUtility.ToJson(language, true); + var filename = string.Concat(language.Key, ".json"); + var path = System.IO.Path.Combine(directory, filename); + + System.IO.File.WriteAllText(path, json); + AssetDatabase.ImportAsset(path, ImportAssetOptions.Default); + + // We need to unload the language if it exists so that we don't have two versions loaded + this.UnloadLanguage(language); + + this.allLanguages.Add(language); + } + + private void UnloadLanguage(Language language) + { + for (int i = this.allLanguages.Count - 1; i >= 0; --i) + { + if (this.allLanguages[i].Key == language.Key) + { + this.allLanguages.RemoveAt(i); + } + } + } + + private static void SortLanguages(List languages) + { + languages.Sort(CompareLangauges); + } + + private static int CompareLangauges(Language languageA, Language languageB) + { + return UnityEditor.EditorUtility.NaturalCompare(languageA.Key, languageB.Key); + } + + private static string GetPathToLanguages() + { + var jsons = Resources.LoadAll(LanguageFoldername); + if (jsons == null || jsons.Length == 0) + { + // This would happen if a user deletes all their languages. + return string.Empty; + } + + var pathToFirstLanguage = AssetDatabase.GetAssetPath(jsons[0]); + return System.IO.Path.GetDirectoryName(pathToFirstLanguage); + } + + public class LanguageUpdateReport + { + public Language Language { get; set; } + + public UpdateResult Result { get; set; } + + public int PreviousVersion { get; set; } + + public int NewVersion { get; set; } + + public enum UpdateResult + { + NoChange, + Updated, + Added + } + } + } +} \ No newline at end of file diff --git a/Assets/RedBlueGames/MulliganRenamer/Editor/Locale/LocaleManager.cs.meta b/Assets/RedBlueGames/MulliganRenamer/Editor/Localization/LocalizationManager.cs.meta similarity index 100% rename from Assets/RedBlueGames/MulliganRenamer/Editor/Locale/LocaleManager.cs.meta rename to Assets/RedBlueGames/MulliganRenamer/Editor/Localization/LocalizationManager.cs.meta diff --git a/Assets/RedBlueGames/MulliganRenamer/Editor/Locale/Locale.cs b/Assets/RedBlueGames/MulliganRenamer/Editor/Localization/LocalizedString.cs similarity index 98% rename from Assets/RedBlueGames/MulliganRenamer/Editor/Locale/Locale.cs rename to Assets/RedBlueGames/MulliganRenamer/Editor/Localization/LocalizedString.cs index 2ed7e2a..a6f5567 100644 --- a/Assets/RedBlueGames/MulliganRenamer/Editor/Locale/Locale.cs +++ b/Assets/RedBlueGames/MulliganRenamer/Editor/Localization/LocalizedString.cs @@ -29,7 +29,7 @@ namespace RedBlueGames.MulliganRenamer /// Class responsible for holding the data for localized text /// [System.Serializable] - public class Locale + public class LocalizedString { // These are assigned through Unity's serialization / deserialization. // So we Ignore warning about Unassigned field. diff --git a/Assets/RedBlueGames/MulliganRenamer/Editor/Locale/Locale.cs.meta b/Assets/RedBlueGames/MulliganRenamer/Editor/Localization/LocalizedString.cs.meta similarity index 100% rename from Assets/RedBlueGames/MulliganRenamer/Editor/Locale/Locale.cs.meta rename to Assets/RedBlueGames/MulliganRenamer/Editor/Localization/LocalizedString.cs.meta diff --git a/Assets/RedBlueGames/MulliganRenamer/Editor/Networking.meta b/Assets/RedBlueGames/MulliganRenamer/Editor/Networking.meta new file mode 100644 index 0000000..3f3f2b3 --- /dev/null +++ b/Assets/RedBlueGames/MulliganRenamer/Editor/Networking.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d3be638cad9b748a9b92d42193d1e2ea +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/RedBlueGames/MulliganRenamer/Editor/Networking/AsyncOp.cs b/Assets/RedBlueGames/MulliganRenamer/Editor/Networking/AsyncOp.cs new file mode 100644 index 0000000..c9821c3 --- /dev/null +++ b/Assets/RedBlueGames/MulliganRenamer/Editor/Networking/AsyncOp.cs @@ -0,0 +1,126 @@ +/* MIT License + +Copyright (c) 2016 Edward Rowe, RedBlueGames + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + +// The following #define can be uncommented to force a minimal delay forcing AsyncOps +// to return "Pending". This is useful for testing in-editor where most async ops are +// actually synchronous/instant. + +// #define DELAY_ASYNCOP + +namespace RedBlueGames.MulliganRenamer +{ + using System.Collections; + using UnityEngine; + + /// + /// AsyncOperation provides a way to query when an asynchronous operation has completed + /// and what the result was. + /// + public class AsyncOp + { + /* Consts, Fields ========================================================================================================= */ + + private AsyncStatus status; + +#if DELAY_ASYNCOP + private int pendingDelayCounter; +#endif + + /* Constructors, Enums ==================================================================================================== */ + + /// + /// Constructs a pending asynchronous operation. + /// + public AsyncOp() + { + this.Status = AsyncStatus.Pending; + } + + /// + /// Constructs the asynchronous operations. Status can be set directly if the + /// operation is synchronous on a certain platform. + /// + public AsyncOp(AsyncStatus status) + { + this.Status = status; + } + + /// + /// The current status of the operation. + /// + public AsyncStatus Status + { +#if DELAY_ASYNCOP + get + { + return (++this.pendingDelayCounter < 250) ? AsyncStatus.Pending : this.status; + } +#else + get + { + return this.status; + } +#endif + set + { + this.status = value; + } + } + + public string FailureCode { get; set; } + + public string FailureMessage { get; set; } + + public IEnumerator WaitForResult(float timeout, System.Action timeoutCallback) + { + var startTime = Time.realtimeSinceStartup; + while (this.Status == AsyncStatus.Pending) + { + if (Time.realtimeSinceStartup - startTime > timeout) + { + if (timeoutCallback != null) + { + timeoutCallback.Invoke(); + } + + break; + } + + yield return null; + } + } + } + + /// + /// A derived that allows for extra result information to be provided to the caller. + /// + /// The type of result information to provide. + public class AsyncOp : AsyncOp + { + public AsyncOp() : base() { } + + public AsyncOp(AsyncStatus status) : base(status) { } + + public T ResultData { get; set; } + } +} \ No newline at end of file diff --git a/Assets/RedBlueGames/MulliganRenamer/Editor/Networking/AsyncOp.cs.meta b/Assets/RedBlueGames/MulliganRenamer/Editor/Networking/AsyncOp.cs.meta new file mode 100644 index 0000000..0535a43 --- /dev/null +++ b/Assets/RedBlueGames/MulliganRenamer/Editor/Networking/AsyncOp.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2afa8daae8986480d930d7525b89a7b3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/RedBlueGames/MulliganRenamer/Editor/Networking/AsyncStatus.cs b/Assets/RedBlueGames/MulliganRenamer/Editor/Networking/AsyncStatus.cs new file mode 100644 index 0000000..f233655 --- /dev/null +++ b/Assets/RedBlueGames/MulliganRenamer/Editor/Networking/AsyncStatus.cs @@ -0,0 +1,71 @@ +/* MIT License + +Copyright (c) 2016 Edward Rowe, RedBlueGames + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + +namespace RedBlueGames.MulliganRenamer +{ + /// + /// The status of an asynchronous operation. Custom AsyncStatus singleton instances + /// can be created to denote specific types of failure. A generic Failure status is + /// also included below but note that it may not be the only type of failure assigned. + /// + public sealed class AsyncStatus + { + public AsyncStatus(string description) { this.Description = description; } + + /// + /// The description of this status. + /// + public readonly string Description; + + /// + /// Status result for async operations that have not completed. + /// + public static readonly AsyncStatus Pending = new AsyncStatus("Pending"); + + /// + /// Status result for successfully completed async operations. + /// + public static readonly AsyncStatus Success = new AsyncStatus("Success"); + + /// + /// Status result for canceled async operations. + /// + public static readonly AsyncStatus Canceled = new AsyncStatus("Canceled"); + + /// + /// Status result for a timedout async operations. + /// + public static readonly AsyncStatus Timeout = new AsyncStatus("Timeout"); + + /// + /// Status result for a failed async operations. Note that other custom failure + /// types may be created, so *avoid* (op == AsyncOp.Failed) style checks. + /// + public static readonly AsyncStatus Failed = new AsyncStatus("Failed"); + + public override string ToString() + { + return this.Description; + } + } +} \ No newline at end of file diff --git a/Assets/RedBlueGames/MulliganRenamer/Editor/Networking/AsyncStatus.cs.meta b/Assets/RedBlueGames/MulliganRenamer/Editor/Networking/AsyncStatus.cs.meta new file mode 100644 index 0000000..c1466ba --- /dev/null +++ b/Assets/RedBlueGames/MulliganRenamer/Editor/Networking/AsyncStatus.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 70afa1a09539a46aeadf26cbbdbe0037 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/RedBlueGames/MulliganRenamer/Editor/Networking/IWebRequest.cs b/Assets/RedBlueGames/MulliganRenamer/Editor/Networking/IWebRequest.cs new file mode 100644 index 0000000..c7718fd --- /dev/null +++ b/Assets/RedBlueGames/MulliganRenamer/Editor/Networking/IWebRequest.cs @@ -0,0 +1,51 @@ +/* MIT License + +Copyright (c) 2016 Edward Rowe, RedBlueGames + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + +namespace RedBlueGames.MulliganRenamer +{ + using System; + + /// + /// Defines the functionality needed for requesting Text from the web. + /// This is used to code JSONRetriever to a testable interface. + /// + + public interface IWebRequest : IDisposable + { + void SendWebRequest(); + + int Timeout { get; set; } + + bool IsDone { get; } + + bool IsNetworkError { get; } + + bool IsHttpError { get; } + + bool IsTimeout { get; } + + string ErrorText { get; } + + string DownloadedText { get; } + } +} \ No newline at end of file diff --git a/Assets/RedBlueGames/MulliganRenamer/Editor/Networking/IWebRequest.cs.meta b/Assets/RedBlueGames/MulliganRenamer/Editor/Networking/IWebRequest.cs.meta new file mode 100644 index 0000000..e2ea73b --- /dev/null +++ b/Assets/RedBlueGames/MulliganRenamer/Editor/Networking/IWebRequest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 64d55f1c146014391a64366816df3439 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/RedBlueGames/MulliganRenamer/Editor/Networking/JSONRetrieverWeb.cs b/Assets/RedBlueGames/MulliganRenamer/Editor/Networking/JSONRetrieverWeb.cs new file mode 100644 index 0000000..67cd263 --- /dev/null +++ b/Assets/RedBlueGames/MulliganRenamer/Editor/Networking/JSONRetrieverWeb.cs @@ -0,0 +1,114 @@ +/* MIT License + +Copyright (c) 2016 Edward Rowe, RedBlueGames + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + +using System.Collections; +using System; +using UnityEngine; + +namespace RedBlueGames.MulliganRenamer +{ + /// + /// Get a JSON object from a specified address using the specified IWebRequest + /// + /// Type of the JSON object to contstruct after fetching the file. + public class JSONRetrieverWeb + { + public static readonly string ErrorCodeNetworkError = "Network Error"; + public static readonly string ErrorCodeHttpError = "Http Error"; + public static readonly string ErrorCodeInvalidJsonFormat = "Invalid JSON format"; + + private IWebRequest requester; + + private AsyncOp outstandingOp; + + public JSONRetrieverWeb(string uri) : this(UnityWebRequestWrapper.Get(uri)) + { + Uri uriResult; + bool result = Uri.TryCreate(uri, UriKind.Absolute, out uriResult) + && (uriResult.Scheme == Uri.UriSchemeHttp || uriResult.Scheme == Uri.UriSchemeHttps); + if (!result) + { + throw new System.ArgumentException("Invalid URI Format."); + } + } + + public JSONRetrieverWeb(IWebRequest requester) + { + this.requester = requester; + } + + /// + /// Request the JSON from the web using the initialized uri. + /// + /// Timeout for the web request, which returns AsyncStatus of Timeout. + /// An AsyncOp. Query this for the status of the operation and for its results. + public AsyncOp GetJSON(int timeout) + { + this.outstandingOp = new AsyncOp(); + EditorCoroutineUtility.StartBackgroundTask(this.Post(requester, timeout)); + return this.outstandingOp; + } + + private IEnumerator Post(IWebRequest requester, int timeout) + { + using (this.requester) + { + requester.Timeout = timeout; + + requester.SendWebRequest(); + while (!requester.IsDone) + { + yield return null; + } + + if (requester.IsTimeout) + { + this.outstandingOp.Status = AsyncStatus.Timeout; + yield break; + } + + if (requester.IsNetworkError || requester.IsHttpError) + { + this.outstandingOp.Status = AsyncStatus.Failed; + this.outstandingOp.FailureCode = requester.IsHttpError ? ErrorCodeHttpError : ErrorCodeNetworkError; + this.outstandingOp.FailureMessage = requester.ErrorText; + yield break; + } + + this.outstandingOp.Status = AsyncStatus.Success; + + try + { + var json = JsonUtility.FromJson(requester.DownloadedText); + this.outstandingOp.ResultData = json; + } + catch (System.ArgumentException e) + { + this.outstandingOp.Status = AsyncStatus.Failed; + this.outstandingOp.FailureCode = ErrorCodeInvalidJsonFormat; + this.outstandingOp.FailureMessage = e.Message; + } + } + } + } +} \ No newline at end of file diff --git a/Assets/RedBlueGames/MulliganRenamer/Editor/Networking/JSONRetrieverWeb.cs.meta b/Assets/RedBlueGames/MulliganRenamer/Editor/Networking/JSONRetrieverWeb.cs.meta new file mode 100644 index 0000000..4f350dc --- /dev/null +++ b/Assets/RedBlueGames/MulliganRenamer/Editor/Networking/JSONRetrieverWeb.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3be2c00468c274bdbb45dd75d1918b17 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/RedBlueGames/MulliganRenamer/Editor/Networking/UnityWebRequestWrapper.cs b/Assets/RedBlueGames/MulliganRenamer/Editor/Networking/UnityWebRequestWrapper.cs new file mode 100644 index 0000000..a48c574 --- /dev/null +++ b/Assets/RedBlueGames/MulliganRenamer/Editor/Networking/UnityWebRequestWrapper.cs @@ -0,0 +1,127 @@ +/* MIT License + +Copyright (c) 2020 Edward Rowe + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + +namespace RedBlueGames.MulliganRenamer +{ + using System; + using UnityEngine.Networking; + + /// + /// This Wrapper is used so that we can better test JSONRetrievers by coding + /// to a common interface. The wrapper exposes only the functionality we need + /// for JSONRetrievers, which is defined in IWebRequest. + /// + public class UnityWebRequestWrapper : IWebRequest, IDisposable + { + private UnityWebRequest webRequest; + + public int Timeout + { + get + { + return this.webRequest.timeout; + } + + set + { + this.webRequest.timeout = value; + } + } + + public bool IsTimeout + { + get + { + return this.webRequest.isNetworkError && this.webRequest.error == "Request timeout"; + } + } + + public bool IsDone + { + get + { + return this.webRequest.isDone; + } + } + + public bool IsNetworkError + { + get + { + return this.webRequest.isNetworkError; + } + } + + public bool IsHttpError + { + get + { + return this.webRequest.isHttpError; + } + } + + public string ErrorText + { + get + { + return this.webRequest.error; + } + } + + public string DownloadedText + { + get + { + return this.webRequest.downloadHandler.text; + } + } + + /// + /// Create an instance ready to go for a GET request. This mirror's UnityWebRequest's API. + /// + /// Address for the GET + /// The object that can be used to execute the web request + public static UnityWebRequestWrapper Get(string uri) + { + return new UnityWebRequestWrapper(uri); + } + + private UnityWebRequestWrapper(string uri) + { + this.webRequest = UnityWebRequest.Get(uri); + } + + /// + /// Asynchronously send the request to the web. Query IsDone to see if it's complete. + /// + public void SendWebRequest() + { + this.webRequest.SendWebRequest(); + } + + public void Dispose() + { + this.webRequest.Dispose(); + } + } +} \ No newline at end of file diff --git a/Assets/RedBlueGames/MulliganRenamer/Editor/Networking/UnityWebRequestWrapper.cs.meta b/Assets/RedBlueGames/MulliganRenamer/Editor/Networking/UnityWebRequestWrapper.cs.meta new file mode 100644 index 0000000..b33d8d2 --- /dev/null +++ b/Assets/RedBlueGames/MulliganRenamer/Editor/Networking/UnityWebRequestWrapper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3067e9f7317df4229aab03d38957c449 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/RedBlueGames/MulliganRenamer/Editor/OperationDrawers/AddStringOperationDrawer.cs b/Assets/RedBlueGames/MulliganRenamer/Editor/OperationDrawers/AddStringOperationDrawer.cs index 87fc743..b3c9d34 100644 --- a/Assets/RedBlueGames/MulliganRenamer/Editor/OperationDrawers/AddStringOperationDrawer.cs +++ b/Assets/RedBlueGames/MulliganRenamer/Editor/OperationDrawers/AddStringOperationDrawer.cs @@ -48,7 +48,7 @@ public override string HeadingLabel { get { - return LocaleManager.Instance.GetTranslation("addPrefixOrSuffix"); + return LocalizationManager.Instance.GetTranslation("addPrefixOrSuffix"); } } @@ -72,7 +72,7 @@ public override string ControlToFocus { get { - return LocaleManager.Instance.GetTranslation("prefix"); + return LocalizationManager.Instance.GetTranslation("prefix"); } } @@ -92,16 +92,16 @@ protected override float GetPreferredHeightForContents() /// The prefix of the control to assign to the control names protected override void DrawContents(Rect operationRect, int controlPrefix) { - GUI.SetNextControlName(GUIControlNameUtility.CreatePrefixedName(controlPrefix, LocaleManager.Instance.GetTranslation("prefix"))); + GUI.SetNextControlName(GUIControlNameUtility.CreatePrefixedName(controlPrefix, LocalizationManager.Instance.GetTranslation("prefix"))); this.RenameOperation.Prefix = EditorGUI.TextField( operationRect.GetSplitVertical(1, 2, LineSpacing), - LocaleManager.Instance.GetTranslation("prefix"), + LocalizationManager.Instance.GetTranslation("prefix"), this.RenameOperation.Prefix); - GUI.SetNextControlName(GUIControlNameUtility.CreatePrefixedName(controlPrefix, LocaleManager.Instance.GetTranslation("suffix"))); + GUI.SetNextControlName(GUIControlNameUtility.CreatePrefixedName(controlPrefix, LocalizationManager.Instance.GetTranslation("suffix"))); this.RenameOperation.Suffix = EditorGUI.TextField( operationRect.GetSplitVertical(2, 2, LineSpacing), - LocaleManager.Instance.GetTranslation("suffix"), + LocalizationManager.Instance.GetTranslation("suffix"), this.RenameOperation.Suffix); } } diff --git a/Assets/RedBlueGames/MulliganRenamer/Editor/OperationDrawers/AddStringSequenceOperationDrawer.cs b/Assets/RedBlueGames/MulliganRenamer/Editor/OperationDrawers/AddStringSequenceOperationDrawer.cs index a9e8e13..d411509 100644 --- a/Assets/RedBlueGames/MulliganRenamer/Editor/OperationDrawers/AddStringSequenceOperationDrawer.cs +++ b/Assets/RedBlueGames/MulliganRenamer/Editor/OperationDrawers/AddStringSequenceOperationDrawer.cs @@ -49,7 +49,7 @@ public override string HeadingLabel { get { - return LocaleManager.Instance.GetTranslation("addStringSequence"); + return LocalizationManager.Instance.GetTranslation("addStringSequence"); } } @@ -73,7 +73,7 @@ public override string ControlToFocus { get { - return LocaleManager.Instance.GetTranslation("sequence"); + return LocalizationManager.Instance.GetTranslation("sequence"); } } @@ -117,11 +117,11 @@ protected override void DrawContents(Rect operationRect, int controlPrefix) private string[] DrawStringSequenceField(Rect rect, int controlPrefix, string[] stringSequence) { - GUI.SetNextControlName(GUIControlNameUtility.CreatePrefixedName(controlPrefix, LocaleManager.Instance.GetTranslation("sequence"))); + GUI.SetNextControlName(GUIControlNameUtility.CreatePrefixedName(controlPrefix, LocalizationManager.Instance.GetTranslation("sequence"))); var sequenceContent = new GUIContent( - LocaleManager.Instance.GetTranslation("sequence"), - LocaleManager.Instance.GetTranslation("theSequenceOfStringsToAddCommaSeparted")); + LocalizationManager.Instance.GetTranslation("sequence"), + LocalizationManager.Instance.GetTranslation("theSequenceOfStringsToAddCommaSeparted")); var oldSequence = StringUtilities.AddCommasBetweenStrings(stringSequence); var sequenceStrings = oldSequence; var sequenceWithCommas = EditorGUI.TextField( @@ -135,8 +135,8 @@ private string[] DrawStringSequenceField(Rect rect, int controlPrefix, string[] private bool DrawPrependField(Rect rect, int controlPrefix, bool originalPrepend) { var content = new GUIContent( - LocaleManager.Instance.GetTranslation("addAsPrefix"), - LocaleManager.Instance.GetTranslation("addTheCountToTheFrontOfTheObjectName")); + LocalizationManager.Instance.GetTranslation("addAsPrefix"), + LocalizationManager.Instance.GetTranslation("addTheCountToTheFrontOfTheObjectName")); GUI.SetNextControlName(GUIControlNameUtility.CreatePrefixedName(controlPrefix, content.text)); return EditorGUI.Toggle(rect, content, originalPrepend); } diff --git a/Assets/RedBlueGames/MulliganRenamer/Editor/OperationDrawers/AdjustNumberingOperationDrawer.cs b/Assets/RedBlueGames/MulliganRenamer/Editor/OperationDrawers/AdjustNumberingOperationDrawer.cs index c1806c3..2dd7657 100644 --- a/Assets/RedBlueGames/MulliganRenamer/Editor/OperationDrawers/AdjustNumberingOperationDrawer.cs +++ b/Assets/RedBlueGames/MulliganRenamer/Editor/OperationDrawers/AdjustNumberingOperationDrawer.cs @@ -36,7 +36,7 @@ public override string MenuDisplayPath { get { - return LocaleManager.Instance.GetTranslation("modify") + "/" + LocaleManager.Instance.GetTranslation("adjustNumbers"); + return LocalizationManager.Instance.GetTranslation("modify") + "/" + LocalizationManager.Instance.GetTranslation("adjustNumbers"); } } @@ -48,7 +48,7 @@ public override string HeadingLabel { get { - return LocaleManager.Instance.GetTranslation("adjustNumbers"); + return LocalizationManager.Instance.GetTranslation("adjustNumbers"); } } @@ -72,7 +72,7 @@ public override string ControlToFocus { get { - return LocaleManager.Instance.GetTranslation("offset"); + return LocalizationManager.Instance.GetTranslation("offset"); } } @@ -92,10 +92,10 @@ protected override float GetPreferredHeightForContents() /// The prefix of the control to assign to the control names protected override void DrawContents(Rect operationRect, int controlPrefix) { - GUI.SetNextControlName(GUIControlNameUtility.CreatePrefixedName(controlPrefix, LocaleManager.Instance.GetTranslation("offset"))); + GUI.SetNextControlName(GUIControlNameUtility.CreatePrefixedName(controlPrefix, LocalizationManager.Instance.GetTranslation("offset"))); this.RenameOperation.Offset = EditorGUI.IntField( operationRect.GetSplitVertical(1, 1, LineSpacing), - LocaleManager.Instance.GetTranslation("offset"), + LocalizationManager.Instance.GetTranslation("offset"), this.RenameOperation.Offset); } } diff --git a/Assets/RedBlueGames/MulliganRenamer/Editor/OperationDrawers/ChangeCaseOperationDrawer.cs b/Assets/RedBlueGames/MulliganRenamer/Editor/OperationDrawers/ChangeCaseOperationDrawer.cs index 37983fa..992a13e 100644 --- a/Assets/RedBlueGames/MulliganRenamer/Editor/OperationDrawers/ChangeCaseOperationDrawer.cs +++ b/Assets/RedBlueGames/MulliganRenamer/Editor/OperationDrawers/ChangeCaseOperationDrawer.cs @@ -48,7 +48,7 @@ public override string HeadingLabel { get { - return LocaleManager.Instance.GetTranslation("toUpperOrLowercase"); + return LocalizationManager.Instance.GetTranslation("toUpperOrLowercase"); } } @@ -72,7 +72,7 @@ public override string ControlToFocus { get { - return LocaleManager.Instance.GetTranslation("toUppercase"); + return LocalizationManager.Instance.GetTranslation("toUppercase"); } } @@ -95,10 +95,10 @@ protected override void DrawContents(Rect operationRect, int controlPrefix) var singleLineRect = operationRect.GetSplitVertical(1, 2, LineSpacing); var casingLabel = new GUIContent( - LocaleManager.Instance.GetTranslation("newCasing"), - LocaleManager.Instance.GetTranslation("theDesiredCasingForName")); - GUI.SetNextControlName(GUIControlNameUtility.CreatePrefixedName(controlPrefix, LocaleManager.Instance.GetTranslation("toUppercase"))); - var options = new GUIContent[] {new GUIContent(LocaleManager.Instance.GetTranslation("Lowercase")), new GUIContent(LocaleManager.Instance.GetTranslation("Uppercase"))}; + LocalizationManager.Instance.GetTranslation("newCasing"), + LocalizationManager.Instance.GetTranslation("theDesiredCasingForName")); + GUI.SetNextControlName(GUIControlNameUtility.CreatePrefixedName(controlPrefix, LocalizationManager.Instance.GetTranslation("toUppercase"))); + var options = new GUIContent[] {new GUIContent(LocalizationManager.Instance.GetTranslation("Lowercase")), new GUIContent(LocalizationManager.Instance.GetTranslation("Uppercase"))}; this.RenameOperation.Casing = (ChangeCaseOperation.CasingChange)EditorGUI.Popup( singleLineRect, casingLabel, @@ -107,9 +107,9 @@ protected override void DrawContents(Rect operationRect, int controlPrefix) var firstCharOnlyRect = operationRect.GetSplitVertical(2, 2, LineSpacing); var firstCharToggleLabel = new GUIContent( - LocaleManager.Instance.GetTranslation("onlyFirstCharacter"), - LocaleManager.Instance.GetTranslation("changeOnlyTheFirstCharacterCase")); - GUI.SetNextControlName(GUIControlNameUtility.CreatePrefixedName(controlPrefix, LocaleManager.Instance.GetTranslation("firstCharOnly"))); + LocalizationManager.Instance.GetTranslation("onlyFirstCharacter"), + LocalizationManager.Instance.GetTranslation("changeOnlyTheFirstCharacterCase")); + GUI.SetNextControlName(GUIControlNameUtility.CreatePrefixedName(controlPrefix, LocalizationManager.Instance.GetTranslation("firstCharOnly"))); this.RenameOperation.ChangeFirstCharacterOnly = EditorGUI.Toggle( firstCharOnlyRect, firstCharToggleLabel, diff --git a/Assets/RedBlueGames/MulliganRenamer/Editor/OperationDrawers/CountByLetterOperationDrawer.cs b/Assets/RedBlueGames/MulliganRenamer/Editor/OperationDrawers/CountByLetterOperationDrawer.cs index 95bbbd7..6d15270 100644 --- a/Assets/RedBlueGames/MulliganRenamer/Editor/OperationDrawers/CountByLetterOperationDrawer.cs +++ b/Assets/RedBlueGames/MulliganRenamer/Editor/OperationDrawers/CountByLetterOperationDrawer.cs @@ -30,8 +30,8 @@ namespace RedBlueGames.MulliganRenamer public class CountByLetterOperationDrawer : RenameOperationDrawer { private readonly GUIContent CustomSequenceContent = new GUIContent( - LocaleManager.Instance.GetTranslation("strings"), - LocaleManager.Instance.GetTranslation("theStringsOfLettersToAdd")); + LocalizationManager.Instance.GetTranslation("strings"), + LocalizationManager.Instance.GetTranslation("theStringsOfLettersToAdd")); public CountByLetterOperationDrawer() { @@ -58,7 +58,7 @@ public override string HeadingLabel { get { - return LocaleManager.Instance.GetTranslation("countByLetter"); + return LocalizationManager.Instance.GetTranslation("countByLetter"); } } @@ -82,7 +82,7 @@ public override string ControlToFocus { get { - return LocaleManager.Instance.GetTranslation("format"); + return LocalizationManager.Instance.GetTranslation("format"); } } @@ -180,8 +180,8 @@ private CountByLetterPresetGUI DrawSequenceSelection(Rect rect, int controlPrefi { GUI.SetNextControlName(GUIControlNameUtility.CreatePrefixedName(controlPrefix, "Format")); var modeContent = new GUIContent( - LocaleManager.Instance.GetTranslation("format"), - LocaleManager.Instance.GetTranslation("formatForTheAddedLetters")); + LocalizationManager.Instance.GetTranslation("format"), + LocalizationManager.Instance.GetTranslation("formatForTheAddedLetters")); var optionsContent = new GUIContent[this.GUIPresets.Count]; for (int i = 0; i < optionsContent.Length; ++i) { @@ -221,8 +221,8 @@ private int DrawCountFromField(Rect rect, int controlPrefix, int originalIndex) var weights = new float[] { 0.65f, 0.35f }; var intFieldRect = rect.GetSplitHorizontalWeighted(1, 0.0f, weights); var content = new GUIContent( - LocaleManager.Instance.GetTranslation("countFrom"), - LocaleManager.Instance.GetTranslation("theValueToStartCounting")); + LocalizationManager.Instance.GetTranslation("countFrom"), + LocalizationManager.Instance.GetTranslation("theValueToStartCounting")); GUI.SetNextControlName(GUIControlNameUtility.CreatePrefixedName(controlPrefix, content.text)); // Add and subtract 1 so that it displays as 1 based. @@ -236,7 +236,7 @@ private int DrawCountFromField(Rect rect, int controlPrefix, int originalIndex) labelStyle.alignment = TextAnchor.MiddleLeft; var labelRect = rect.GetSplitHorizontalWeighted(2, 0.0f, weights); EditorGUI.LabelField(labelRect, new GUIContent( - LocaleManager.Instance.GetTranslation("startsWith") + ": " + stringToCountFrom), + LocalizationManager.Instance.GetTranslation("startsWith") + ": " + stringToCountFrom), labelStyle); EditorGUI.EndDisabledGroup(); } @@ -248,8 +248,8 @@ private int DrawCountFromField(Rect rect, int controlPrefix, int originalIndex) private int DrawIncrementField(Rect rect, int controlPrefix, int originalIncrement) { var content = new GUIContent( - LocaleManager.Instance.GetTranslation("increment"), - LocaleManager.Instance.GetTranslation("theValueToAddToTheCount")); + LocalizationManager.Instance.GetTranslation("increment"), + LocalizationManager.Instance.GetTranslation("theValueToAddToTheCount")); GUI.SetNextControlName(GUIControlNameUtility.CreatePrefixedName(controlPrefix, content.text)); return EditorGUI.IntField(rect, content, originalIncrement); } @@ -257,8 +257,8 @@ private int DrawIncrementField(Rect rect, int controlPrefix, int originalIncreme private bool DrawPrependField(Rect rect, int controlPrefix, bool originalPrepend) { var content = new GUIContent( - LocaleManager.Instance.GetTranslation("addAsPrefix"), - LocaleManager.Instance.GetTranslation("addTheCountToTheFront")); + LocalizationManager.Instance.GetTranslation("addAsPrefix"), + LocalizationManager.Instance.GetTranslation("addTheCountToTheFront")); GUI.SetNextControlName(GUIControlNameUtility.CreatePrefixedName(controlPrefix, content.text)); return EditorGUI.Toggle(rect, content, originalPrepend); } @@ -267,21 +267,21 @@ private void Initialize() { var uppercasePreset = new CountByLetterPresetGUI() { - DisplayName = LocaleManager.Instance.GetTranslation("uppercaseAlphabet"), + DisplayName = LocalizationManager.Instance.GetTranslation("uppercaseAlphabet"), SequenceToDisplay = "A, B, C...", Preset = CountByLetterOperation.StringPreset.UppercaseAlphabet, }; var lowercasePreset = new CountByLetterPresetGUI() { - DisplayName = LocaleManager.Instance.GetTranslation("lowercaseAlphabet"), + DisplayName = LocalizationManager.Instance.GetTranslation("lowercaseAlphabet"), SequenceToDisplay = "a, b, c...", Preset = CountByLetterOperation.StringPreset.LowercaseAlphabet, }; var customPreset = new CountByLetterPresetGUI() { - DisplayName = LocaleManager.Instance.GetTranslation("custom"), + DisplayName = LocalizationManager.Instance.GetTranslation("custom"), CountSequence = new string[0], SequenceToDisplay = string.Empty, Preset = CountByLetterOperation.StringPreset.Custom, diff --git a/Assets/RedBlueGames/MulliganRenamer/Editor/OperationDrawers/EnumerateOperationDrawer.cs b/Assets/RedBlueGames/MulliganRenamer/Editor/OperationDrawers/EnumerateOperationDrawer.cs index a6bd7d3..144d901 100644 --- a/Assets/RedBlueGames/MulliganRenamer/Editor/OperationDrawers/EnumerateOperationDrawer.cs +++ b/Assets/RedBlueGames/MulliganRenamer/Editor/OperationDrawers/EnumerateOperationDrawer.cs @@ -54,7 +54,7 @@ public override string HeadingLabel { get { - return LocaleManager.Instance.GetTranslation("count"); + return LocalizationManager.Instance.GetTranslation("count"); } } @@ -78,7 +78,7 @@ public override string ControlToFocus { get { - return LocaleManager.Instance.GetTranslation("format"); + return LocalizationManager.Instance.GetTranslation("format"); } } @@ -138,8 +138,8 @@ private float GetHeightForHelpBox() protected override void DrawContents(Rect operationRect, int controlPrefix) { var presetsContent = new GUIContent( - LocaleManager.Instance.GetTranslation("format"), - LocaleManager.Instance.GetTranslation("selectPresetFormat")); + LocalizationManager.Instance.GetTranslation("format"), + LocalizationManager.Instance.GetTranslation("selectPresetFormat")); var names = new List(this.GUIPresets.Count); foreach (var preset in this.GUIPresets) { @@ -170,8 +170,8 @@ protected override void DrawContents(Rect operationRect, int controlPrefix) EditorGUI.BeginDisabledGroup(selectedPreset.ReadOnly); var countFormatContent = new GUIContent( - LocaleManager.Instance.GetTranslation("countFormat"), - LocaleManager.Instance.GetTranslation("theStringFormatToUseWhenAddingTheCountToName")); + LocalizationManager.Instance.GetTranslation("countFormat"), + LocalizationManager.Instance.GetTranslation("theStringFormatToUseWhenAddingTheCountToName")); GUI.SetNextControlName(GUIControlNameUtility.CreatePrefixedName(controlPrefix, countFormatContent.text)); if (selectedPreset.ReadOnly) { @@ -207,15 +207,15 @@ protected override void DrawContents(Rect operationRect, int controlPrefix) return; } - var helpBoxMessage = LocaleManager.Instance.GetTranslation("invalidCountFormat"); + var helpBoxMessage = LocalizationManager.Instance.GetTranslation("invalidCountFormat"); var helpRect = operationRect.GetSplitVerticalWeighted(++currentLine, LineSpacing, weights); helpRect = helpRect.AddPadding(4, 4, 4, 4); EditorGUI.HelpBox(helpRect, helpBoxMessage, MessageType.Warning); } var countFromContent = new GUIContent( - LocaleManager.Instance.GetTranslation("countFrom"), - LocaleManager.Instance.GetTranslation("theValueToStartCountingFrom")); + LocalizationManager.Instance.GetTranslation("countFrom"), + LocalizationManager.Instance.GetTranslation("theValueToStartCountingFrom")); GUI.SetNextControlName(GUIControlNameUtility.CreatePrefixedName(controlPrefix, countFromContent.text)); this.RenameOperation.StartingCount = EditorGUI.IntField( operationRect.GetSplitVerticalWeighted(++currentLine, LineSpacing, weights), @@ -223,8 +223,8 @@ protected override void DrawContents(Rect operationRect, int controlPrefix) this.RenameOperation.StartingCount); var incrementContent = new GUIContent( - LocaleManager.Instance.GetTranslation("increment"), - LocaleManager.Instance.GetTranslation("theValueToAddToEachObjectWhenCounting")); + LocalizationManager.Instance.GetTranslation("increment"), + LocalizationManager.Instance.GetTranslation("theValueToAddToEachObjectWhenCounting")); GUI.SetNextControlName(GUIControlNameUtility.CreatePrefixedName(controlPrefix, incrementContent.text)); this.RenameOperation.Increment = EditorGUI.IntField( operationRect.GetSplitVerticalWeighted(++currentLine, LineSpacing, weights), @@ -232,8 +232,8 @@ protected override void DrawContents(Rect operationRect, int controlPrefix) this.RenameOperation.Increment); var prependContent = new GUIContent( - LocaleManager.Instance.GetTranslation("addAsPrefix"), - LocaleManager.Instance.GetTranslation("addTheCountToTheFontOfTheObjectName")); + LocalizationManager.Instance.GetTranslation("addAsPrefix"), + LocalizationManager.Instance.GetTranslation("addTheCountToTheFontOfTheObjectName")); GUI.SetNextControlName(GUIControlNameUtility.CreatePrefixedName(controlPrefix, prependContent.text)); this.RenameOperation.Prepend = EditorGUI.Toggle( operationRect.GetSplitVerticalWeighted(++currentLine, LineSpacing, weights), @@ -266,7 +266,7 @@ private void Initialize() var customPreset = new EnumeratePresetGUI() { - DisplayName = LocaleManager.Instance.GetTranslation("custom"), + DisplayName = LocalizationManager.Instance.GetTranslation("custom"), Preset = EnumerateOperation.CountFormatPreset.Custom, ReadOnly = false }; diff --git a/Assets/RedBlueGames/MulliganRenamer/Editor/OperationDrawers/RemoveCharactersOperationDrawer.cs b/Assets/RedBlueGames/MulliganRenamer/Editor/OperationDrawers/RemoveCharactersOperationDrawer.cs index 816065e..1e95c83 100644 --- a/Assets/RedBlueGames/MulliganRenamer/Editor/OperationDrawers/RemoveCharactersOperationDrawer.cs +++ b/Assets/RedBlueGames/MulliganRenamer/Editor/OperationDrawers/RemoveCharactersOperationDrawer.cs @@ -54,7 +54,7 @@ public override string HeadingLabel { get { - return LocaleManager.Instance.GetTranslation("removeCharacters"); + return LocalizationManager.Instance.GetTranslation("removeCharacters"); } } @@ -78,7 +78,7 @@ public override string ControlToFocus { get { - return LocaleManager.Instance.GetTranslation("preset"); + return LocalizationManager.Instance.GetTranslation("preset"); } } @@ -153,8 +153,8 @@ protected override void DrawContents(Rect operationRect, int controlPrefix) } var presetsContent = new GUIContent( - LocaleManager.Instance.GetTranslation("preset"), - LocaleManager.Instance.GetTranslation("selectPresetOrSpecifyCharacters")); + LocalizationManager.Instance.GetTranslation("preset"), + LocalizationManager.Instance.GetTranslation("selectPresetOrSpecifyCharacters")); var names = new List(this.GUIPresets.Count); foreach (var preset in this.GUIPresets) { @@ -203,8 +203,8 @@ protected override void DrawContents(Rect operationRect, int controlPrefix) else { var charactersFieldContent = new GUIContent( - LocaleManager.Instance.GetTranslation("charactersToRemove"), - LocaleManager.Instance.GetTranslation("allCharactersThatWillBeRemoved")); + LocalizationManager.Instance.GetTranslation("charactersToRemove"), + LocalizationManager.Instance.GetTranslation("allCharactersThatWillBeRemoved")); GUI.SetNextControlName(GUIControlNameUtility.CreatePrefixedName(controlPrefix, charactersFieldContent.text)); workingOptions.CharactersToRemove = EditorGUI.TextField( operationRect.GetSplitVertical(++currentSplit, numSplits, LineSpacing), @@ -212,8 +212,8 @@ protected override void DrawContents(Rect operationRect, int controlPrefix) this.RenameOperation.CharactersToRemove); var caseSensitiveToggleContent = new GUIContent( - LocaleManager.Instance.GetTranslation("caseSensitive"), - LocaleManager.Instance.GetTranslation("flagTheSearchToMatchCase")); + LocalizationManager.Instance.GetTranslation("caseSensitive"), + LocalizationManager.Instance.GetTranslation("flagTheSearchToMatchCase")); workingOptions.IsCaseSensitive = EditorGUI.Toggle( operationRect.GetSplitVertical(++currentSplit, numSplits, LineSpacing), caseSensitiveToggleContent, @@ -234,31 +234,31 @@ private void Initialize() { var symbolsPreset = new CharacterPresetGUI() { - DisplayName = LocaleManager.Instance.GetTranslation("symbols"), - ReadOnlyLabel = LocaleManager.Instance.GetTranslation("removeSpecialCharacters"), + DisplayName = LocalizationManager.Instance.GetTranslation("symbols"), + ReadOnlyLabel = LocalizationManager.Instance.GetTranslation("removeSpecialCharacters"), PresetID = RemoveCharactersOperation.PresetID.Symbols, IsReadOnly = true }; var numbersPreset = new CharacterPresetGUI() { - DisplayName = LocaleManager.Instance.GetTranslation("numbers"), - ReadOnlyLabel = LocaleManager.Instance.GetTranslation("removeDigits"), + DisplayName = LocalizationManager.Instance.GetTranslation("numbers"), + ReadOnlyLabel = LocalizationManager.Instance.GetTranslation("removeDigits"), PresetID = RemoveCharactersOperation.PresetID.Numbers, IsReadOnly = true }; var whitespacePreset = new CharacterPresetGUI() { - DisplayName = LocaleManager.Instance.GetTranslation("whitespace"), - ReadOnlyLabel = LocaleManager.Instance.GetTranslation("removesWhitespace"), + DisplayName = LocalizationManager.Instance.GetTranslation("whitespace"), + ReadOnlyLabel = LocalizationManager.Instance.GetTranslation("removesWhitespace"), PresetID = RemoveCharactersOperation.PresetID.Whitespace, IsReadOnly = true }; var customPreset = new CharacterPresetGUI() { - DisplayName = LocaleManager.Instance.GetTranslation("custom"), + DisplayName = LocalizationManager.Instance.GetTranslation("custom"), PresetID = RemoveCharactersOperation.PresetID.Custom, IsReadOnly = false, ReadOnlyLabel = string.Empty diff --git a/Assets/RedBlueGames/MulliganRenamer/Editor/OperationDrawers/RenameOperationDrawer.cs b/Assets/RedBlueGames/MulliganRenamer/Editor/OperationDrawers/RenameOperationDrawer.cs index cf14a92..3e2b319 100644 --- a/Assets/RedBlueGames/MulliganRenamer/Editor/OperationDrawers/RenameOperationDrawer.cs +++ b/Assets/RedBlueGames/MulliganRenamer/Editor/OperationDrawers/RenameOperationDrawer.cs @@ -202,7 +202,7 @@ protected RenameOperationSortingButtonEvent DrawHeaderAndReorderButtons(Rect con /// The name of the operation protected string GetOperationPath(string folder, string name) { - return LocaleManager.Instance.GetTranslation(folder) + "/" + LocaleManager.Instance.GetTranslation(name); + return LocalizationManager.Instance.GetTranslation(folder) + "/" + LocalizationManager.Instance.GetTranslation(name); } private RenameOperationSortingButtonEvent DrawReorderingButtons(Rect containingRect, bool disableUpButton, bool disableDownButton) diff --git a/Assets/RedBlueGames/MulliganRenamer/Editor/OperationDrawers/ReplaceNameOperationDrawer.cs b/Assets/RedBlueGames/MulliganRenamer/Editor/OperationDrawers/ReplaceNameOperationDrawer.cs index 9df10ec..5582ede 100644 --- a/Assets/RedBlueGames/MulliganRenamer/Editor/OperationDrawers/ReplaceNameOperationDrawer.cs +++ b/Assets/RedBlueGames/MulliganRenamer/Editor/OperationDrawers/ReplaceNameOperationDrawer.cs @@ -48,7 +48,7 @@ public override string HeadingLabel { get { - return LocaleManager.Instance.GetTranslation("rename"); + return LocalizationManager.Instance.GetTranslation("rename"); } } @@ -72,7 +72,7 @@ public override string ControlToFocus { get { - return LocaleManager.Instance.GetTranslation("newName"); + return LocalizationManager.Instance.GetTranslation("newName"); } } @@ -96,8 +96,8 @@ protected override void DrawContents(Rect operationRect, int controlPrefix) var singleLineRect = operationRect.GetSplitVertical(1, 1, LineSpacing); GUIContent newNameContent = new GUIContent( - LocaleManager.Instance.GetTranslation("newName"), - LocaleManager.Instance.GetTranslation("nameToReplaceTheOldeOne")); + LocalizationManager.Instance.GetTranslation("newName"), + LocalizationManager.Instance.GetTranslation("nameToReplaceTheOldeOne")); GUI.SetNextControlName(GUIControlNameUtility.CreatePrefixedName(controlPrefix, newNameContent.text)); this.RenameOperation.NewName = EditorGUI.TextField(singleLineRect, newNameContent, this.RenameOperation.NewName); } diff --git a/Assets/RedBlueGames/MulliganRenamer/Editor/OperationDrawers/ReplaceStringOperationDrawer.cs b/Assets/RedBlueGames/MulliganRenamer/Editor/OperationDrawers/ReplaceStringOperationDrawer.cs index ed331b4..eebe9c0 100644 --- a/Assets/RedBlueGames/MulliganRenamer/Editor/OperationDrawers/ReplaceStringOperationDrawer.cs +++ b/Assets/RedBlueGames/MulliganRenamer/Editor/OperationDrawers/ReplaceStringOperationDrawer.cs @@ -49,7 +49,7 @@ public override string HeadingLabel { get { - return LocaleManager.Instance.GetTranslation("replaceString"); + return LocalizationManager.Instance.GetTranslation("replaceString"); } } @@ -73,7 +73,7 @@ public override string ControlToFocus { get { - return LocaleManager.Instance.GetTranslation("searchString"); + return LocalizationManager.Instance.GetTranslation("searchString"); } } @@ -133,8 +133,8 @@ protected override void DrawContents(Rect operationRect, int controlPrefix) int currentGUIElement = 0; var regexToggleContent = new GUIContent( - LocaleManager.Instance.GetTranslation("useRegex"), - LocaleManager.Instance.GetTranslation("matchTermsUsingRegex")); + LocalizationManager.Instance.GetTranslation("useRegex"), + LocalizationManager.Instance.GetTranslation("matchTermsUsingRegex")); GUI.SetNextControlName(GUIControlNameUtility.CreatePrefixedName(controlPrefix, regexToggleContent.text)); postGUIModel.UseRegex = EditorGUI.Toggle( operationRect.GetSplitVerticalWeighted(++currentGUIElement, LineSpacing, weightsArray), @@ -146,35 +146,35 @@ protected override void DrawContents(Rect operationRect, int controlPrefix) if (preGUIModel.UseRegex) { searchContent = new GUIContent( - LocaleManager.Instance.GetTranslation("matchRegex"), - LocaleManager.Instance.GetTranslation("regexToUseToMatchTerms")); + LocalizationManager.Instance.GetTranslation("matchRegex"), + LocalizationManager.Instance.GetTranslation("regexToUseToMatchTerms")); replacementContent = new GUIContent("Replacement Regex", "Regular Expression to use when replacing matched patterns."); } else { searchContent = new GUIContent( - LocaleManager.Instance.GetTranslation("searchForString"), - LocaleManager.Instance.GetTranslation("substringsToSeatchInFilenames")); + LocalizationManager.Instance.GetTranslation("searchForString"), + LocalizationManager.Instance.GetTranslation("substringsToSeatchInFilenames")); replacementContent = new GUIContent( - LocaleManager.Instance.GetTranslation("replaceWith"), - LocaleManager.Instance.GetTranslation("stringToReplaceMatchingInstances")); + LocalizationManager.Instance.GetTranslation("replaceWith"), + LocalizationManager.Instance.GetTranslation("stringToReplaceMatchingInstances")); } - GUI.SetNextControlName(GUIControlNameUtility.CreatePrefixedName(controlPrefix, LocaleManager.Instance.GetTranslation("searchString"))); + GUI.SetNextControlName(GUIControlNameUtility.CreatePrefixedName(controlPrefix, LocalizationManager.Instance.GetTranslation("searchString"))); postGUIModel.SearchString = EditorGUI.TextField( operationRect.GetSplitVerticalWeighted(++currentGUIElement, LineSpacing, weightsArray), searchContent, preGUIModel.SearchString); - GUI.SetNextControlName(GUIControlNameUtility.CreatePrefixedName(controlPrefix, LocaleManager.Instance.GetTranslation("replacementString"))); + GUI.SetNextControlName(GUIControlNameUtility.CreatePrefixedName(controlPrefix, LocalizationManager.Instance.GetTranslation("replacementString"))); postGUIModel.ReplacementString = EditorGUI.TextField( operationRect.GetSplitVerticalWeighted(++currentGUIElement, LineSpacing, weightsArray), replacementContent, preGUIModel.ReplacementString); var caseSensitiveContent = new GUIContent( - LocaleManager.Instance.GetTranslation("caseSensitive"), - LocaleManager.Instance.GetTranslation("searchUsingCaseSensitivity")); + LocalizationManager.Instance.GetTranslation("caseSensitive"), + LocalizationManager.Instance.GetTranslation("searchUsingCaseSensitivity")); GUI.SetNextControlName(GUIControlNameUtility.CreatePrefixedName(controlPrefix, caseSensitiveContent.text)); postGUIModel.SearchIsCaseSensitive = EditorGUI.Toggle( operationRect.GetSplitVerticalWeighted(++currentGUIElement, LineSpacing, weightsArray), @@ -188,14 +188,14 @@ protected override void DrawContents(Rect operationRect, int controlPrefix) { var helpRect = operationRect.GetSplitVerticalWeighted(++currentGUIElement, LineSpacing, weightsArray); helpRect = helpRect.AddPadding(4, 4, 4, 4); - EditorGUI.HelpBox(helpRect, LocaleManager.Instance.GetTranslation("matchExpressNotValid"), MessageType.Error); + EditorGUI.HelpBox(helpRect, LocalizationManager.Instance.GetTranslation("matchExpressNotValid"), MessageType.Error); } if (!preGUIModel.ReplacementStringIsValidRegex) { var helpRect = operationRect.GetSplitVerticalWeighted(++currentGUIElement, LineSpacing, weightsArray); helpRect = helpRect.AddPadding(4, 4, 4, 4); - EditorGUI.HelpBox(helpRect, LocaleManager.Instance.GetTranslation("replacementExpressionNotValid"), MessageType.Error); + EditorGUI.HelpBox(helpRect, LocalizationManager.Instance.GetTranslation("replacementExpressionNotValid"), MessageType.Error); } } diff --git a/Assets/RedBlueGames/MulliganRenamer/Editor/OperationDrawers/ToCamelCaseOperationDrawer.cs b/Assets/RedBlueGames/MulliganRenamer/Editor/OperationDrawers/ToCamelCaseOperationDrawer.cs index b54efc8..f129e29 100644 --- a/Assets/RedBlueGames/MulliganRenamer/Editor/OperationDrawers/ToCamelCaseOperationDrawer.cs +++ b/Assets/RedBlueGames/MulliganRenamer/Editor/OperationDrawers/ToCamelCaseOperationDrawer.cs @@ -48,7 +48,7 @@ public override string HeadingLabel { get { - return LocaleManager.Instance.GetTranslation("toCamelCase"); + return LocalizationManager.Instance.GetTranslation("toCamelCase"); } } @@ -95,8 +95,8 @@ protected override void DrawContents(Rect operationRect, int controlPrefix) var singleLineRect = operationRect.GetSplitVertical(1, 2, LineSpacing); var pascalLabel = new GUIContent( - LocaleManager.Instance.GetTranslation("usePascalCasing"), - LocaleManager.Instance.GetTranslation("flagToCapitalizeTheFirstLetterOfname")); + LocalizationManager.Instance.GetTranslation("usePascalCasing"), + LocalizationManager.Instance.GetTranslation("flagToCapitalizeTheFirstLetterOfname")); GUI.SetNextControlName(GUIControlNameUtility.CreatePrefixedName(controlPrefix, "Pascal")); this.RenameOperation.UsePascal = EditorGUI.Toggle( singleLineRect, @@ -106,9 +106,9 @@ protected override void DrawContents(Rect operationRect, int controlPrefix) var delimitersRect = operationRect.GetSplitVertical(2, 2, LineSpacing); var delimitersLabel = new GUIContent( - LocaleManager.Instance.GetTranslation("delimiterCharacters"), - LocaleManager.Instance.GetTranslation("caseSensitiveCharactersIndicateStart")); - GUI.SetNextControlName(GUIControlNameUtility.CreatePrefixedName(controlPrefix, LocaleManager.Instance.GetTranslation("delimiters"))); + LocalizationManager.Instance.GetTranslation("delimiterCharacters"), + LocalizationManager.Instance.GetTranslation("caseSensitiveCharactersIndicateStart")); + GUI.SetNextControlName(GUIControlNameUtility.CreatePrefixedName(controlPrefix, LocalizationManager.Instance.GetTranslation("delimiters"))); this.RenameOperation.DelimiterCharacters = EditorGUI.TextField( delimitersRect, delimitersLabel, diff --git a/Assets/RedBlueGames/MulliganRenamer/Editor/OperationDrawers/TrimCharactersOperationDrawer.cs b/Assets/RedBlueGames/MulliganRenamer/Editor/OperationDrawers/TrimCharactersOperationDrawer.cs index a8e949d..83cd4cc 100644 --- a/Assets/RedBlueGames/MulliganRenamer/Editor/OperationDrawers/TrimCharactersOperationDrawer.cs +++ b/Assets/RedBlueGames/MulliganRenamer/Editor/OperationDrawers/TrimCharactersOperationDrawer.cs @@ -48,7 +48,7 @@ public override string HeadingLabel { get { - return LocaleManager.Instance.GetTranslation("trimCharacters"); + return LocalizationManager.Instance.GetTranslation("trimCharacters"); } } @@ -72,7 +72,7 @@ public override string ControlToFocus { get { - return LocaleManager.Instance.GetTranslation("deleteFromFront"); + return LocalizationManager.Instance.GetTranslation("deleteFromFront"); } } @@ -92,17 +92,17 @@ protected override float GetPreferredHeightForContents() /// The prefix of the control to assign to the control names protected override void DrawContents(Rect operationRect, int controlPrefix) { - GUI.SetNextControlName(GUIControlNameUtility.CreatePrefixedName(controlPrefix, LocaleManager.Instance.GetTranslation("deleteFromFront"))); + GUI.SetNextControlName(GUIControlNameUtility.CreatePrefixedName(controlPrefix, LocalizationManager.Instance.GetTranslation("deleteFromFront"))); this.RenameOperation.NumFrontDeleteChars = EditorGUI.IntField( operationRect.GetSplitVertical(1, 2, LineSpacing), - LocaleManager.Instance.GetTranslation("deleteFromFront"), + LocalizationManager.Instance.GetTranslation("deleteFromFront"), this.RenameOperation.NumFrontDeleteChars); this.RenameOperation.NumFrontDeleteChars = Mathf.Max(0, this.RenameOperation.NumFrontDeleteChars); - GUI.SetNextControlName(GUIControlNameUtility.CreatePrefixedName(controlPrefix, LocaleManager.Instance.GetTranslation("deleteFromBack"))); + GUI.SetNextControlName(GUIControlNameUtility.CreatePrefixedName(controlPrefix, LocalizationManager.Instance.GetTranslation("deleteFromBack"))); this.RenameOperation.NumBackDeleteChars = EditorGUI.IntField( operationRect.GetSplitVertical(2, 2, LineSpacing), - LocaleManager.Instance.GetTranslation("deleteFromBack"), + LocalizationManager.Instance.GetTranslation("deleteFromBack"), this.RenameOperation.NumBackDeleteChars); this.RenameOperation.NumBackDeleteChars = Mathf.Max(0, this.RenameOperation.NumBackDeleteChars); } diff --git a/Assets/RedBlueGames/MulliganRenamer/Editor/PreferencesAndSettings/MulliganSettingsProvider.cs b/Assets/RedBlueGames/MulliganRenamer/Editor/PreferencesAndSettings/MulliganSettingsProvider.cs index 1df8de3..85006b8 100644 --- a/Assets/RedBlueGames/MulliganRenamer/Editor/PreferencesAndSettings/MulliganSettingsProvider.cs +++ b/Assets/RedBlueGames/MulliganRenamer/Editor/PreferencesAndSettings/MulliganSettingsProvider.cs @@ -44,6 +44,8 @@ public static string Path private static MulliganUserPreferences ActivePreferences; + private static LanguageRetriever LanguageRetriever; + [SettingsProvider] public static SettingsProvider CreateMyCustomSettingsProvider() { @@ -52,10 +54,11 @@ public static SettingsProvider CreateMyCustomSettingsProvider() var provider = new SettingsProvider(Path, SettingsScope.User) { // By default the last token of the path is used as display name if no label is provided. - label = LocaleManager.Instance.GetTranslation("preferencesMenuItem"), + label = LocalizationManager.Instance.GetTranslation("preferencesMenuItem"), activateHandler = (searchContext, rootElement) => { ActivePreferences = MulliganUserPreferences.LoadOrCreatePreferences(); + LanguageRetriever = new LanguageRetriever(); }, // Create the SettingsProvider and initialize its drawing (IMGUI) function in place: @@ -70,7 +73,8 @@ public static SettingsProvider CreateMyCustomSettingsProvider() private static void DrawPreferences(string searchContext) { - MulliganUserPreferencesWindow.DrawPreferences(ActivePreferences); + // Pass in state into the Window since window doesn't have any when opened as a Preference item + MulliganUserPreferencesWindow.DrawPreferences(ActivePreferences, LanguageRetriever); } #endif } diff --git a/Assets/RedBlueGames/MulliganRenamer/Editor/Renaming/BulkRenamer.cs b/Assets/RedBlueGames/MulliganRenamer/Editor/Renaming/BulkRenamer.cs index 11dbcb0..90df1f7 100644 --- a/Assets/RedBlueGames/MulliganRenamer/Editor/Renaming/BulkRenamer.cs +++ b/Assets/RedBlueGames/MulliganRenamer/Editor/Renaming/BulkRenamer.cs @@ -84,9 +84,9 @@ public static int ApplyNameDeltas(List objectsAndNewNames, bool gameObjectsToRenameAsGameObjects.Add((GameObject)gameObjectToRename.NamedObject); } - Undo.RecordObjects(gameObjectsToRenameAsGameObjects.ToArray(), LocaleManager.Instance.GetTranslation("bulkRename")); + Undo.RecordObjects(gameObjectsToRenameAsGameObjects.ToArray(), LocalizationManager.Instance.GetTranslation("bulkRename")); - AssetRenameUndoer.RecordAssetRenames(LocaleManager.Instance.GetTranslation("bulkRename"), objectsAndNewNames); + AssetRenameUndoer.RecordAssetRenames(LocalizationManager.Instance.GetTranslation("bulkRename"), objectsAndNewNames); } // Rename the objects and show a progress bar @@ -268,8 +268,8 @@ private static bool RenamedAssetWillShareNameWithAnotherAsset( private static void UpdateProgressBar(int currentStep, int totalNumSteps) { - var infoString = string.Format(LocaleManager.Instance.GetTranslation("renamingObjectXofY"), currentStep++, totalNumSteps); - EditorUtility.DisplayProgressBar(LocaleManager.Instance.GetTranslation("renaming")+ "...", infoString, currentStep / (float)totalNumSteps); + var infoString = string.Format(LocalizationManager.Instance.GetTranslation("renamingObjectXofY"), currentStep++, totalNumSteps); + EditorUtility.DisplayProgressBar(LocalizationManager.Instance.GetTranslation("renaming")+ "...", infoString, currentStep / (float)totalNumSteps); } private static void SplitObjectsIntoCategories( @@ -331,7 +331,7 @@ private static void RenameAsset(UnityEngine.Object asset, string newName) if (asset.name != newName) { var message = string.Format( - LocaleManager.Instance.GetTranslation("errorAssetNotBulkRenamed"), + LocalizationManager.Instance.GetTranslation("errorAssetNotBulkRenamed"), asset.name, pathToAsset, newName); diff --git a/Assets/RedBlueGames/MulliganRenamer/Editor/Renaming/RenameOperationSequence.cs b/Assets/RedBlueGames/MulliganRenamer/Editor/Renaming/RenameOperationSequence.cs index 515b69f..9eb25e9 100644 --- a/Assets/RedBlueGames/MulliganRenamer/Editor/Renaming/RenameOperationSequence.cs +++ b/Assets/RedBlueGames/MulliganRenamer/Editor/Renaming/RenameOperationSequence.cs @@ -64,7 +64,7 @@ private static void Initialize() private static string GetOperationPath(string folder, string operationTitle) { - return LocaleManager.Instance.GetTranslation(folder) + "/" + LocaleManager.Instance.GetTranslation(operationTitle); + return LocalizationManager.Instance.GetTranslation(folder) + "/" + LocalizationManager.Instance.GetTranslation(operationTitle); } private List operationSequence; diff --git a/Assets/RedBlueGames/MulliganRenamer/Editor/Renaming/RenameResultSequence.cs b/Assets/RedBlueGames/MulliganRenamer/Editor/Renaming/RenameResultSequence.cs index 40503ac..6d0e571 100644 --- a/Assets/RedBlueGames/MulliganRenamer/Editor/Renaming/RenameResultSequence.cs +++ b/Assets/RedBlueGames/MulliganRenamer/Editor/Renaming/RenameResultSequence.cs @@ -89,7 +89,7 @@ public RenameResult GetRenameResultBeforeStep(int stepIndex) if (stepIndex < 0 || stepIndex >= this.NumSteps) { var exception = string.Format( - LocaleManager.Instance.GetTranslation("errorTryintToGetOriginalName"), + LocalizationManager.Instance.GetTranslation("errorTryintToGetOriginalName"), stepIndex); throw new System.ArgumentException(exception, "stepIndex"); } @@ -107,7 +107,7 @@ public RenameResult GetRenameResultForStep(int stepIndex) if (stepIndex < 0 || stepIndex >= this.NumSteps) { var exception = string.Format( - LocaleManager.Instance.GetTranslation("errorTryingToGetOriginalNameOutOfBounds"), + LocalizationManager.Instance.GetTranslation("errorTryingToGetOriginalNameOutOfBounds"), stepIndex); throw new System.ArgumentException(exception, "stepIndex"); } diff --git a/Assets/RedBlueGames/MulliganRenamer/Editor/Renaming/SpritesheetRenamer.cs b/Assets/RedBlueGames/MulliganRenamer/Editor/Renaming/SpritesheetRenamer.cs index b4acc57..26bdf63 100644 --- a/Assets/RedBlueGames/MulliganRenamer/Editor/Renaming/SpritesheetRenamer.cs +++ b/Assets/RedBlueGames/MulliganRenamer/Editor/Renaming/SpritesheetRenamer.cs @@ -62,7 +62,7 @@ public void AddSpriteForRename(Sprite sprite, string newName) if (!string.IsNullOrEmpty(existingPathToTexture) && pathToSprite != existingPathToTexture) { var exception = string.Format( - LocaleManager.Instance.GetTranslation("tryingToAddSpriteToRenamer"), + LocalizationManager.Instance.GetTranslation("tryingToAddSpriteToRenamer"), sprite.name, pathToSprite, existingPathToTexture); @@ -73,7 +73,7 @@ public void AddSpriteForRename(Sprite sprite, string newName) if (!System.IO.File.Exists(pathToMeta)) { var exception = string.Format( - LocaleManager.Instance.GetTranslation("errorTryingToAddSpriteToRenamer"), + LocalizationManager.Instance.GetTranslation("errorTryingToAddSpriteToRenamer"), pathToMeta); throw new System.ArgumentException(exception); } diff --git a/Assets/RedBlueGames/MulliganRenamer/Editor/Resources/MulliganLanguages/en.json b/Assets/RedBlueGames/MulliganRenamer/Editor/Resources/MulliganLanguages/en.json index f608f92..ac62698 100644 --- a/Assets/RedBlueGames/MulliganRenamer/Editor/Resources/MulliganLanguages/en.json +++ b/Assets/RedBlueGames/MulliganRenamer/Editor/Resources/MulliganLanguages/en.json @@ -1,627 +1,683 @@ { - "languageName" : "English", - "languageKey" : "en", - "elements" : - [ - { - "key" : "rename", - "value" : "Rename" - }, - { - "key" : "renameWarningNotRenamed", - "value" : "Some objects have warnings and will not be renamed. Do you want to rename the other objects in the group?" - }, - { - "key" : "warning", - "value" : "Warning" - }, - { - "key" : "cancel", - "value" : "Cancel" - }, - { - "key" : "failToRenameMulligan", - "value" : "Sorry, some objects failed to rename. Something went wrong with Mulligan. Please report a bug (see UserManual for details). This rename operation will be automatically undone\n\nException: " - }, - { - "key" : "error", - "value" : "Error" - }, - { - "key" : "presets", - "value" : "Presets" - }, - { - "key" : "result", - "value" : "Result" - }, - { - "key" : "addOperation", - "value" : "Add Operation" - }, - { - "key" : "renameOperation", - "value" : "Rename Operation" - }, - { - "key" : "language", - "value" : "Language" - }, - { - "key" : "languageTooltip", - "value" : "Specifies the language for all text used in Mulligan." - }, - { - "key" : "prefix", - "value" : "Prefix" - }, - { - "key" : "saveAs", - "value" : "Save As..." - }, - { - "key" : "managePresets", - "value" : "Manage Presets" - }, - { - "key" : "errorUnrecognizedListButton", - "value" : "RenamerWindow found Unrecognized ListButtonEvent [{0}] in OnGUI. Add a case to handle this event." - }, - { - "key" : "errorAddNewOpNotSub", - "value" : "MulliganRenamerWindow tried to add a new RenameOperation using a type that is not a subclass of RenameOperationDrawerBinding. Operation type: " - }, - { - "key" : "thankYouForSupport", - "value" : "Thank you very much for supporting Mulligan!" - }, - { - "key" : "thankYouForReview", - "value" : "Thank you for reviewing Mulligan!" - }, - { - "key" : "thankYouForUsing", - "value" : "Thank you for using Mulligan! If you've found it useful, please consider supporting its development by purchasing it from the Asset Store. Thanks!" - }, - { - "key" : "thankYouForPurchasing", - "value" : "Thank you for purchasing Mulligan! If you've found it useful, please consider leaving a review on the Asset Store. The store is very competitive and every review helps to stand out. Thanks!" - }, - { - "key" : "openAssetStore", - "value" : "Open Asset Store" - }, - { - "key" : "savePreset", - "value" : "Save Preset" - }, - { - "key" : "previewSteps", - "value" : "Preview Steps" - }, - { - "key" : "noObjectsSpecified", - "value" : "No objects specified for rename. Drag objects here to rename them, or" - }, - { - "key" : "addMoreObjectsDragPanel", - "value" : "Add more objects by dragging them into the above panel" - }, - { - "key" : "addMoreObjectsDragHere", - "value" : "Add more objects by dragging them here" - }, - { - "key" : "toRenameMoreObjects", - "value" : "To rename more objects, drag them here, or" - }, - { - "key" : "removeAll", - "value" : "Remove All" - }, - { - "key" : "object", - "value" : "Object" - }, - { - "key" : "objects", - "value" : "Objects" - }, - { - "key" : "renamed", - "value" : "Renamed" - }, - { - "key" : "original", - "value" : "Original" - }, - { - "key" : "before", - "value" : "Before" - }, - { - "key" : "after", - "value" : "After" - }, - { - "key" : "finalName", - "value" : "Final Name" - }, - { - "key" : "addSelectedObjects", - "value" : "Add Selected Objects" - }, - { - "key" : "errorTryingToAccessModel", - "value" : "Trying to access PreviewRowModel at index that is out of bounds. Index: " - }, - { - "key" : "warningNewNameMatchesExisting", - "value" : "New name matches an existing file or another renamed object." - }, - { - "key" : "assetBlankName", - "value" : "Asset has blank name." - }, - { - "key" : "nameIncludeInvalidCharacter", - "value" : "Name includes invalid characters (usually symbols such as ?.,)." - }, - { - "key" : "tryingToAddSpriteToRenamer", - "value" : "Trying to add Sprite {0} to SpriteRenamer that has a different path to texture than the other sprites. Received path {1}, expected {2}" - }, - { - "key" : "errorTryingToAddSpriteToRenamer", - "value" : "Trying to add Sprite to SpriteRenamer at path {0}, but no meta file exists at the specified path." - }, - { - "key" : "errorPresetNameAlreadyExists", - "value" : "A preset named \"{0}\" already exists. Do you want to replace it?" - }, - { - "key" : "no", - "value" : "No" - }, - { - "key" : "save", - "value" : "Save" - }, - { - "key" : "errorTryintToGetOriginalName", - "value" : "Trying to get original name for RenameResultSequence at index that's out of bounds. Index: {0}" - }, - { - "key" : "errorTryingToGetOriginalNameOutOfBounds", - "value" : "Trying to get original name for RenameResultSequence at index that's out of bounds. Index: {0}" - }, - { - "key" : "add", - "value" : "Add" - }, - { - "key" : "prefixOrSuffix", - "value" : "Prefix or Suffix" - }, - { - "key" : "stringSequence", - "value" : "String Sequence" - }, - { - "key" : "modify", - "value" : "Modify" - }, - { - "key" : "changeCase", - "value" : "Change Case" - }, - { - "key" : "countByLetter", - "value" : "Count By Letter" - }, - { - "key" : "enumerate", - "value" : "Enumerate" - }, - { - "key" : "delete", - "value" : "Delete" - }, - { - "key" : "replace", - "value" : "Replace" - }, - { - "key" : "replaceString", - "value" : "Replace String" - }, - { - "key" : "trimCharacters", - "value" : "Trim Characters" - }, - { - "key" : "preset", - "value" : "Preset" - }, - { - "key" : "savedPresets", - "value" : "Saved Presets" - }, - { - "key" : "errorNoSavedPresets", - "value" : "You have no saved Rename Operation presets. Select 'Save as...' in the \"Presets\" dropdown to create a new preset." - }, - { - "key" : "areYouSureDelete", - "value" : "Are you sure you want to delete the preset \"{0}\"?" - }, - { - "key" : "deletePreset", - "value" : "Delete Preset" - }, - { - "key" : "removeCharacters", - "value" : "Remove Characters" - }, - { - "key" : "bulkRename", - "value" : "Bulk Rename" - }, - { - "key" : "renamingObjectXofY", - "value" : "Renaming Object {0} of {1}" - }, - { - "key" : "renaming", - "value" : "Renaming" - }, - { - "key" : "errorAssetNotBulkRenamed", - "value" : "Asset [{0}] not renamed when trying to RenameAsset in BulkRenamer. It may have been canceled because the new name was already taken by an object at the same path. The new name may also have contained special characters.\nOriginalPath: {1}, New Name: {2}" - }, - { - "key" : "deleteFromFront", - "value" : "Delete from Front" - }, - { - "key" : "deleteFromBack", - "value" : "Delete from Back" - }, - { - "key" : "toCamelCase", - "value" : "To Camel Case" - }, - { - "key" : "usePascalCasing", - "value" : "Use Pascal Casing" - }, - { - "key" : "flagToCapitalizeTheFirstLetterOfname", - "value" : "Flag to capitalize the first letter of the name (also known as Upper Camel Casing)." - }, - { - "key" : "delimiterCharacters", - "value" : "Delimiter Characters" - }, - { - "key" : "caseSensitiveCharactersIndicateStart", - "value" : "The case sensitive characters that indicate the start of a word." - }, - { - "key" : "delimiters", - "value" : "Delimiters" - }, - { - "key" : "searchString", - "value" : "Search String" - }, - { - "key" : "useRegex", - "value" : "Use Regular Expression" - }, - { - "key" : "matchTermsUsingRegex", - "value" : "Match terms using Regular Expressions, terms that allow for powerful pattern matching." - }, - { - "key" : "matchRegex", - "value" : "Match Regex" - }, - { - "key" : "regexToUseToMatchTerms", - "value" : "Regular Expression to use to match terms." - }, - { - "key" : "searchForString", - "value" : "Search for String" - }, - { - "key" : "substringsToSeatchInFilenames", - "value" : "Substrings to search for in the filenames. These strings will be replaced by the Replacement String." - }, - { - "key" : "replaceWith", - "value" : "Replace with" - }, - { - "key" : "stringToReplaceMatchingInstances", - "value" : "String to replace matching instances of the Search string." - }, - { - "key" : "caseSensitive", - "value" : "Case Sensitive" - }, - { - "key" : "searchUsingCaseSensitivity", - "value" : "Search using case sensitivity. Only strings that match the supplied casing will be replaced." - }, - { - "key" : "matchExpressNotValid", - "value" : "Match Expression is not a valid Regular Expression." - }, - { - "key" : "replacementExpressionNotValid", - "value" : "Replacement Expression is not a valid Regular Expression." - }, - { - "key" : "newName", - "value" : "New Name" - }, - { - "key" : "nameToReplaceTheOldeOne", - "value" : "Name to replace the old one with." - }, - { - "key" : "selectPresetOrSpecifyCharacters", - "value" : "Select a preset or specify your own characters." - }, - { - "key" : "charactersToRemove", - "value" : "Characters to Remove" - }, - { - "key" : "allCharactersThatWillBeRemoved", - "value" : "All characters that will be removed from the names." - }, - { - "key" : "flagTheSearchToMatchCase", - "value" : "Flag the search to match only the specified case" - }, - { - "key" : "symbols", - "value" : "Symbols" - }, - { - "key" : "removeSpecialCharacters", - "value" : "Removes special characters (ie. !@#$%^&*)" - }, - { - "key" : "numbers", - "value" : "Numbers" - }, - { - "key" : "removeDigits", - "value" : "Removes digits 0-9" - }, - { - "key" : "whitespace", - "value" : "Whitespace" - }, - { - "key" : "removesWhitespace", - "value" : "Removes Whitespace" - }, - { - "key" : "count", - "value" : "Count" - }, - { - "key" : "format", - "value" : "Format" - }, - { - "key" : "selectPresetFormat", - "value" : "Select a preset format or specify your own format." - }, - { - "key" : "countFormat", - "value" : "Count Format" - }, - { - "key" : "theStringFormatToUseWhenAddingTheCountToName", - "value" : "The string format to use when adding the Count to the name." - }, - { - "key" : "invalidCountFormat", - "value" : "Invalid Count Format. Typical formats are D1 for one digit with no leading zeros, D2, for two, etc.\nLookup the String.Format() method for more info on formatting options." - }, - { - "key" : "countFrom", - "value" : "Count From" - }, - { - "key" : "theValueToStartCountingFrom", - "value" : "The value to start counting from. The first object will have this number." - }, - { - "key" : "increment", - "value" : "Increment" - }, - { - "key" : "theValueToAddToEachObjectWhenCounting", - "value" : "The value to add to each object when counting." - }, - { - "key" : "addAsPrefix", - "value" : "Add As Prefix" - }, - { - "key" : "addTheCountToTheFontOfTheObjectName", - "value" : "Add the count to the front of the object's name." - }, - { - "key" : "custom", - "value" : "Custom" - }, - { - "key" : "strings", - "value" : "Strings" - }, - { - "key" : "theStringsOfLettersToAdd", - "value" : "The strings of letters to add, comma separated. Ex: \"A,B,C\" will append A, B, and C to the first three objects respectively. After that it will add another sequence, starting with AA, then AB, then AC, etc." - }, - { - "key" : "formatForTheAddedLetters", - "value" : "Format for the added letters." - }, - { - "key" : "theValueToStartCounting", - "value" : "The value to start counting from. The string from the sequence at this count will be appended to the first object." - }, - { - "key" : "startsWith", - "value" : "Starts with" - }, - { - "key" : "theValueToAddToTheCount", - "value" : "The value to add to the count after naming an object." - }, - { - "key" : "addTheCountToTheFront", - "value" : "Add the count to the front of the object's name." - }, - { - "key" : "uppercaseAlphabet", - "value" : "Uppercase Alphabet" - }, - { - "key" : "lowercaseAlphabet", - "value" : "Lowercase Alphabet" - }, - { - "key" : "toUpperOrLowercase", - "value" : "To Upper or Lowercase" - }, - { - "key" : "toUppercase", - "value" : "To Uppercase" - }, - { - "key" : "newCasing", - "value" : "New Casing" - }, - { - "key" : "theDesiredCasingForName", - "value" : "The desired casing for the new name." - }, - { - "key" : "onlyFirstCharacter", - "value" : "Only First Character" - }, - { - "key" : "changeOnlyTheFirstCharacterCase", - "value" : "Change only the first character's case." - }, - { - "key" : "addStringSequence", - "value" : "Add String Sequence" - }, - { - "key" : "sequence", - "value" : "Sequence" - }, - { - "key" : "theSequenceOfStringsToAddCommaSeparted", - "value" : "The sequence of strings to add, comma separted." - }, - { - "key" : "addTheCountToTheFrontOfTheObjectName", - "value" : "Add the count to the front of the object's name." - }, - { - "key" : "addPrefixOrSuffix", - "value" : "Add Prefix or Suffix" - }, - { - "key" : "suffix", - "value" : "Suffix" - }, - { - "key" : "replacementString", - "value" : "Replacement String" - }, - { - "key" : "preferenceWindowTitle", - "value" : "Mulligan Renamer Preferences" - }, - { - "key" : "preferencesMenuItem", - "value" : "Mulligan Renamer" - }, - { - "key" : "preferencesDiffLabel", - "value" : "Diff Colors" - }, - { - "key" : "preferencesInsertionText", - "value" : "Insertion Text" - }, - { - "key" : "preferencesInsertionBackground", - "value" : "Insertion Background" - }, - { - "key" : "preferencesDeletionText", - "value" : "Deletion Text" - }, - { - "key" : "preferencesDeletionBackground", - "value" : "Deletion Background" - }, - { - "key" : "preferencesReset", - "value" : "Reset to Default" - }, - { - "key" : "preferences", - "value" : "Preferences" - }, - { - "key" : "exampleThisIs", - "value" : "This is" - }, - { - "key" : "exampleSampleText", - "value" : "sample text" - }, - { - "key" : "exampleWithWords", - "value" : "with words" - }, - { - "key" : "exampleInserted", - "value" : "inserted" - }, - { - "key" : "exampleDeleted", - "value" : "deleted" - }, - { - "key" : "adjustNumbers", - "value" : "Adjust Numbers" - }, - { - "key" : "Lowercase", - "value" : "Lowercase" - }, - { - "key" : "Uppercase", - "value" : "Uppercase" - }, - { - "key" : "offset", - "value" : "Offset" - } - ] + "name": "English", + "key": "en", + "version": 0, + "elements": [ + { + "key": "rename", + "value": "Rename" + }, + { + "key": "renameWarningNotRenamed", + "value": "Some objects have warnings and will not be renamed. Do you want to rename the other objects in the group?" + }, + { + "key": "warning", + "value": "Warning" + }, + { + "key": "cancel", + "value": "Cancel" + }, + { + "key": "failToRenameMulligan", + "value": "Sorry, some objects failed to rename. Something went wrong with Mulligan. Please report a bug (see UserManual for details). This rename operation will be automatically undone\n\nException: " + }, + { + "key": "error", + "value": "Error" + }, + { + "key": "presets", + "value": "Presets" + }, + { + "key": "result", + "value": "Result" + }, + { + "key": "addOperation", + "value": "Add Operation" + }, + { + "key": "renameOperation", + "value": "Rename Operation" + }, + { + "key": "language", + "value": "Language" + }, + { + "key": "languageTooltip", + "value": "Specifies the language for all text used in Mulligan." + }, + { + "key": "prefix", + "value": "Prefix" + }, + { + "key": "saveAs", + "value": "Save As..." + }, + { + "key": "managePresets", + "value": "Manage Presets" + }, + { + "key": "errorUnrecognizedListButton", + "value": "RenamerWindow found Unrecognized ListButtonEvent [{0}] in OnGUI. Add a case to handle this event." + }, + { + "key": "errorAddNewOpNotSub", + "value": "MulliganRenamerWindow tried to add a new RenameOperation using a type that is not a subclass of RenameOperationDrawerBinding. Operation type: " + }, + { + "key": "thankYouForSupport", + "value": "Thank you very much for supporting Mulligan!" + }, + { + "key": "thankYouForReview", + "value": "Thank you for reviewing Mulligan!" + }, + { + "key": "thankYouForUsing", + "value": "Thank you for using Mulligan! If you've found it useful, please consider supporting its development by purchasing it from the Asset Store. Thanks!" + }, + { + "key": "thankYouForPurchasing", + "value": "Thank you for purchasing Mulligan! If you've found it useful, please consider leaving a review on the Asset Store. The store is very competitive and every review helps to stand out. Thanks!" + }, + { + "key": "openAssetStore", + "value": "Open Asset Store" + }, + { + "key": "savePreset", + "value": "Save Preset" + }, + { + "key": "previewSteps", + "value": "Preview Steps" + }, + { + "key": "noObjectsSpecified", + "value": "No objects specified for rename. Drag objects here to rename them, or" + }, + { + "key": "addMoreObjectsDragPanel", + "value": "Add more objects by dragging them into the above panel" + }, + { + "key": "addMoreObjectsDragHere", + "value": "Add more objects by dragging them here" + }, + { + "key": "toRenameMoreObjects", + "value": "To rename more objects, drag them here, or" + }, + { + "key": "removeAll", + "value": "Remove All" + }, + { + "key": "object", + "value": "Object" + }, + { + "key": "objects", + "value": "Objects" + }, + { + "key": "renamed", + "value": "Renamed" + }, + { + "key": "original", + "value": "Original" + }, + { + "key": "before", + "value": "Before" + }, + { + "key": "after", + "value": "After" + }, + { + "key": "finalName", + "value": "Final Name" + }, + { + "key": "addSelectedObjects", + "value": "Add Selected Objects" + }, + { + "key": "errorTryingToAccessModel", + "value": "Trying to access PreviewRowModel at index that is out of bounds. Index: " + }, + { + "key": "warningNewNameMatchesExisting", + "value": "New name matches an existing file or another renamed object." + }, + { + "key": "assetBlankName", + "value": "Asset has blank name." + }, + { + "key": "nameIncludeInvalidCharacter", + "value": "Name includes invalid characters (usually symbols such as ?.,)." + }, + { + "key": "tryingToAddSpriteToRenamer", + "value": "Trying to add Sprite {0} to SpriteRenamer that has a different path to texture than the other sprites. Received path {1}, expected {2}" + }, + { + "key": "errorTryingToAddSpriteToRenamer", + "value": "Trying to add Sprite to SpriteRenamer at path {0}, but no meta file exists at the specified path." + }, + { + "key": "errorPresetNameAlreadyExists", + "value": "A preset named \"{0}\" already exists. Do you want to replace it?" + }, + { + "key": "no", + "value": "No" + }, + { + "key": "save", + "value": "Save" + }, + { + "key": "errorTryintToGetOriginalName", + "value": "Trying to get original name for RenameResultSequence at index that's out of bounds. Index: {0}" + }, + { + "key": "errorTryingToGetOriginalNameOutOfBounds", + "value": "Trying to get original name for RenameResultSequence at index that's out of bounds. Index: {0}" + }, + { + "key": "add", + "value": "Add" + }, + { + "key": "prefixOrSuffix", + "value": "Prefix or Suffix" + }, + { + "key": "stringSequence", + "value": "String Sequence" + }, + { + "key": "modify", + "value": "Modify" + }, + { + "key": "changeCase", + "value": "Change Case" + }, + { + "key": "countByLetter", + "value": "Count By Letter" + }, + { + "key": "enumerate", + "value": "Enumerate" + }, + { + "key": "delete", + "value": "Delete" + }, + { + "key": "replace", + "value": "Replace" + }, + { + "key": "replaceString", + "value": "Replace String" + }, + { + "key": "trimCharacters", + "value": "Trim Characters" + }, + { + "key": "preset", + "value": "Preset" + }, + { + "key": "savedPresets", + "value": "Saved Presets" + }, + { + "key": "errorNoSavedPresets", + "value": "You have no saved Rename Operation presets. Select 'Save as...' in the \"Presets\" dropdown to create a new preset." + }, + { + "key": "areYouSureDelete", + "value": "Are you sure you want to delete the preset \"{0}\"?" + }, + { + "key": "deletePreset", + "value": "Delete Preset" + }, + { + "key": "removeCharacters", + "value": "Remove Characters" + }, + { + "key": "bulkRename", + "value": "Bulk Rename" + }, + { + "key": "renamingObjectXofY", + "value": "Renaming Object {0} of {1}" + }, + { + "key": "renaming", + "value": "Renaming" + }, + { + "key": "errorAssetNotBulkRenamed", + "value": "Asset [{0}] not renamed when trying to RenameAsset in BulkRenamer. It may have been canceled because the new name was already taken by an object at the same path. The new name may also have contained special characters.\nOriginalPath: {1}, New Name: {2}" + }, + { + "key": "deleteFromFront", + "value": "Delete from Front" + }, + { + "key": "deleteFromBack", + "value": "Delete from Back" + }, + { + "key": "toCamelCase", + "value": "To Camel Case" + }, + { + "key": "usePascalCasing", + "value": "Use Pascal Casing" + }, + { + "key": "flagToCapitalizeTheFirstLetterOfname", + "value": "Flag to capitalize the first letter of the name (also known as Upper Camel Casing)." + }, + { + "key": "delimiterCharacters", + "value": "Delimiter Characters" + }, + { + "key": "caseSensitiveCharactersIndicateStart", + "value": "The case sensitive characters that indicate the start of a word." + }, + { + "key": "delimiters", + "value": "Delimiters" + }, + { + "key": "searchString", + "value": "Search String" + }, + { + "key": "useRegex", + "value": "Use Regular Expression" + }, + { + "key": "matchTermsUsingRegex", + "value": "Match terms using Regular Expressions, terms that allow for powerful pattern matching." + }, + { + "key": "matchRegex", + "value": "Match Regex" + }, + { + "key": "regexToUseToMatchTerms", + "value": "Regular Expression to use to match terms." + }, + { + "key": "searchForString", + "value": "Search for String" + }, + { + "key": "substringsToSeatchInFilenames", + "value": "Substrings to search for in the filenames. These strings will be replaced by the Replacement String." + }, + { + "key": "replaceWith", + "value": "Replace with" + }, + { + "key": "stringToReplaceMatchingInstances", + "value": "String to replace matching instances of the Search string." + }, + { + "key": "caseSensitive", + "value": "Case Sensitive" + }, + { + "key": "searchUsingCaseSensitivity", + "value": "Search using case sensitivity. Only strings that match the supplied casing will be replaced." + }, + { + "key": "matchExpressNotValid", + "value": "Match Expression is not a valid Regular Expression." + }, + { + "key": "replacementExpressionNotValid", + "value": "Replacement Expression is not a valid Regular Expression." + }, + { + "key": "newName", + "value": "New Name" + }, + { + "key": "nameToReplaceTheOldeOne", + "value": "Name to replace the old one with." + }, + { + "key": "selectPresetOrSpecifyCharacters", + "value": "Select a preset or specify your own characters." + }, + { + "key": "charactersToRemove", + "value": "Characters to Remove" + }, + { + "key": "allCharactersThatWillBeRemoved", + "value": "All characters that will be removed from the names." + }, + { + "key": "flagTheSearchToMatchCase", + "value": "Flag the search to match only the specified case" + }, + { + "key": "symbols", + "value": "Symbols" + }, + { + "key": "removeSpecialCharacters", + "value": "Removes special characters (ie. !@#$%^&*)" + }, + { + "key": "numbers", + "value": "Numbers" + }, + { + "key": "removeDigits", + "value": "Removes digits 0-9" + }, + { + "key": "whitespace", + "value": "Whitespace" + }, + { + "key": "removesWhitespace", + "value": "Removes Whitespace" + }, + { + "key": "count", + "value": "Count" + }, + { + "key": "format", + "value": "Format" + }, + { + "key": "selectPresetFormat", + "value": "Select a preset format or specify your own format." + }, + { + "key": "countFormat", + "value": "Count Format" + }, + { + "key": "theStringFormatToUseWhenAddingTheCountToName", + "value": "The string format to use when adding the Count to the name." + }, + { + "key": "invalidCountFormat", + "value": "Invalid Count Format. Typical formats are D1 for one digit with no leading zeros, D2, for two, etc.\nLookup the String.Format() method for more info on formatting options." + }, + { + "key": "countFrom", + "value": "Count From" + }, + { + "key": "theValueToStartCountingFrom", + "value": "The value to start counting from. The first object will have this number." + }, + { + "key": "increment", + "value": "Increment" + }, + { + "key": "theValueToAddToEachObjectWhenCounting", + "value": "The value to add to each object when counting." + }, + { + "key": "addAsPrefix", + "value": "Add As Prefix" + }, + { + "key": "addTheCountToTheFontOfTheObjectName", + "value": "Add the count to the front of the object's name." + }, + { + "key": "custom", + "value": "Custom" + }, + { + "key": "strings", + "value": "Strings" + }, + { + "key": "theStringsOfLettersToAdd", + "value": "The strings of letters to add, comma separated. Ex: \"A,B,C\" will append A, B, and C to the first three objects respectively. After that it will add another sequence, starting with AA, then AB, then AC, etc." + }, + { + "key": "formatForTheAddedLetters", + "value": "Format for the added letters." + }, + { + "key": "theValueToStartCounting", + "value": "The value to start counting from. The string from the sequence at this count will be appended to the first object." + }, + { + "key": "startsWith", + "value": "Starts with" + }, + { + "key": "theValueToAddToTheCount", + "value": "The value to add to the count after naming an object." + }, + { + "key": "addTheCountToTheFront", + "value": "Add the count to the front of the object's name." + }, + { + "key": "uppercaseAlphabet", + "value": "Uppercase Alphabet" + }, + { + "key": "lowercaseAlphabet", + "value": "Lowercase Alphabet" + }, + { + "key": "toUpperOrLowercase", + "value": "To Upper or Lowercase" + }, + { + "key": "toUppercase", + "value": "To Uppercase" + }, + { + "key": "newCasing", + "value": "New Casing" + }, + { + "key": "theDesiredCasingForName", + "value": "The desired casing for the new name." + }, + { + "key": "onlyFirstCharacter", + "value": "Only First Character" + }, + { + "key": "changeOnlyTheFirstCharacterCase", + "value": "Change only the first character's case." + }, + { + "key": "addStringSequence", + "value": "Add String Sequence" + }, + { + "key": "sequence", + "value": "Sequence" + }, + { + "key": "theSequenceOfStringsToAddCommaSeparted", + "value": "The sequence of strings to add, comma separted." + }, + { + "key": "addTheCountToTheFrontOfTheObjectName", + "value": "Add the count to the front of the object's name." + }, + { + "key": "addPrefixOrSuffix", + "value": "Add Prefix or Suffix" + }, + { + "key": "suffix", + "value": "Suffix" + }, + { + "key": "replacementString", + "value": "Replacement String" + }, + { + "key": "preferenceWindowTitle", + "value": "Mulligan Renamer Preferences" + }, + { + "key": "preferencesMenuItem", + "value": "Mulligan Renamer" + }, + { + "key": "preferencesDiffLabel", + "value": "Diff Colors" + }, + { + "key": "preferencesInsertionText", + "value": "Insertion Text" + }, + { + "key": "preferencesInsertionBackground", + "value": "Insertion Background" + }, + { + "key": "preferencesDeletionText", + "value": "Deletion Text" + }, + { + "key": "preferencesDeletionBackground", + "value": "Deletion Background" + }, + { + "key": "preferencesReset", + "value": "Reset to Default" + }, + { + "key": "preferences", + "value": "Preferences" + }, + { + "key": "exampleThisIs", + "value": "This is" + }, + { + "key": "exampleSampleText", + "value": "sample text" + }, + { + "key": "exampleWithWords", + "value": "with words" + }, + { + "key": "exampleInserted", + "value": "inserted" + }, + { + "key": "exampleDeleted", + "value": "deleted" + }, + { + "key": "adjustNumbers", + "value": "Adjust Numbers" + }, + { + "key": "Lowercase", + "value": "Lowercase" + }, + { + "key": "Uppercase", + "value": "Uppercase" + }, + { + "key": "offset", + "value": "Offset" + }, + { + "key": "updateLanguages", + "value": "Update Languages" + }, + { + "key": "languageUpdateProgressTitle", + "value": "Updating Languages" + }, + { + "key": "languageUpdateProgressMessage1", + "value": "Checking for language updates..." + }, + { + "key": "languageUpdateDownloadingLanguages", + "value": "Downloading language {0}..." + }, + { + "key": "languageUpdateSavingChanges", + "value": "Saving Changes..." + }, + { + "key": "languageUpdateProgressTitleSuccess", + "value": "Languages Successfully Updated" + }, + { + "key": "ok", + "value": "OK" + }, + { + "key": "languageUpdateProgressTitleFail", + "value": "Language Update Failed" + }, + { + "key": "languageUpdateTimeout", + "value": "Update failed due to web request timeout. If you have internet, our servers may be down. Please try again later, or report a bug (see UserManual for details) if the issue persists." + }, + { + "key": "languageUpdateFail", + "value": "Update failed. Please report a bug (see UserManual for details). FailCode: {0}, Message: {1}." + }, + { + "key": "languageUpdated", + "value": "Updated {0} from version {1} to {2}" + }, + { + "key": "languageAdded", + "value": "Added {0}." + }, + { + "key": "languageUnchanged", + "value": "{0} is up to date." + }, + { + "key": "languageAllUpToDate", + "value": "All languages are up to date." + } + ] } \ No newline at end of file diff --git a/Assets/RedBlueGames/MulliganRenamer/Editor/Resources/MulliganLanguages/pt.json b/Assets/RedBlueGames/MulliganRenamer/Editor/Resources/MulliganLanguages/pt.json index 8bffa0c..89fa577 100644 --- a/Assets/RedBlueGames/MulliganRenamer/Editor/Resources/MulliganLanguages/pt.json +++ b/Assets/RedBlueGames/MulliganRenamer/Editor/Resources/MulliganLanguages/pt.json @@ -1,627 +1,683 @@ { - "languageName" : "Portugûes", - "languageKey" : "pt", - "elements" : - [ - { - "key" : "rename", - "value" : "Renomear" - }, - { - "key" : "renameWarningNotRenamed", - "value" : "Alguns objetos possuem alertas e não serão renomeados. Você deseja renomear os outros objetos no grupo?" - }, - { - "key" : "warning", - "value" : "Alerta" - }, - { - "key" : "cancel", - "value" : "Cancelar" - }, - { - "key" : "failToRenameMulligan", - "value" : "Desculpe, o renomeamento de alguns objetos falharam. Algo de errado aconteceu com o Mulligan. Por favor reporte um bug (veja o UserManual para detalhes). Essa operação de renomeação será automaticamente reverida\n\n Erro: " - }, - { - "key" : "error", - "value" : "Erro" - }, - { - "key" : "presets", - "value" : "Predefinições" - }, - { - "key" : "result", - "value" : "Resultado" - }, - { - "key" : "addOperation", - "value" : "Adicionar Operação" - }, - { - "key" : "renameOperation", - "value" : "Operação de Renomear" - }, - { - "key" : "language", - "value" : "Idioma" - }, - { - "key" : "languageTooltip", - "value" : "Specifies the language for all text used in Mulligan." - }, - { - "key" : "prefix", - "value" : "Prefixo" - }, - { - "key" : "saveAs", - "value" : "Salvar como..." - }, - { - "key" : "managePresets", - "value" : "Gerenciar predefinições" - }, - { - "key" : "errorUnrecognizedListButton", - "value" : "RenamerWindow achou ListButtonEvent [{0}] não reconhecida no OnGUI. Adicione um case para lidar com esse evento" - }, - { - "key" : "errorAddNewOpNotSub", - "value" : "MulliganRenamerWindow tentou adicionar uma nova RenameOperation usando um tipo que não é uma subclasse de RenameOperationDrawerBinding. Tipo: " - }, - { - "key" : "thankYouForSupport", - "value" : "Muito obrigado por suportar Mulligan!" - }, - { - "key" : "thankYouForReview", - "value" : "Obrigado por avaliar o Mulligan!" - }, - { - "key" : "thankYouForUsing", - "value" : "Obrigado por usar Mulligan! Se você achou útil, por favor considere suportar o desenvolvimento comprando na Asset Store. Obrigado!" - }, - { - "key" : "thankYouForPurchasing", - "value" : "Obrigado por comprar o Mulligan! Se você achou útil, por favor considere deixar uma avalição na Asset Store. A loja é muito competitiva e cada avaliação ajuda a sobresair. Obrigado!" - }, - { - "key" : "openAssetStore", - "value" : "Abrir a Asset Store" - }, - { - "key" : "savePreset", - "value" : "Salvar Predefinições" - }, - { - "key" : "previewSteps", - "value" : "Pré-visualização dos passos" - }, - { - "key" : "noObjectsSpecified", - "value" : "Nenhum objeto específicado para renomear. Arraste objetos para renomea-los, ou" - }, - { - "key" : "addMoreObjectsDragPanel", - "value" : "Adicione mais objetos arrando-os no painel acima" - }, - { - "key" : "addMoreObjectsDragHere", - "value" : "Adicione mais objetos arrastando eles aqui" - }, - { - "key" : "toRenameMoreObjects", - "value" : "Para renomear mais objetos, arraste eles aqui, ou" - }, - { - "key" : "removeAll", - "value" : "Remover Todos" - }, - { - "key" : "object", - "value" : "Objeto" - }, - { - "key" : "objects", - "value" : "Objetos" - }, - { - "key" : "renamed", - "value" : "Renamed" - }, - { - "key" : "original", - "value" : "Original" - }, - { - "key" : "before", - "value" : "Antes" - }, - { - "key" : "after", - "value" : "Depois" - }, - { - "key" : "finalName", - "value" : "Nome Final" - }, - { - "key" : "addSelectedObjects", - "value" : "Adicionar Objetos Selecionados" - }, - { - "key" : "errorTryingToAccessModel", - "value" : "Tentando acessar PreviewRowModel no index que estão fora dos limites. Index: " - }, - { - "key" : "warningNewNameMatchesExisting", - "value" : "Novos nomes coincidem um objeto que já existe ou outro objeto renomeado" - }, - { - "key" : "assetBlankName", - "value" : "O Asset tem um nome em branco" - }, - { - "key" : "nameIncludeInvalidCharacter", - "value" : "O nome inluí caracteres inválidos (normalmente símbolos como ?.,)." - }, - { - "key" : "tryingToAddSpriteToRenamer", - "value" : "Tentando adicionar o Sprite {0} para SpriteRenamer que tem um caminho diferente da texture que os outros sprites. Recebeu o caminho {1}, esperando {2}" - }, - { - "key" : "errorTryingToAddSpriteToRenamer", - "value" : "Tentando adicionar o Sprite para SpriteRenamer ao caminho {0}, mas nenhum arquivo Meta existe no caminho especificado." - }, - { - "key" : "errorPresetNameAlreadyExists", - "value" : "A predefinicão com nome \"{0}\" já existe. Você deseja substituir?" - }, - { - "key" : "no", - "value" : "Não" - }, - { - "key" : "save", - "value" : "Salvar" - }, - { - "key" : "errorTryintToGetOriginalName", - "value" : "Tentando obter o nome original para RenameResultSequence no index que está fora dos limits. Index: {0}" - }, - { - "key" : "errorTryingToGetOriginalNameOutOfBounds", - "value" : "Tentando obter o nome original para RenameResultSequence no index que está fora dos limits. Index: {0}" - }, - { - "key" : "add", - "value" : "Adicionar" - }, - { - "key" : "prefixOrSuffix", - "value" : "Prefixo ou Sufixo" - }, - { - "key" : "stringSequence", - "value" : "Sequência de String" - }, - { - "key" : "modify", - "value" : "Modificar" - }, - { - "key" : "changeCase", - "value" : "Mudar Case" - }, - { - "key" : "countByLetter", - "value" : "Contar por Letra" - }, - { - "key" : "enumerate", - "value" : "Enumerar" - }, - { - "key" : "delete", - "value" : "Deletar" - }, - { - "key" : "replace", - "value" : "Substituir" - }, - { - "key" : "replaceString", - "value" : "Substituir String" - }, - { - "key" : "trimCharacters", - "value" : "Aparar caracteres" - }, - { - "key" : "preset", - "value" : "Predefinição" - }, - { - "key" : "savedPresets", - "value" : "Predefinições Salvas" - }, - { - "key" : "errorNoSavedPresets", - "value" : "Você não tem nenhuma operação Rename salvas nas predefinições. Selecione 'Salvar como...' no menu \"Predefinições\" para criar uma nova predefinicão" - }, - { - "key" : "areYouSureDelete", - "value" : "Você tem certeza que quer deletar a predefinicão \"{0}\"" - }, - { - "key" : "deletePreset", - "value" : "Deletar Predefinição" - }, - { - "key" : "removeCharacters", - "value" : "Remover Caracteres" - }, - { - "key" : "bulkRename", - "value" : "Renomear em massa" - }, - { - "key" : "renamingObjectXofY", - "value" : "Renomeando objeto {0} de {1}" - }, - { - "key" : "renaming", - "value" : "Renomeando" - }, - { - "key" : "errorAssetNotBulkRenamed", - "value" : "Asset [{0}] não renomeado quando tentando renomear em massa. Pode ser sido cancelado porque um nove nome já foi pego por um objeto no mesmo caminho. O nome nome pode conter caracteres especiais.\n Caminho original: {1}, Novo caminho: {2}" - }, - { - "key" : "deleteFromFront", - "value" : "Deletar da frente" - }, - { - "key" : "deleteFromBack", - "value" : "Deletar de trás" - }, - { - "key" : "toCamelCase", - "value" : "Para Camel Case" - }, - { - "key" : "usePascalCasing", - "value" : "Usar Pascal Casing" - }, - { - "key" : "flagToCapitalizeTheFirstLetterOfname", - "value" : "Sinalize para colocar em maiúscula a primeira letra do nome (também conhecida como Upper Camel Casing)." - }, - { - "key" : "delimiterCharacters", - "value" : "Caracteres delimitadores" - }, - { - "key" : "caseSensitiveCharactersIndicateStart", - "value" : "Os caracteres que diferenciam maiúsculas de minúsculas que indicam o início de uma palavra." - }, - { - "key" : "delimiters", - "value" : "Delimitadores" - }, - { - "key" : "searchString", - "value" : "Procurar String" - }, - { - "key" : "useRegex", - "value" : "Usar Expressão regular" - }, - { - "key" : "matchTermsUsingRegex", - "value" : "Correspondência de termos usando Expressões regulares, termos que permitem uma poderosa correspondência de padrões." - }, - { - "key" : "matchRegex", - "value" : "Correspondência Regex" - }, - { - "key" : "regexToUseToMatchTerms", - "value" : "Expressão regular a ser usada para corresponder aos termos." - }, - { - "key" : "searchForString", - "value" : "Procurar por String" - }, - { - "key" : "substringsToSeatchInFilenames", - "value" : "Substrings a serem pesquisados ​​nos nomes de arquivos. Essas seqüências serão substituídas pela seqüência de substituição." - }, - { - "key" : "replaceWith", - "value" : "Substituir com" - }, - { - "key" : "stringToReplaceMatchingInstances", - "value" : "String para substituir instâncias correspondentes da string de Pesquisa." - }, - { - "key" : "caseSensitive", - "value" : "Sensível a maiúsculas e minúscula" - }, - { - "key" : "searchUsingCaseSensitivity", - "value" : "Pesquise usando distinção entre maiúsculas e minúsculas. Somente as strings que correspondem à caixa fornecida serão substituídas." - }, - { - "key" : "matchExpressNotValid", - "value" : "A expressão de correspondência não é uma expressão regular válida." - }, - { - "key" : "replacementExpressionNotValid", - "value" : "A expressão de substituição não é uma expressão regular válida." - }, - { - "key" : "newName", - "value" : "Novo Nome" - }, - { - "key" : "nameToReplaceTheOldeOne", - "value" : "Nome para substituir o antigo." - }, - { - "key" : "selectPresetOrSpecifyCharacters", - "value" : "Selecione uma predefinição ou especifique seus próprios caracteres." - }, - { - "key" : "charactersToRemove", - "value" : "Caracteres para Remover." - }, - { - "key" : "allCharactersThatWillBeRemoved", - "value" : "Todos os caracteres que serão removidos dos nomes." - }, - { - "key" : "flagTheSearchToMatchCase", - "value" : "Sinalize a pesquisa para corresponder apenas ao caso especificado." - }, - { - "key" : "symbols", - "value" : "Símbolos" - }, - { - "key" : "removeSpecialCharacters", - "value" : "Remove caracteres especiais (ex. !@#$%^&*)" - }, - { - "key" : "numbers", - "value" : "Números" - }, - { - "key" : "removeDigits", - "value" : "Remove dígitos 0-9" - }, - { - "key" : "whitespace", - "value" : "Espaço em branco" - }, - { - "key" : "removesWhitespace", - "value" : "Remove Espaços em branco" - }, - { - "key" : "count", - "value" : "Contagem" - }, - { - "key" : "format", - "value" : "Formato" - }, - { - "key" : "selectPresetFormat", - "value" : "Selecione um formato predefinido ou especifique seu próprio formato." - }, - { - "key" : "countFormat", - "value" : "Formato de contagem" - }, - { - "key" : "theStringFormatToUseWhenAddingTheCountToName", - "value" : "O formato da sequência a ser usada ao adicionar a contagem ao nome." - }, - { - "key" : "invalidCountFormat", - "value" : "Formato de contagem inválido. Os formatos típicos são D1 para um dígito sem zeros à esquerda, D2, para dois etc.\nProcure o método String.Format () para obter mais informações sobre as opções de formatação." - }, - { - "key" : "countFrom", - "value" : "Contagem de" - }, - { - "key" : "theValueToStartCountingFrom", - "value" : "O valor para começar a contar. O primeiro objeto terá esse número." - }, - { - "key" : "increment", - "value" : "Incremento" - }, - { - "key" : "theValueToAddToEachObjectWhenCounting", - "value" : "O valor a ser adicionado a cada objeto ao contar." - }, - { - "key" : "addAsPrefix", - "value" : "Adicionar como prefixo" - }, - { - "key" : "addTheCountToTheFontOfTheObjectName", - "value" : "Adicione a contagem à frente do nome do objeto." - }, - { - "key" : "custom", - "value" : "Personalizados" - }, - { - "key" : "strings", - "value" : "Strings" - }, - { - "key" : "theStringsOfLettersToAdd", - "value" : "As seqüências de letras a serem adicionadas, separadas por vírgula. Ex: \"A, B, C\" anexará A, B e C aos três primeiros objetos, respectivamente. Depois disso, ele adicionará outra sequência, começando com AA, AB, AC, etc." - }, - { - "key" : "formatForTheAddedLetters", - "value" : "Formato para as letras adicionadas." - }, - { - "key" : "theValueToStartCounting", - "value" : "O valor para começar a contar. A sequência da sequência nessa contagem será anexada ao primeiro objeto." - }, - { - "key" : "startsWith", - "value" : "Começa com" - }, - { - "key" : "theValueToAddToTheCount", - "value" : "The value to add to the count after naming an object." - }, - { - "key" : "addTheCountToTheFront", - "value" : "O valor a ser adicionado à contagem após nomear um objeto." - }, - { - "key" : "uppercaseAlphabet", - "value" : "Alfabeto em Maiúsculas" - }, - { - "key" : "lowercaseAlphabet", - "value" : "Alfabeto em Minúsculas" - }, - { - "key" : "toUpperOrLowercase", - "value" : "Para Maiúsculas ou Minúsculas" - }, - { - "key" : "toUppercase", - "value" : "Para maiúsculas" - }, - { - "key" : "newCasing", - "value" : "Nova Caixa" - }, - { - "key" : "theDesiredCasingForName", - "value" : "A Caixa desejada para o novo nome." - }, - { - "key" : "onlyFirstCharacter", - "value" : "Apenas o Primeiro Caractere" - }, - { - "key" : "changeOnlyTheFirstCharacterCase", - "value" : "Mude apenas o caso do primeiro caractere." - }, - { - "key" : "addStringSequence", - "value" : "Adicionar sequência de strings" - }, - { - "key" : "sequence", - "value" : "Sequência" - }, - { - "key" : "theSequenceOfStringsToAddCommaSeparted", - "value" : "A sequência de sequências a serem adicionadas, separadas por vírgula." - }, - { - "key" : "addTheCountToTheFrontOfTheObjectName", - "value" : "Adicione a contagem à frente do nome do objeto." - }, - { - "key" : "addPrefixOrSuffix", - "value" : "Adicionar prefixo ou sufixo" - }, - { - "key" : "suffix", - "value" : "Sufixo" - }, - { - "key" : "replacementString", - "value" : "Substituição de String" - }, - { - "key" : "preferenceWindowTitle", - "value" : "Preferências do Mulligan Renamer" - }, - { - "key" : "preferencesMenuItem", - "value" : "Mulligan Renamer" - }, - { - "key" : "preferencesDiffLabel", - "value" : "Cores de Diff" - }, - { - "key" : "preferencesInsertionText", - "value" : "Inserção de texto" - }, - { - "key" : "preferencesInsertionBackground", - "value" : "Inserção de fundo" - }, - { - "key" : "preferencesDeletionText", - "value" : "Eliminação de texto" - }, - { - "key" : "preferencesDeletionBackground", - "value" : "Elimninação de fundo" - }, - { - "key" : "preferencesReset", - "value" : "Restaurar ao padrão" - }, - { - "key" : "preferences", - "value" : "Preferências" - }, - { - "key" : "exampleThisIs", - "value" : "Esse é" - }, - { - "key" : "exampleSampleText", - "value" : "um texto exemplo" - }, - { - "key" : "exampleWithWords", - "value" : "com palavras" - }, - { - "key" : "exampleInserted", - "value" : "inseridas" - }, - { - "key" : "exampleDeleted", - "value" : "eliminadas" - }, - { - "key" : "adjustNumbers", - "value" : "Ajustar números" - }, - { - "key" : "Lowercase", - "value" : "Caixa baixa" - }, - { - "key" : "Uppercase", - "value" : "Caixa alta" - }, - { - "key" : "offset", - "value" : "Compensar" - } - ] + "name": "Portugûes", + "key": "pt", + "version": 0, + "elements": [ + { + "key": "rename", + "value": "Renomear" + }, + { + "key": "renameWarningNotRenamed", + "value": "Alguns objetos possuem alertas e não serão renomeados. Você deseja renomear os outros objetos no grupo?" + }, + { + "key": "warning", + "value": "Alerta" + }, + { + "key": "cancel", + "value": "Cancelar" + }, + { + "key": "failToRenameMulligan", + "value": "Desculpe, o renomeamento de alguns objetos falharam. Algo de errado aconteceu com o Mulligan. Por favor reporte um bug (veja o UserManual para detalhes). Essa operação de renomeação será automaticamente reverida\n\n Erro: " + }, + { + "key": "error", + "value": "Erro" + }, + { + "key": "presets", + "value": "Predefinições" + }, + { + "key": "result", + "value": "Resultado" + }, + { + "key": "addOperation", + "value": "Adicionar Operação" + }, + { + "key": "renameOperation", + "value": "Operação de Renomear" + }, + { + "key": "language", + "value": "Idioma" + }, + { + "key": "languageTooltip", + "value": "Specifies the language for all text used in Mulligan." + }, + { + "key": "prefix", + "value": "Prefixo" + }, + { + "key": "saveAs", + "value": "Salvar como..." + }, + { + "key": "managePresets", + "value": "Gerenciar predefinições" + }, + { + "key": "errorUnrecognizedListButton", + "value": "RenamerWindow achou ListButtonEvent [{0}] não reconhecida no OnGUI. Adicione um case para lidar com esse evento" + }, + { + "key": "errorAddNewOpNotSub", + "value": "MulliganRenamerWindow tentou adicionar uma nova RenameOperation usando um tipo que não é uma subclasse de RenameOperationDrawerBinding. Tipo: " + }, + { + "key": "thankYouForSupport", + "value": "Muito obrigado por suportar Mulligan!" + }, + { + "key": "thankYouForReview", + "value": "Obrigado por avaliar o Mulligan!" + }, + { + "key": "thankYouForUsing", + "value": "Obrigado por usar Mulligan! Se você achou útil, por favor considere suportar o desenvolvimento comprando na Asset Store. Obrigado!" + }, + { + "key": "thankYouForPurchasing", + "value": "Obrigado por comprar o Mulligan! Se você achou útil, por favor considere deixar uma avalição na Asset Store. A loja é muito competitiva e cada avaliação ajuda a sobresair. Obrigado!" + }, + { + "key": "openAssetStore", + "value": "Abrir a Asset Store" + }, + { + "key": "savePreset", + "value": "Salvar Predefinições" + }, + { + "key": "previewSteps", + "value": "Pré-visualização dos passos" + }, + { + "key": "noObjectsSpecified", + "value": "Nenhum objeto específicado para renomear. Arraste objetos para renomea-los, ou" + }, + { + "key": "addMoreObjectsDragPanel", + "value": "Adicione mais objetos arrando-os no painel acima" + }, + { + "key": "addMoreObjectsDragHere", + "value": "Adicione mais objetos arrastando eles aqui" + }, + { + "key": "toRenameMoreObjects", + "value": "Para renomear mais objetos, arraste eles aqui, ou" + }, + { + "key": "removeAll", + "value": "Remover Todos" + }, + { + "key": "object", + "value": "Objeto" + }, + { + "key": "objects", + "value": "Objetos" + }, + { + "key": "renamed", + "value": "Renamed" + }, + { + "key": "original", + "value": "Original" + }, + { + "key": "before", + "value": "Antes" + }, + { + "key": "after", + "value": "Depois" + }, + { + "key": "finalName", + "value": "Nome Final" + }, + { + "key": "addSelectedObjects", + "value": "Adicionar Objetos Selecionados" + }, + { + "key": "errorTryingToAccessModel", + "value": "Tentando acessar PreviewRowModel no index que estão fora dos limites. Index: " + }, + { + "key": "warningNewNameMatchesExisting", + "value": "Novos nomes coincidem um objeto que já existe ou outro objeto renomeado" + }, + { + "key": "assetBlankName", + "value": "O Asset tem um nome em branco" + }, + { + "key": "nameIncludeInvalidCharacter", + "value": "O nome inluí caracteres inválidos (normalmente símbolos como ?.,)." + }, + { + "key": "tryingToAddSpriteToRenamer", + "value": "Tentando adicionar o Sprite {0} para SpriteRenamer que tem um caminho diferente da texture que os outros sprites. Recebeu o caminho {1}, esperando {2}" + }, + { + "key": "errorTryingToAddSpriteToRenamer", + "value": "Tentando adicionar o Sprite para SpriteRenamer ao caminho {0}, mas nenhum arquivo Meta existe no caminho especificado." + }, + { + "key": "errorPresetNameAlreadyExists", + "value": "A predefinicão com nome \"{0}\" já existe. Você deseja substituir?" + }, + { + "key": "no", + "value": "Não" + }, + { + "key": "save", + "value": "Salvar" + }, + { + "key": "errorTryintToGetOriginalName", + "value": "Tentando obter o nome original para RenameResultSequence no index que está fora dos limits. Index: {0}" + }, + { + "key": "errorTryingToGetOriginalNameOutOfBounds", + "value": "Tentando obter o nome original para RenameResultSequence no index que está fora dos limits. Index: {0}" + }, + { + "key": "add", + "value": "Adicionar" + }, + { + "key": "prefixOrSuffix", + "value": "Prefixo ou Sufixo" + }, + { + "key": "stringSequence", + "value": "Sequência de String" + }, + { + "key": "modify", + "value": "Modificar" + }, + { + "key": "changeCase", + "value": "Mudar Case" + }, + { + "key": "countByLetter", + "value": "Contar por Letra" + }, + { + "key": "enumerate", + "value": "Enumerar" + }, + { + "key": "delete", + "value": "Deletar" + }, + { + "key": "replace", + "value": "Substituir" + }, + { + "key": "replaceString", + "value": "Substituir String" + }, + { + "key": "trimCharacters", + "value": "Aparar caracteres" + }, + { + "key": "preset", + "value": "Predefinição" + }, + { + "key": "savedPresets", + "value": "Predefinições Salvas" + }, + { + "key": "errorNoSavedPresets", + "value": "Você não tem nenhuma operação Rename salvas nas predefinições. Selecione 'Salvar como...' no menu \"Predefinições\" para criar uma nova predefinicão" + }, + { + "key": "areYouSureDelete", + "value": "Você tem certeza que quer deletar a predefinicão \"{0}\"" + }, + { + "key": "deletePreset", + "value": "Deletar Predefinição" + }, + { + "key": "removeCharacters", + "value": "Remover Caracteres" + }, + { + "key": "bulkRename", + "value": "Renomear em massa" + }, + { + "key": "renamingObjectXofY", + "value": "Renomeando objeto {0} de {1}" + }, + { + "key": "renaming", + "value": "Renomeando" + }, + { + "key": "errorAssetNotBulkRenamed", + "value": "Asset [{0}] não renomeado quando tentando renomear em massa. Pode ser sido cancelado porque um nove nome já foi pego por um objeto no mesmo caminho. O nome nome pode conter caracteres especiais.\n Caminho original: {1}, Novo caminho: {2}" + }, + { + "key": "deleteFromFront", + "value": "Deletar da frente" + }, + { + "key": "deleteFromBack", + "value": "Deletar de trás" + }, + { + "key": "toCamelCase", + "value": "Para Camel Case" + }, + { + "key": "usePascalCasing", + "value": "Usar Pascal Casing" + }, + { + "key": "flagToCapitalizeTheFirstLetterOfname", + "value": "Sinalize para colocar em maiúscula a primeira letra do nome (também conhecida como Upper Camel Casing)." + }, + { + "key": "delimiterCharacters", + "value": "Caracteres delimitadores" + }, + { + "key": "caseSensitiveCharactersIndicateStart", + "value": "Os caracteres que diferenciam maiúsculas de minúsculas que indicam o início de uma palavra." + }, + { + "key": "delimiters", + "value": "Delimitadores" + }, + { + "key": "searchString", + "value": "Procurar String" + }, + { + "key": "useRegex", + "value": "Usar Expressão regular" + }, + { + "key": "matchTermsUsingRegex", + "value": "Correspondência de termos usando Expressões regulares, termos que permitem uma poderosa correspondência de padrões." + }, + { + "key": "matchRegex", + "value": "Correspondência Regex" + }, + { + "key": "regexToUseToMatchTerms", + "value": "Expressão regular a ser usada para corresponder aos termos." + }, + { + "key": "searchForString", + "value": "Procurar por String" + }, + { + "key": "substringsToSeatchInFilenames", + "value": "Substrings a serem pesquisados ​​nos nomes de arquivos. Essas seqüências serão substituídas pela seqüência de substituição." + }, + { + "key": "replaceWith", + "value": "Substituir com" + }, + { + "key": "stringToReplaceMatchingInstances", + "value": "String para substituir instâncias correspondentes da string de Pesquisa." + }, + { + "key": "caseSensitive", + "value": "Sensível a maiúsculas e minúscula" + }, + { + "key": "searchUsingCaseSensitivity", + "value": "Pesquise usando distinção entre maiúsculas e minúsculas. Somente as strings que correspondem à caixa fornecida serão substituídas." + }, + { + "key": "matchExpressNotValid", + "value": "A expressão de correspondência não é uma expressão regular válida." + }, + { + "key": "replacementExpressionNotValid", + "value": "A expressão de substituição não é uma expressão regular válida." + }, + { + "key": "newName", + "value": "Novo Nome" + }, + { + "key": "nameToReplaceTheOldeOne", + "value": "Nome para substituir o antigo." + }, + { + "key": "selectPresetOrSpecifyCharacters", + "value": "Selecione uma predefinição ou especifique seus próprios caracteres." + }, + { + "key": "charactersToRemove", + "value": "Caracteres para Remover." + }, + { + "key": "allCharactersThatWillBeRemoved", + "value": "Todos os caracteres que serão removidos dos nomes." + }, + { + "key": "flagTheSearchToMatchCase", + "value": "Sinalize a pesquisa para corresponder apenas ao caso especificado." + }, + { + "key": "symbols", + "value": "Símbolos" + }, + { + "key": "removeSpecialCharacters", + "value": "Remove caracteres especiais (ex. !@#$%^&*)" + }, + { + "key": "numbers", + "value": "Números" + }, + { + "key": "removeDigits", + "value": "Remove dígitos 0-9" + }, + { + "key": "whitespace", + "value": "Espaço em branco" + }, + { + "key": "removesWhitespace", + "value": "Remove Espaços em branco" + }, + { + "key": "count", + "value": "Contagem" + }, + { + "key": "format", + "value": "Formato" + }, + { + "key": "selectPresetFormat", + "value": "Selecione um formato predefinido ou especifique seu próprio formato." + }, + { + "key": "countFormat", + "value": "Formato de contagem" + }, + { + "key": "theStringFormatToUseWhenAddingTheCountToName", + "value": "O formato da sequência a ser usada ao adicionar a contagem ao nome." + }, + { + "key": "invalidCountFormat", + "value": "Formato de contagem inválido. Os formatos típicos são D1 para um dígito sem zeros à esquerda, D2, para dois etc.\nProcure o método String.Format () para obter mais informações sobre as opções de formatação." + }, + { + "key": "countFrom", + "value": "Contagem de" + }, + { + "key": "theValueToStartCountingFrom", + "value": "O valor para começar a contar. O primeiro objeto terá esse número." + }, + { + "key": "increment", + "value": "Incremento" + }, + { + "key": "theValueToAddToEachObjectWhenCounting", + "value": "O valor a ser adicionado a cada objeto ao contar." + }, + { + "key": "addAsPrefix", + "value": "Adicionar como prefixo" + }, + { + "key": "addTheCountToTheFontOfTheObjectName", + "value": "Adicione a contagem à frente do nome do objeto." + }, + { + "key": "custom", + "value": "Personalizados" + }, + { + "key": "strings", + "value": "Strings" + }, + { + "key": "theStringsOfLettersToAdd", + "value": "As seqüências de letras a serem adicionadas, separadas por vírgula. Ex: \"A, B, C\" anexará A, B e C aos três primeiros objetos, respectivamente. Depois disso, ele adicionará outra sequência, começando com AA, AB, AC, etc." + }, + { + "key": "formatForTheAddedLetters", + "value": "Formato para as letras adicionadas." + }, + { + "key": "theValueToStartCounting", + "value": "O valor para começar a contar. A sequência da sequência nessa contagem será anexada ao primeiro objeto." + }, + { + "key": "startsWith", + "value": "Começa com" + }, + { + "key": "theValueToAddToTheCount", + "value": "The value to add to the count after naming an object." + }, + { + "key": "addTheCountToTheFront", + "value": "O valor a ser adicionado à contagem após nomear um objeto." + }, + { + "key": "uppercaseAlphabet", + "value": "Alfabeto em Maiúsculas" + }, + { + "key": "lowercaseAlphabet", + "value": "Alfabeto em Minúsculas" + }, + { + "key": "toUpperOrLowercase", + "value": "Para Maiúsculas ou Minúsculas" + }, + { + "key": "toUppercase", + "value": "Para maiúsculas" + }, + { + "key": "newCasing", + "value": "Nova Caixa" + }, + { + "key": "theDesiredCasingForName", + "value": "A Caixa desejada para o novo nome." + }, + { + "key": "onlyFirstCharacter", + "value": "Apenas o Primeiro Caractere" + }, + { + "key": "changeOnlyTheFirstCharacterCase", + "value": "Mude apenas o caso do primeiro caractere." + }, + { + "key": "addStringSequence", + "value": "Adicionar sequência de strings" + }, + { + "key": "sequence", + "value": "Sequência" + }, + { + "key": "theSequenceOfStringsToAddCommaSeparted", + "value": "A sequência de sequências a serem adicionadas, separadas por vírgula." + }, + { + "key": "addTheCountToTheFrontOfTheObjectName", + "value": "Adicione a contagem à frente do nome do objeto." + }, + { + "key": "addPrefixOrSuffix", + "value": "Adicionar prefixo ou sufixo" + }, + { + "key": "suffix", + "value": "Sufixo" + }, + { + "key": "replacementString", + "value": "Substituição de String" + }, + { + "key": "preferenceWindowTitle", + "value": "Preferências do Mulligan Renamer" + }, + { + "key": "preferencesMenuItem", + "value": "Mulligan Renamer" + }, + { + "key": "preferencesDiffLabel", + "value": "Cores de Diff" + }, + { + "key": "preferencesInsertionText", + "value": "Inserção de texto" + }, + { + "key": "preferencesInsertionBackground", + "value": "Inserção de fundo" + }, + { + "key": "preferencesDeletionText", + "value": "Eliminação de texto" + }, + { + "key": "preferencesDeletionBackground", + "value": "Elimninação de fundo" + }, + { + "key": "preferencesReset", + "value": "Restaurar ao padrão" + }, + { + "key": "preferences", + "value": "Preferências" + }, + { + "key": "exampleThisIs", + "value": "Esse é" + }, + { + "key": "exampleSampleText", + "value": "um texto exemplo" + }, + { + "key": "exampleWithWords", + "value": "com palavras" + }, + { + "key": "exampleInserted", + "value": "inseridas" + }, + { + "key": "exampleDeleted", + "value": "eliminadas" + }, + { + "key": "adjustNumbers", + "value": "Ajustar números" + }, + { + "key": "Lowercase", + "value": "Caixa baixa" + }, + { + "key": "Uppercase", + "value": "Caixa alta" + }, + { + "key": "offset", + "value": "Compensar" + }, + { + "key": "updateLanguages", + "value": "Atualizar Idiomas" + }, + { + "key": "languageUpdateProgressTitle", + "value": "Updating Languages" + }, + { + "key": "languageUpdateProgressMessage1", + "value": "Checking for language updates..." + }, + { + "key": "languageUpdateDownloadingLanguages", + "value": "Downloading language {0}..." + }, + { + "key": "languageUpdateSavingChanges", + "value": "Saving Changes..." + }, + { + "key": "languageUpdateProgressTitleSuccess", + "value": "Languages Successfully Updated" + }, + { + "key": "ok", + "value": "OK" + }, + { + "key": "languageUpdateProgressTitleFail", + "value": "Language Update Failed" + }, + { + "key": "languageUpdateTimeout", + "value": "Update failed due to web request timeout. If you have internet, our servers may be down. Please try again later, or report a bug (see UserManual for details) if the issue persists." + }, + { + "key": "languageUpdateFail", + "value": "Update failed. Please report a bug (see UserManual for details). FailCode: {0}, Message: {1}." + }, + { + "key": "languageUpdated", + "value": "Updated {0} from version {1} to {2}" + }, + { + "key": "languageAdded", + "value": "Added {0}." + }, + { + "key": "languageUnchanged", + "value": "{0} is up to date." + }, + { + "key": "languageAllUpToDate", + "value": "All languages are up to date." + } + ] } \ No newline at end of file diff --git a/Assets/RedBlueGames/MulliganRenamer/Editor/mulligan_languages.json b/Assets/RedBlueGames/MulliganRenamer/Editor/mulligan_languages.json new file mode 100644 index 0000000..13e39df --- /dev/null +++ b/Assets/RedBlueGames/MulliganRenamer/Editor/mulligan_languages.json @@ -0,0 +1,6 @@ +{ + "languageUrls": [ + "en", + "fr" + ] +} \ No newline at end of file diff --git a/Assets/RedBlueGames/MulliganRenamer/Editor/mulligan_languages.json.meta b/Assets/RedBlueGames/MulliganRenamer/Editor/mulligan_languages.json.meta new file mode 100644 index 0000000..d32be07 --- /dev/null +++ b/Assets/RedBlueGames/MulliganRenamer/Editor/mulligan_languages.json.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: d9cc19f916098418ca81a14b6d074e87 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/RedBlueGames/MulliganRenamer/Tests/Editor/JSONRetrieverTests.cs b/Assets/RedBlueGames/MulliganRenamer/Tests/Editor/JSONRetrieverTests.cs new file mode 100644 index 0000000..89bb5dd --- /dev/null +++ b/Assets/RedBlueGames/MulliganRenamer/Tests/Editor/JSONRetrieverTests.cs @@ -0,0 +1,155 @@ +/* MIT License + +Copyright (c) 2016 Edward Rowe, RedBlueGames + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + +namespace RedBlueGames.MulliganRenamer +{ + using System.Collections; + using UnityEngine; + using UnityEngine.TestTools; + using NUnit.Framework; + + public class JSONRetrieverTests + { + [UnityTest] + public IEnumerator GetJSON_ValidURLValidJSON_ReturnsExpected() + { + // Assemble + var simpleJson = new SimpleJson(); + simpleJson.AnInt = 5; + + // Act + var mockWebRequest = new MockWebRequest("{ \"anInt\": 5}"); + var getter = new JSONRetrieverWeb(mockWebRequest); + var op = getter.GetJSON(1); + yield return op.WaitForResult(1.5f, () => Assert.Fail("Test timed out. AsyncOp never returned a Status besides Pending.")); + + Assert.AreEqual(AsyncStatus.Success, op.Status); + Assert.AreEqual(simpleJson.AnInt, op.ResultData.AnInt); + } + + [Test] + public void GetJSON_InvalidURI_ThrowsBadURI() + { + Assert.Throws(() => new JSONRetrieverWeb("InvalidUri")); + } + + [UnityTest] + public IEnumerator GetJSON_InvalidJSON_ThrowsBadJSON() + { + // Assemble + var badJson = "{ \"anIntWithNoValue\" } "; + + // Act + var mockWebRequest = new MockWebRequest(badJson); + var getter = new JSONRetrieverWeb(mockWebRequest); + //Assert.Throws(() => getter.GetJSON(1), "Expected ArgumentException due to invalid Json format."); + var op = getter.GetJSON(1); + yield return op.WaitForResult(1.5f, () => Assert.Fail("Unexpected timeout. Test timed out, expected InvalidJSON exception")); + + Assert.AreEqual(AsyncStatus.Failed, op.Status); + Assert.AreEqual(JSONRetrieverWeb.ErrorCodeInvalidJsonFormat, op.FailureCode); + } + + [UnityTest] + public IEnumerator GetJSON_Timeout_ReportsTimeout() + { + // Assemble + // Act + var mockTimeout = new MockWebRequestTimeout(); + var getter = new JSONRetrieverWeb(mockTimeout); + var op = getter.GetJSON(1); + yield return op.WaitForResult(1.5f, () => Assert.Fail("Unexpected timeout. JsonRetrieverWeb should have sent a timeout, but did not.")); + + Assert.AreEqual(AsyncStatus.Timeout, op.Status); + } + + [UnityTest] + public IEnumerator GetJSON_HttpError_ReportsFail() + { + // Assemble + // Act + var mockHttpError = new MockWebRequestHttpError(); + var getter = new JSONRetrieverWeb(mockHttpError); + var op = getter.GetJSON(1); + yield return op.WaitForResult(1.5f, () => Assert.Fail("Unexpected timeout. JsonRetrieverWeb should have sent a failure, but did not.")); + + Assert.AreEqual(AsyncStatus.Failed, op.Status); + } + + [UnityTest] + public IEnumerator GetJSON_NetworkError_Fails() + { + // Assemble + // Act + var mockError = new MockWebRequestNetworkError(); + var getter = new JSONRetrieverWeb(mockError); + var op = getter.GetJSON(1); + yield return op.WaitForResult(1.5f, () => Assert.Fail("Unexpected timeout. JsonRetrieverWeb should have sent a failure, but did not.")); + + Assert.AreEqual(AsyncStatus.Failed, op.Status); + } + + [UnityTest] + public IEnumerator GetJSON_ReuseRetriever_ReturnsSameResultTwice() + { + // Assemble + var simpleJson = new SimpleJson(); + simpleJson.AnInt = 3; + + // Act + var mockWebRequest = new MockWebRequest("{ \"anInt\": 3}"); + var getter = new JSONRetrieverWeb(mockWebRequest); + var op = getter.GetJSON(1); + yield return op.WaitForResult(1.5f, () => Assert.Fail("Test timed out on first Get. AsyncOp never returned a Status besides Pending.")); + + Assert.AreEqual(AsyncStatus.Success, op.Status); + Assert.AreEqual(simpleJson.AnInt, op.ResultData.AnInt); + + var op2 = getter.GetJSON(1); + yield return op2.WaitForResult(1.5f, () => Assert.Fail("Test timed out on second Get. AsyncOp never returned a Status besides Pending.")); + + Assert.AreEqual(AsyncStatus.Success, op.Status); + Assert.AreEqual(simpleJson.AnInt, op.ResultData.AnInt); + } + + [System.Serializable] + public class SimpleJson + { + [SerializeField] + private int anInt; + + public int AnInt + { + get + { + return this.anInt; + } + + set + { + this.anInt = value; + } + } + } + } +} \ No newline at end of file diff --git a/Assets/RedBlueGames/MulliganRenamer/Tests/Editor/JSONRetrieverTests.cs.meta b/Assets/RedBlueGames/MulliganRenamer/Tests/Editor/JSONRetrieverTests.cs.meta new file mode 100644 index 0000000..eb72165 --- /dev/null +++ b/Assets/RedBlueGames/MulliganRenamer/Tests/Editor/JSONRetrieverTests.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 6ae3d0868033f44cc96862343eb1f35b +timeCreated: 1480087188 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/RedBlueGames/MulliganRenamer/Tests/Editor/LocaleLanguageTests.cs b/Assets/RedBlueGames/MulliganRenamer/Tests/Editor/LanguageTests.cs similarity index 85% rename from Assets/RedBlueGames/MulliganRenamer/Tests/Editor/LocaleLanguageTests.cs rename to Assets/RedBlueGames/MulliganRenamer/Tests/Editor/LanguageTests.cs index 66c0f26..0e14195 100644 --- a/Assets/RedBlueGames/MulliganRenamer/Tests/Editor/LocaleLanguageTests.cs +++ b/Assets/RedBlueGames/MulliganRenamer/Tests/Editor/LanguageTests.cs @@ -26,31 +26,31 @@ namespace RedBlueGames.MulliganRenamer using System.Collections.Generic; using NUnit.Framework; - public class LocaleLanguageTests + public class LanguageTests { - private List allResourceLanguages; + private List allResourceLanguages; [SetUp] public void Init() { - this.allResourceLanguages = LocaleManager.LoadAllLanguages(); + this.allResourceLanguages = LocalizationManager.LoadAllLanguages(); } [Test] - public void CheckAllLanguageKeys_WithEnglish() + public void CheckAllLanguages_ForMatchingEnglishElement() { - var englishLanguage = this.allResourceLanguages.Find(x => x.LanguageKey == "en"); + var englishLanguage = this.allResourceLanguages.Find(x => x.Key == "en"); foreach (var language in this.allResourceLanguages) { - if (language.LanguageKey == "en") + if (language.Key == "en") continue; foreach (var englishElement in englishLanguage.Elements) { Assert.That( language.Elements.Exists(x => x.Key == englishElement.Key), - "Language " + language.LanguageName + " does not contain key \"" + englishElement.Key + + "Language " + language.Name + " does not contain key \"" + englishElement.Key + "\". Please add an element with this key to the language."); } } @@ -64,7 +64,7 @@ public void CheckAllLanguages_HasValue() foreach (var element in language.Elements) { Assert.That(!string.IsNullOrEmpty(element.Value), - "Language " + language.LanguageName + " does not contain a value for key \"" + element.Key + + "Language " + language.Name + " does not contain a value for key \"" + element.Key + "\". Please add a value to the language."); } } @@ -95,7 +95,7 @@ public void AllKeysInProject_ExistInAllLanguages() Assert.That( language.Elements.Exists(x => x.Key == scriptKeyPair.Key), "Script \"" + scriptKeyPair.ScriptName + "\" tries to access key \"" + scriptKeyPair.Key + - "\" from Language " + language.LanguageName + " but it could not be found." + + "\" from Language " + language.Name + " but it could not be found." + "Please add an element with this key to the language, or remove the GetTranslation call."); } } diff --git a/Assets/RedBlueGames/MulliganRenamer/Tests/Editor/LocaleLanguageTests.cs.meta b/Assets/RedBlueGames/MulliganRenamer/Tests/Editor/LanguageTests.cs.meta similarity index 100% rename from Assets/RedBlueGames/MulliganRenamer/Tests/Editor/LocaleLanguageTests.cs.meta rename to Assets/RedBlueGames/MulliganRenamer/Tests/Editor/LanguageTests.cs.meta diff --git a/Assets/RedBlueGames/MulliganRenamer/Tests/Editor/LocalizationManagerTests.cs b/Assets/RedBlueGames/MulliganRenamer/Tests/Editor/LocalizationManagerTests.cs new file mode 100644 index 0000000..901e2b1 --- /dev/null +++ b/Assets/RedBlueGames/MulliganRenamer/Tests/Editor/LocalizationManagerTests.cs @@ -0,0 +1,71 @@ +/* MIT License + +Copyright (c) 2020 Murillo Pugliesi Lopes, https://github.com/Mukarillo + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + +namespace RedBlueGames.MulliganRenamer +{ + using NUnit.Framework; + using System; + + public class LocalizationManagerTests + { + private Language languageBeforeTest; + + [SetUp] + public void Init() + { + this.languageBeforeTest = LocalizationManager.Instance.CurrentLanguage; + } + + [TearDown] + public void Cleanup() + { + LocalizationManager.Instance.ChangeLanguage(this.languageBeforeTest.Key); + } + + [Test] + public void ChangeLanguage_GoodKey_Changes() + { + foreach (var language in LocalizationManager.Instance.AllLanguages) + { + LocalizationManager.Instance.ChangeLanguage(language.Key); + + Assert.That( + language.Key.Equals(LocalizationManager.Instance.CurrentLanguage.Key), + "LocalizationManager did not change language to specified language, " + language.Name + "."); + } + } + + [Test] + public void ChangeLanguage_BadKey_DoesNotChange() + { + var oldLanguage = LocalizationManager.Instance.CurrentLanguage; + var receivedLanguageChangedEvent = false; + LocalizationManager.Instance.LanguageChanged += () => receivedLanguageChangedEvent = true; + LocalizationManager.Instance.ChangeLanguage("doesNotExist"); + Assert.AreEqual(oldLanguage, LocalizationManager.Instance.CurrentLanguage, + "LocalizationManager changed language when passed an invalid key. It should remain unchanged."); + Assert.False(receivedLanguageChangedEvent, "LocalizationManager fired off event for langauge changed" + + ", but it should not have changed, or fired the event."); + } + } +} \ No newline at end of file diff --git a/Assets/RedBlueGames/MulliganRenamer/Tests/Editor/LocaleManagerTests.cs.meta b/Assets/RedBlueGames/MulliganRenamer/Tests/Editor/LocalizationManagerTests.cs.meta similarity index 100% rename from Assets/RedBlueGames/MulliganRenamer/Tests/Editor/LocaleManagerTests.cs.meta rename to Assets/RedBlueGames/MulliganRenamer/Tests/Editor/LocalizationManagerTests.cs.meta diff --git a/Assets/RedBlueGames/MulliganRenamer/Tests/Editor/MocksAndUtilities.meta b/Assets/RedBlueGames/MulliganRenamer/Tests/Editor/MocksAndUtilities.meta new file mode 100644 index 0000000..0e747ca --- /dev/null +++ b/Assets/RedBlueGames/MulliganRenamer/Tests/Editor/MocksAndUtilities.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8117a74b8bf7944a992c6152e583fb4d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/RedBlueGames/MulliganRenamer/Tests/Editor/MocksAndUtilities/MockWebRequest.cs b/Assets/RedBlueGames/MulliganRenamer/Tests/Editor/MocksAndUtilities/MockWebRequest.cs new file mode 100644 index 0000000..803d327 --- /dev/null +++ b/Assets/RedBlueGames/MulliganRenamer/Tests/Editor/MocksAndUtilities/MockWebRequest.cs @@ -0,0 +1,66 @@ +namespace RedBlueGames.MulliganRenamer +{ + using System; + using UnityEngine.Networking; + + public class MockWebRequest : IWebRequest, IDisposable + { + private string mockDownloadText; + + public int Timeout { get; set; } + + public bool IsDone { get; private set; } + + public bool IsNetworkError + { + get + { + return false; + } + } + + public bool IsHttpError + { + get + { + return false; + } + } + + public bool IsTimeout + { + get + { + return false; + } + } + + public string ErrorText + { + get + { + return string.Empty; + } + } + + public string DownloadedText { get; private set; } + + public MockWebRequest(string outputText) + { + this.mockDownloadText = outputText; + + // Must SendWebRequest before we should consider it done. + this.IsDone = false; + } + + public void SendWebRequest() + { + this.DownloadedText = this.mockDownloadText; + this.IsDone = true; + } + + public void Dispose() + { + } + } +} \ No newline at end of file diff --git a/Assets/RedBlueGames/MulliganRenamer/Tests/Editor/MocksAndUtilities/MockWebRequest.cs.meta b/Assets/RedBlueGames/MulliganRenamer/Tests/Editor/MocksAndUtilities/MockWebRequest.cs.meta new file mode 100644 index 0000000..28618ba --- /dev/null +++ b/Assets/RedBlueGames/MulliganRenamer/Tests/Editor/MocksAndUtilities/MockWebRequest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2605f1a6b87d34aed881e353a70eb679 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/RedBlueGames/MulliganRenamer/Tests/Editor/MocksAndUtilities/MockWebRequestHttpError.cs b/Assets/RedBlueGames/MulliganRenamer/Tests/Editor/MocksAndUtilities/MockWebRequestHttpError.cs new file mode 100644 index 0000000..83547f4 --- /dev/null +++ b/Assets/RedBlueGames/MulliganRenamer/Tests/Editor/MocksAndUtilities/MockWebRequestHttpError.cs @@ -0,0 +1,60 @@ +namespace RedBlueGames.MulliganRenamer +{ + using System; + + public class MockWebRequestHttpError : IWebRequest, IDisposable + { + public int Timeout { get; set; } + + public bool IsDone { get; private set; } + + public bool IsNetworkError + { + get + { + return false; + } + } + + public bool IsHttpError { get; private set; } + + public bool IsTimeout + { + get + { + return false; + } + } + + public string ErrorText + { + get + { + return "Http error message."; + } + } + + public string DownloadedText + { + get + { + return string.Empty; + } + } + + public MockWebRequestHttpError() + { + this.IsHttpError = false; + } + + public void SendWebRequest() + { + this.IsDone = true; + this.IsHttpError = true; + } + + public void Dispose() + { + } + } +} \ No newline at end of file diff --git a/Assets/RedBlueGames/MulliganRenamer/Tests/Editor/MocksAndUtilities/MockWebRequestHttpError.cs.meta b/Assets/RedBlueGames/MulliganRenamer/Tests/Editor/MocksAndUtilities/MockWebRequestHttpError.cs.meta new file mode 100644 index 0000000..d3a0d9c --- /dev/null +++ b/Assets/RedBlueGames/MulliganRenamer/Tests/Editor/MocksAndUtilities/MockWebRequestHttpError.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d1f4555458d414c7b9a343483742afa3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/RedBlueGames/MulliganRenamer/Tests/Editor/MocksAndUtilities/MockWebRequestNetworkError.cs b/Assets/RedBlueGames/MulliganRenamer/Tests/Editor/MocksAndUtilities/MockWebRequestNetworkError.cs new file mode 100644 index 0000000..bf19d51 --- /dev/null +++ b/Assets/RedBlueGames/MulliganRenamer/Tests/Editor/MocksAndUtilities/MockWebRequestNetworkError.cs @@ -0,0 +1,60 @@ +namespace RedBlueGames.MulliganRenamer +{ + using System; + + public class MockWebRequestNetworkError : IWebRequest, IDisposable + { + public int Timeout { get; set; } + + public bool IsDone { get; private set; } + + public bool IsNetworkError { get; private set; } + + public bool IsHttpError + { + get + { + return false; + } + } + + public bool IsTimeout + { + get + { + return false; + } + } + + public string ErrorText + { + get + { + return "Network error message."; + } + } + + public string DownloadedText + { + get + { + return string.Empty; + } + } + + public MockWebRequestNetworkError() + { + this.IsNetworkError = false; + } + + public void SendWebRequest() + { + this.IsDone = true; + this.IsNetworkError = true; + } + + public void Dispose() + { + } + } +} \ No newline at end of file diff --git a/Assets/RedBlueGames/MulliganRenamer/Tests/Editor/MocksAndUtilities/MockWebRequestNetworkError.cs.meta b/Assets/RedBlueGames/MulliganRenamer/Tests/Editor/MocksAndUtilities/MockWebRequestNetworkError.cs.meta new file mode 100644 index 0000000..08d749b --- /dev/null +++ b/Assets/RedBlueGames/MulliganRenamer/Tests/Editor/MocksAndUtilities/MockWebRequestNetworkError.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a0274b84b7e8e4d6699e5ac7972ef733 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/RedBlueGames/MulliganRenamer/Tests/Editor/MocksAndUtilities/MockWebRequestTimeout.cs b/Assets/RedBlueGames/MulliganRenamer/Tests/Editor/MocksAndUtilities/MockWebRequestTimeout.cs new file mode 100644 index 0000000..f24d988 --- /dev/null +++ b/Assets/RedBlueGames/MulliganRenamer/Tests/Editor/MocksAndUtilities/MockWebRequestTimeout.cs @@ -0,0 +1,64 @@ +namespace RedBlueGames.MulliganRenamer +{ + using System; + + public class MockWebRequestTimeout : IWebRequest, IDisposable + { + public int Timeout { get; set; } + + public bool IsDone { get; private set; } + + public bool IsNetworkError + { + get + { + return true; + } + } + + public bool IsHttpError + { + get + { + return false; + } + } + + public bool IsTimeout + { + get + { + return true; + } + } + + public string ErrorText + { + get + { + return "Timeout message"; + } + } + + public string DownloadedText + { + get + { + return string.Empty; + } + } + + public MockWebRequestTimeout() + { + } + + public void SendWebRequest() + { + this.IsDone = true; + } + + public void Dispose() + { + } + } +} \ No newline at end of file diff --git a/Assets/RedBlueGames/MulliganRenamer/Tests/Editor/MocksAndUtilities/MockWebRequestTimeout.cs.meta b/Assets/RedBlueGames/MulliganRenamer/Tests/Editor/MocksAndUtilities/MockWebRequestTimeout.cs.meta new file mode 100644 index 0000000..8641aaf --- /dev/null +++ b/Assets/RedBlueGames/MulliganRenamer/Tests/Editor/MocksAndUtilities/MockWebRequestTimeout.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 32ecbef92b2f541c3a35d4c230a9e60b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/RedBlueGames/MulliganRenamer/Tests/Editor/RBStopwatch.cs b/Assets/RedBlueGames/MulliganRenamer/Tests/Editor/MocksAndUtilities/RBStopwatch.cs similarity index 100% rename from Assets/RedBlueGames/MulliganRenamer/Tests/Editor/RBStopwatch.cs rename to Assets/RedBlueGames/MulliganRenamer/Tests/Editor/MocksAndUtilities/RBStopwatch.cs diff --git a/Assets/RedBlueGames/MulliganRenamer/Tests/Editor/RBStopwatch.cs.meta b/Assets/RedBlueGames/MulliganRenamer/Tests/Editor/MocksAndUtilities/RBStopwatch.cs.meta similarity index 100% rename from Assets/RedBlueGames/MulliganRenamer/Tests/Editor/RBStopwatch.cs.meta rename to Assets/RedBlueGames/MulliganRenamer/Tests/Editor/MocksAndUtilities/RBStopwatch.cs.meta diff --git a/LanguageBookmarks.json b/LanguageBookmarks.json new file mode 100644 index 0000000..f82d26e --- /dev/null +++ b/LanguageBookmarks.json @@ -0,0 +1,7 @@ +{ + "languageUrls": + [ + "https://raw.githubusercontent.com/redbluegames/unity-mulligan-renamer/languages-from-web-tested/Assets/RedBlueGames/MulliganRenamer/Editor/Resources/MulliganLanguages/en.json", + "https://raw.githubusercontent.com/redbluegames/unity-mulligan-renamer/languages-from-web-tested/Assets/RedBlueGames/MulliganRenamer/Editor/Resources/MulliganLanguages/pt.json" + ] +} \ No newline at end of file