From ceddb064c7486793f4fe7ec7359a3d9ce925d75f Mon Sep 17 00:00:00 2001 From: Mladen Jablanovic Date: Tue, 4 Feb 2025 13:59:08 +0100 Subject: [PATCH] Use locale name when pushing to Phrase --- Editor/PhraseClient.cs | 4 ++-- Editor/PhraseProvider.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Editor/PhraseClient.cs b/Editor/PhraseClient.cs index bc78ead..1467081 100644 --- a/Editor/PhraseClient.cs +++ b/Editor/PhraseClient.cs @@ -173,7 +173,7 @@ public async void UpdateProjectsList(List projects) } while (currentBatch.Count == 100); // Continue if a full batch is returned } - public async void UploadFile(string path, string projectID, string localeID, string localeCode, bool autoTranslate, string tag) + public async void UploadFile(string path, string projectID, string localeID, string localeName, bool autoTranslate, string tag) { string url = string.Format("projects/{0}/uploads", projectID); NameValueCollection nvc = new NameValueCollection @@ -182,7 +182,7 @@ public async void UploadFile(string path, string projectID, string localeID, str { "file_format", "csv" }, { "update_descriptions", "true" }, { "update_translations", "true" }, - { $"locale_mapping[{localeCode}]", "4" }, + { $"locale_mapping[{localeName}]", "4" }, { "format_options[key_index]", "1" }, { "format_options[comment_index]", "2" }, { "format_options[max_characters_allowed_column]", "3" }, diff --git a/Editor/PhraseProvider.cs b/Editor/PhraseProvider.cs index f7def50..2f1651d 100644 --- a/Editor/PhraseProvider.cs +++ b/Editor/PhraseProvider.cs @@ -275,7 +275,7 @@ public IEnumerator PushAll(List collections) string keyPrefix = phraseExtension.m_identifierType == TableIdentifierType.KeyPrefix ? phraseExtension.m_identifier : null; Csv.Export(stream, collection, ColumnMappings(locale, keyPrefix)); } - Client.UploadFile(path, m_selectedProjectId, locale.id, locale.code, false, tag); + Client.UploadFile(path, m_selectedProjectId, locale.id, locale.name, false, tag); if (File.Exists(path)) File.Delete(path); } } @@ -299,7 +299,7 @@ private List ColumnMappings(Locale locale, string keyPrefix) }, new LocaleColumns { LocaleIdentifier = locale.code, - FieldName = locale.code + FieldName = locale.name }, }; }