From 8a0f14034649e1ba8cd328e483235737bf6ed1d3 Mon Sep 17 00:00:00 2001 From: Till Hellmund Date: Mon, 9 Oct 2023 11:26:48 -0400 Subject: [PATCH] Fix escaping character issue in Lokalise script (#7414) --- scripts/lokalise/lokalise_client.rb | 2 +- scripts/lokalise/string_resources.rb | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/scripts/lokalise/lokalise_client.rb b/scripts/lokalise/lokalise_client.rb index 772c035395f..1d943401075 100644 --- a/scripts/lokalise/lokalise_client.rb +++ b/scripts/lokalise/lokalise_client.rb @@ -42,7 +42,7 @@ def create_key(key_object) "translations": [ { "language_iso": "en", - "translation": key_object[:value], + "translation": key_object[:lokalise_value], "is_reviewed": true, "is_unverified": false, "is_archived": false, diff --git a/scripts/lokalise/string_resources.rb b/scripts/lokalise/string_resources.rb index 6b9cf363f3c..4028ef9db64 100644 --- a/scripts/lokalise/string_resources.rb +++ b/scripts/lokalise/string_resources.rb @@ -80,10 +80,7 @@ def fetch end def escape_for_lokalise(value) - value - # Wrap any placeholders in square brackets - .gsub("%s", "[%s]") - # Wrap any numbered placeholders such as ""%1$s" in square brackets - .gsub(/[%]*[0-9]*[$][s]/) { |value| "[#{value}]" } + # Remove escape characters, as Lokalise doesn't understand them + return value.gsub("\\", "") end end