From f48d07189efd42f1d61ce230e057a355a8b0ad4c Mon Sep 17 00:00:00 2001 From: Mladen Jablanovic Date: Mon, 10 Feb 2025 16:41:59 +0100 Subject: [PATCH] Code cleanup, add link to connected tables --- Editor/PhraseClient.cs | 1 - Editor/PhraseProvider.cs | 14 ++++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Editor/PhraseClient.cs b/Editor/PhraseClient.cs index 712b92f..4542293 100644 --- a/Editor/PhraseClient.cs +++ b/Editor/PhraseClient.cs @@ -119,7 +119,6 @@ public PhraseClient(PhraseProvider provider) { this.Provider = provider; this.Client = new HttpClient(new RetryHandler(new HttpClientHandler(), provider)); - // Client.DefaultRequestHeaders.Add("Authorization", "Bearer " + AccessToken); Client.DefaultRequestHeaders.Add("User-Agent", $"Unity Plugin/{Version}"); Client.BaseAddress = new Uri(ApiUrl); } diff --git a/Editor/PhraseProvider.cs b/Editor/PhraseProvider.cs index 3419cf4..3a0bf72 100644 --- a/Editor/PhraseProvider.cs +++ b/Editor/PhraseProvider.cs @@ -143,7 +143,6 @@ public IEnumerator FetchProjectsAsync() public void FetchProjects() { EditorCoroutineUtility.StartCoroutineOwnerless(FetchProjectsAsync()); - // FetchLocales(); } public IEnumerator FetchLocalesAsync() @@ -271,7 +270,6 @@ public IEnumerator PushAll(List collections) var matchingStringTable = collection.StringTables.FirstOrDefault(st => st.LocaleIdentifier.Code == locale.code); if (matchingStringTable == null) { - // Debug.LogError("No matching string table found for locale " + locale.code); break; } const string dir = "Temp/"; @@ -289,7 +287,6 @@ public IEnumerator PushAll(List collections) collectionsIndex++; } EditorUtility.ClearProgressBar(); - // EditorUtility.DisplayDialog("Push complete", $"{count} locale(s) from {collections.Count} table collection(s) pushed.", "OK"); } public void PullAll() @@ -576,7 +573,7 @@ private void ShowLocalLocaleMissingSection() if (phraseProvider.MissingLocalesLocally().Count > 0) { EditorGUILayout.BeginHorizontal(); - GUILayout.Label("Locales missing in Unity"); + GUILayout.Label("Missing in Unity"); if(GUILayout.Button($"{selectedLocalesToCreateLocally.Count}/{phraseProvider.MissingLocalesLocally().Count} selected", GUILayout.Width(150))) { m_showLocalLocalesMissing = !m_showLocalLocalesMissing; @@ -658,7 +655,7 @@ private void ShowRemoteLocaleMissingSection() { EditorGUI.indentLevel++; EditorGUILayout.BeginHorizontal(); - GUILayout.Label("Locales missing in Phrase"); + GUILayout.Label("Missing in Phrase"); if(GUILayout.Button($"{selectedLocalesToCreateRemotely.Count}/{phraseProvider.MissingLocalesRemotely().Count} selected", GUILayout.Width(150))) { m_showRemoteLocalesMissing = !m_showRemoteLocalesMissing; @@ -742,11 +739,17 @@ private void ShowConnectedTablesSection() { var extension = collection.Extensions.FirstOrDefault(e => e is PhraseExtension) as PhraseExtension; bool selectedState = extension != null && extension.m_provider != null; + EditorGUILayout.BeginHorizontal(); bool newSelectedState = EditorGUILayout.ToggleLeft(collection.name, selectedState); + if (GUILayout.Button("Go to", GUILayout.Width(50))) + { + Selection.activeObject = collection; + } if (newSelectedState != selectedState) { TogglePhraseExtension(collection, newSelectedState); } + EditorGUILayout.EndHorizontal(); } } EditorGUI.indentLevel--; @@ -793,7 +796,6 @@ private void ShowPushSection() if (GUILayout.Button("Push to Phrase", GUILayout.Width(150))) { EditorCoroutineUtility.StartCoroutineOwnerless(phraseProvider.PushAll(PhraseProvider.ConnectedStringTableCollections())); - // phraseProvider.PushAll(); } EditorGUILayout.EndHorizontal();