fastlane-plugin-translate_gpt 0.1.2 → 0.1.3

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: d78d5a0107d725ae3b713c7e44f1b3aaca9eff005b1d5d2fb7e4ab75dbca40aa
4
- data.tar.gz: 3b45a4747d8222ed5d0d9b7d04f178728e679609940e60dff556cbc7b65e1e99
3
+ metadata.gz: 162ac503b51db5c9395059702dfeedca75cbcd3bb26f68702059f45eb4540ffc
4
+ data.tar.gz: d73722901b8e2d68c3287187687761930962e4392e7016847bfc9946d57c3748
5
5
  SHA512:
6
- metadata.gz: e57f34690dea08a9eb24f7d1f975646c9500fccd983d933ff0b3a8809af91ce3b875e75691dfe7845f9aad88fcaeace425e8ead8dff3e09316c61d03ce5be682
7
- data.tar.gz: e6e76c62b2ac4fe8b3b16d756bdd2acf4adb8d5ed35a626b9c0e5be3fb4e94511868e961f5261570af63640dafe714cf0d47fc8cc69f520b8e5b552ce27f67b2
6
+ metadata.gz: b260653373ca72b56e753aad327338559eeb330e64e602f905720b12d8cb6e6c35d0c5750e8be8199169d41cc7549dc19cd4f30a19caf652465ce3a6d10f54b1
7
+ data.tar.gz: 21df8623e7bce11bf1c3658917dd498bd95929e77236dc32509ca8f3245c8491450cecee1996f2b40147e834aa2a76582facea074dcaa17b8e916a652e964193
@@ -24,19 +24,26 @@ module Fastlane
24
24
  UI.message "Translating #{to_translate.size} strings..."
25
25
 
26
26
  to_translate.each_with_index do |(key, string), index|
27
- prompt = "Translate the following string from #{params[:source_language]} to #{params[:target_language]}: #{string.value}"
27
+ prompt = "I want you to act as a translator for a mobile application strings. " + \
28
+ "You need to answer only with translation and nothing else. No commentaries. " + \
29
+ "Try to keep length of the translated text. " + \
30
+ "I will send you a text and you translate it from #{params[:source_language]} to #{params[:target_language]}. "
31
+ if params[:context] && !params[:context].empty?
32
+ prompt += "This app is #{params[:context]}. "
33
+ end
28
34
  context = string.comment
29
35
  if context && !context.empty?
30
- prompt += "\n\nAdditional context:\n#{context}"
31
- end
32
- if params[:context] && !params[:context].empty?
33
- prompt += "\n\nCommon context:\n#{params[:context]}"
36
+ prompt += "Additional context is #{context}. "
34
37
  end
38
+ prompt += "Source text:\n#{string.value}"
39
+
35
40
  # translate the source string to the target language
36
41
  response = client.chat(
37
42
  parameters: {
38
43
  model: params[:model_name],
39
- messages: [{ role: "user", content: prompt}],
44
+ messages: [
45
+ { role: "user", content: prompt }
46
+ ],
40
47
  temperature: params[:temperature],
41
48
  }
42
49
  )
@@ -97,6 +104,7 @@ module Fastlane
97
104
  key: :request_timeout,
98
105
  env_name: "GPT_REQUEST_TIMEOUT",
99
106
  description: "Timeout for the request in seconds",
107
+ type: Integer,
100
108
  default_value: 30
101
109
  ),
102
110
  FastlaneCore::ConfigItem.new(
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module TranslateGpt
3
- VERSION = "0.1.2"
3
+ VERSION = "0.1.3"
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.2
4
+ version: 0.1.3
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-05-02 00:00:00.000000000 Z
11
+ date: 2023-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-openai
@@ -209,7 +209,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
209
209
  - !ruby/object:Gem::Version
210
210
  version: '0'
211
211
  requirements: []
212
- rubygems_version: 3.4.10
212
+ rubygems_version: 3.4.13
213
213
  signing_key:
214
214
  specification_version: 4
215
215
  summary: This fastlane plugin provides an easy way to use the OpenAI GPT language