fastlane-plugin-translate_gpt 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be8140845fda90144346f59a44239c4baa066fc8b75f1afc26655783be3e3686
|
4
|
+
data.tar.gz: 0a39de422d2b3760c4678df1053a61799cd444434399d8f3f0f22a9dfcf261b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a60eb486cf4a385386e429d85d6d53e833ff3afb80c8f60dae482a6596f55fce3218e6268669a4ad4f60e7868244ffaf62a772e2e481fd91e168e18d746f1dd2
|
7
|
+
data.tar.gz: e4a68b0fa334c61c03dc8fdb26fcab4a1310fa9ca877f57522e21d138ea754c937d9ce11263e9dde2d184a23f05d76fc91566c4994167847dd32f2c220bd69a2
|
@@ -109,7 +109,7 @@ module Fastlane
|
|
109
109
|
def prepare_bunch_prompt(strings)
|
110
110
|
prompt = "I want you to act as a translator for a mobile application strings. " + \
|
111
111
|
"Try to keep length of the translated text. " + \
|
112
|
-
"You need to
|
112
|
+
"You need to response with a JSON only with the translation and nothing else until I say to stop it."
|
113
113
|
if @params[:context] && !@params[:context].empty?
|
114
114
|
prompt += "This app is #{@params[:context]}. "
|
115
115
|
end
|
@@ -181,7 +181,13 @@ module Fastlane
|
|
181
181
|
else
|
182
182
|
target_string = response.dig("choices", 0, "message", "content")
|
183
183
|
json_string = target_string[/\[[^\[\]]*\]/m]
|
184
|
-
|
184
|
+
begin
|
185
|
+
json_hash = JSON.parse(json_string)
|
186
|
+
rescue => error
|
187
|
+
UI.error "#{index_log} Error parsing JSON: #{error}"
|
188
|
+
UI.error "#{index_log} JSON: \"#{json_string}\""
|
189
|
+
return
|
190
|
+
end
|
185
191
|
keys_to_translate = json_hash.map { |string_hash| string_hash["key"] }
|
186
192
|
json_hash.each do |string_hash|
|
187
193
|
key = string_hash["key"]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-translate_gpt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aleksei Cherepanov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-08-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-openai
|