fastlane-plugin-translate 0.3.0 → 0.3.1
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: 84a340dcd01c9646d94cab2d3d5506f5a19aaef2f0eef88002e6d6562d87aa7c
|
|
4
|
+
data.tar.gz: 106704f3f1042b56f6e9a448a15257458db846722f070aa3bb8ce616f6e73499
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e93d40e4ca1fcc375f9bcc216fd60c3135d5db2f7fa0615212b0dfbe5a2003a592410d0c6bfb7dc0b0a9a74628451cd54cc80cf8bba96708f7061dca751f9456
|
|
7
|
+
data.tar.gz: 1a4683fb3b08ef928faae6495b8a86cbc02c4539cb5eebc73c462d4209935508350fc95a211aa57e5284b69be445291c1feb1bfd36e39dc98e3b1710ae53d32f
|
|
@@ -87,19 +87,50 @@ module Fastlane
|
|
|
87
87
|
end
|
|
88
88
|
|
|
89
89
|
def self.setup_deepl_client(params)
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
90
|
+
# If free_api is explicitly set, use that configuration
|
|
91
|
+
if params[:free_api] != nil
|
|
92
|
+
DeepL.configure do |config|
|
|
93
|
+
config.auth_key = params[:api_token]
|
|
94
|
+
config.host = params[:free_api] ? 'https://api-free.deepl.com' : 'https://api.deepl.com'
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
begin
|
|
98
|
+
DeepL.usage
|
|
99
|
+
api_type = params[:free_api] ? 'Free' : 'Pro'
|
|
100
|
+
UI.success("✅ DeepL API key validated (#{api_type} API)")
|
|
101
|
+
return
|
|
102
|
+
rescue DeepL::Exceptions::AuthorizationFailed
|
|
103
|
+
UI.user_error!('❌ Invalid DeepL API key. Get one at: https://www.deepl.com/pro#developer')
|
|
104
|
+
rescue StandardError => e
|
|
105
|
+
UI.user_error!("❌ DeepL API connection failed: #{e.message}")
|
|
106
|
+
end
|
|
93
107
|
end
|
|
94
108
|
|
|
95
|
-
#
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
109
|
+
# Auto-detect: try Pro API first, then Free API
|
|
110
|
+
endpoints = [
|
|
111
|
+
{ host: 'https://api.deepl.com', name: 'Pro' },
|
|
112
|
+
{ host: 'https://api-free.deepl.com', name: 'Free' }
|
|
113
|
+
]
|
|
114
|
+
|
|
115
|
+
endpoints.each_with_index do |endpoint, index|
|
|
116
|
+
DeepL.configure do |config|
|
|
117
|
+
config.auth_key = params[:api_token]
|
|
118
|
+
config.host = endpoint[:host]
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
begin
|
|
122
|
+
DeepL.usage
|
|
123
|
+
UI.success("✅ DeepL API key validated (#{endpoint[:name]} API)")
|
|
124
|
+
UI.message("💡 Tip: You can skip auto-detection by setting free_api: #{endpoint[:name] == 'Free'}") if index > 0
|
|
125
|
+
return
|
|
126
|
+
rescue DeepL::Exceptions::AuthorizationFailed
|
|
127
|
+
# Try next endpoint if this one fails
|
|
128
|
+
next if index < endpoints.length - 1
|
|
129
|
+
# Both endpoints failed
|
|
130
|
+
UI.user_error!('❌ Invalid DeepL API key. Get one at: https://www.deepl.com/pro#developer')
|
|
131
|
+
rescue StandardError => e
|
|
132
|
+
UI.user_error!("❌ DeepL API connection failed: #{e.message}")
|
|
133
|
+
end
|
|
103
134
|
end
|
|
104
135
|
end
|
|
105
136
|
|
|
@@ -56,19 +56,50 @@ module Fastlane
|
|
|
56
56
|
end
|
|
57
57
|
|
|
58
58
|
def self.setup_deepl_client(params)
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
# If free_api is explicitly set, use that configuration
|
|
60
|
+
if params[:free_api] != nil
|
|
61
|
+
DeepL.configure do |config|
|
|
62
|
+
config.auth_key = params[:api_token]
|
|
63
|
+
config.host = params[:free_api] ? 'https://api-free.deepl.com' : 'https://api.deepl.com'
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
begin
|
|
67
|
+
DeepL.usage
|
|
68
|
+
api_type = params[:free_api] ? 'Free' : 'Pro'
|
|
69
|
+
UI.success("✅ DeepL API key validated (#{api_type} API)")
|
|
70
|
+
return
|
|
71
|
+
rescue DeepL::Exceptions::AuthorizationFailed
|
|
72
|
+
UI.user_error!('❌ Invalid DeepL API key. Get one at: https://www.deepl.com/pro#developer')
|
|
73
|
+
rescue StandardError => e
|
|
74
|
+
UI.user_error!("❌ DeepL API connection failed: #{e.message}")
|
|
75
|
+
end
|
|
62
76
|
end
|
|
63
77
|
|
|
64
|
-
#
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
78
|
+
# Auto-detect: try Pro API first, then Free API
|
|
79
|
+
endpoints = [
|
|
80
|
+
{ host: 'https://api.deepl.com', name: 'Pro' },
|
|
81
|
+
{ host: 'https://api-free.deepl.com', name: 'Free' }
|
|
82
|
+
]
|
|
83
|
+
|
|
84
|
+
endpoints.each_with_index do |endpoint, index|
|
|
85
|
+
DeepL.configure do |config|
|
|
86
|
+
config.auth_key = params[:api_token]
|
|
87
|
+
config.host = endpoint[:host]
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
begin
|
|
91
|
+
DeepL.usage
|
|
92
|
+
UI.success("✅ DeepL API key validated (#{endpoint[:name]} API)")
|
|
93
|
+
UI.message("💡 Tip: You can skip auto-detection by setting free_api: #{endpoint[:name] == 'Free'}") if index > 0
|
|
94
|
+
return
|
|
95
|
+
rescue DeepL::Exceptions::AuthorizationFailed
|
|
96
|
+
# Try next endpoint if this one fails
|
|
97
|
+
next if index < endpoints.length - 1
|
|
98
|
+
# Both endpoints failed
|
|
99
|
+
UI.user_error!('❌ Invalid DeepL API key. Get one at: https://www.deepl.com/pro#developer')
|
|
100
|
+
rescue StandardError => e
|
|
101
|
+
UI.user_error!("❌ DeepL API connection failed: #{e.message}")
|
|
102
|
+
end
|
|
72
103
|
end
|
|
73
104
|
end
|
|
74
105
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fastlane-plugin-translate
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tijs Teulings
|
|
@@ -201,7 +201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
201
201
|
- !ruby/object:Gem::Version
|
|
202
202
|
version: '0'
|
|
203
203
|
requirements: []
|
|
204
|
-
rubygems_version: 3.
|
|
204
|
+
rubygems_version: 3.7.2
|
|
205
205
|
specification_version: 4
|
|
206
206
|
summary: Automatically translate iOS Localizable.xcstrings files and App Store metadata
|
|
207
207
|
using DeepL API
|