fastlane-plugin-translate_gpt 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c370098458b2bc0d453de5101fa0a1f3273947cd41bc953bb94cf74f5ad58d6f
4
- data.tar.gz: 96cccf7814b8796119d08340cca72089dea6c48a177df111b52bb2b1196ee756
3
+ metadata.gz: be8140845fda90144346f59a44239c4baa066fc8b75f1afc26655783be3e3686
4
+ data.tar.gz: 0a39de422d2b3760c4678df1053a61799cd444434399d8f3f0f22a9dfcf261b0
5
5
  SHA512:
6
- metadata.gz: 5d07f6a7c6a9351b633781d53ddd40e1a432a62bd270d9df8223d40d33b8ae5034123b430db52498a97c462baf5841f7d828df582a9e3cfd4767d83e064ef7ff
7
- data.tar.gz: e5e90093831fa83665f98b302ca433f5e04e5765f74c6a0a0fd5972fcad3dbaf690657e0136acf7ab0f49f253117a5b4deb6ab23b5e209507871b1376d59de2f
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 answer only with the translation and nothing else until I say to stop it."
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
- json_hash = JSON.parse(json_string)
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"]
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module TranslateGpt
3
- VERSION = "0.1.5"
3
+ VERSION = "0.1.6"
4
4
  end
5
5
  end
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.5
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-07-02 00:00:00.000000000 Z
11
+ date: 2023-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-openai