fastlane-plugin-google_sheet_localize 0.1.83 → 0.1.90
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c477b09125bf963ad1cba7d7baf0a47ddd3f142945e7b13661f66a35eb10fc56
|
4
|
+
data.tar.gz: 0debc49b63334226bbdeb5b66c218e94f36e5ae4035c56ff6fde94044d20d0f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f197744c24c25e4774f6d7be02b74fe358809952bf82b7613aa08bce1b759c7a1508f701ce7074401e6e446027708ac72917962bcd14e3035cffabfbe7ca0c6d
|
7
|
+
data.tar.gz: 97b2dedf9ba84b33735adcf5f30bb243acbdca2bddd5fdc262f4010d27ffd1ab5b2198f3d3ab1e34bf31fe5e00c2ad67ddeb53af7867435a9252df5d6e1cfcc6
|
@@ -156,7 +156,8 @@ module Fastlane
|
|
156
156
|
|
157
157
|
filteredItems = self.filterUnusedRows(language["items"],'identifierIos')
|
158
158
|
|
159
|
-
|
159
|
+
stringFileName = "Localizable.strings"
|
160
|
+
pluralsFileName = "Plurals.stringsdict"
|
160
161
|
|
161
162
|
languageName = language['language']
|
162
163
|
|
@@ -164,9 +165,11 @@ module Fastlane
|
|
164
165
|
languageName = "Base"
|
165
166
|
end
|
166
167
|
|
167
|
-
|
168
|
+
stringFilepath = "#{destinationPath}/#{languageName}.lproj/#{filename}"
|
169
|
+
pluralsFilepath = "#{destinationPath}/#{languageName}.lproj/#{pluralsFileName}"
|
168
170
|
FileUtils.mkdir_p "#{destinationPath}/#{languageName}.lproj"
|
169
|
-
|
171
|
+
|
172
|
+
File.open(stringFilepath, "w") do |f|
|
170
173
|
filteredItems.each_with_index { |item, index|
|
171
174
|
|
172
175
|
text = self.mapInvalidPlaceholder(item['text'])
|
@@ -178,6 +181,44 @@ module Fastlane
|
|
178
181
|
line = "\n\n#{identifier}\n"
|
179
182
|
else
|
180
183
|
|
184
|
+
if !text.include?("one|")
|
185
|
+
|
186
|
+
if text == "" || text == "TBD"
|
187
|
+
default_language_object = languages.select { |languageItem| languageItem['language'] == defaultLanguage }.first["items"]
|
188
|
+
default_language_object = self.filterUnusedRows(default_language_object,'identifierIos')
|
189
|
+
|
190
|
+
defaultLanguageText = default_language_object[index]['text']
|
191
|
+
puts "found empty text for:\n\tidentifier: #{identifier}\n\tlanguage:#{language['language']}\n\treplacing it with: #{defaultLanguageText}"
|
192
|
+
text = self.mapInvalidPlaceholder(defaultLanguageText)
|
193
|
+
end
|
194
|
+
|
195
|
+
line = "\"#{identifier}\" = \"#{text}\";"
|
196
|
+
if !comment.to_s.empty?
|
197
|
+
line = line + " //#{comment}\n"
|
198
|
+
else
|
199
|
+
line = line + "\n"
|
200
|
+
end
|
201
|
+
end
|
202
|
+
end
|
203
|
+
f.write(line)
|
204
|
+
}
|
205
|
+
end
|
206
|
+
|
207
|
+
File.open(pluralsFilepath, "w") do |f|
|
208
|
+
|
209
|
+
f.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<plist version=\"1.0\">\n<dict>")
|
210
|
+
f.write("<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n")
|
211
|
+
f.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n")
|
212
|
+
f.write("<plist version=\"1.0\">\n")
|
213
|
+
f.write("<dict>\n")
|
214
|
+
|
215
|
+
filteredItems.each_with_index { |item, index|
|
216
|
+
|
217
|
+
text = self.mapInvalidPlaceholder(item['text'])
|
218
|
+
identifier = item['identifierIos']
|
219
|
+
|
220
|
+
line = ""
|
221
|
+
if !identifier.include?('//') && text.include?("one|")
|
181
222
|
if text == "" || text == "TBD"
|
182
223
|
default_language_object = languages.select { |languageItem| languageItem['language'] == defaultLanguage }.first["items"]
|
183
224
|
default_language_object = self.filterUnusedRows(default_language_object,'identifierIos')
|
@@ -187,16 +228,32 @@ module Fastlane
|
|
187
228
|
text = self.mapInvalidPlaceholder(defaultLanguageText)
|
188
229
|
end
|
189
230
|
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
231
|
+
text = text.gsub("\n", "|")
|
232
|
+
|
233
|
+
f.write("\t\t<key>#{identifier}</key>\n")
|
234
|
+
f.write("\t\t<dict>\n")
|
235
|
+
f.write("\t\t\t<key>NSStringLocalizedFormatKey</key>\n")
|
236
|
+
f.write("\t\t\t<string>%#@#{identifier}@</string>\n")
|
237
|
+
f.write("\t\t\t<key>#{identifier}</key>\n")
|
238
|
+
f.write("\t\t\t<dict>\n")
|
239
|
+
f.write("\t\t\t\t<key>NSStringFormatSpecTypeKey</key>\n")
|
240
|
+
f.write("\t\t\t\t<string>NSStringPluralRuleType</string>\n")
|
241
|
+
f.write("\t\t\t\t<key>NSStringFormatValueTypeKey</key>\n")
|
242
|
+
f.write("\t\t\t\t<string>d</string>\n")
|
243
|
+
|
244
|
+
text.split("|").each_with_index { |word, wordIndex|
|
245
|
+
if wordIndex % 2 == 0
|
246
|
+
f.write("\t\t\t\t<key>#{word}</key>\n")
|
247
|
+
else
|
248
|
+
f.write("\t\t\t\t<string>#{word}</string>\n")
|
249
|
+
end
|
250
|
+
}
|
251
|
+
f.write("\t\t\t</dict>\n")
|
252
|
+
f.write("\t\t</dict>\n")
|
196
253
|
end
|
197
|
-
|
198
|
-
f.write(line)
|
199
254
|
}
|
255
|
+
f.write("</dict>\n")
|
256
|
+
f.write("</plist>\n")
|
200
257
|
end
|
201
258
|
end
|
202
259
|
|