Skip to content

Commit 4b08146

Browse files
committed
Quiet xcstringstool output in generate_strings_catalog
The extract/sync sh calls echo enormous commands (up to 400 file paths per extract batch; a --stringsdata <path> pair per file on sync), burying the output. Pass log: false and emit concise progress lines instead. No fastlane/release-toolkit action wraps xcstringstool, so sh is the invocation; log: false is its clean-output option.
1 parent 8f6850e commit 4b08146

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

fastlane/lanes/localization_catalog.rb

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,13 @@ def extract_stringsdata(files:, output_dir:, swiftui: false)
174174
# source basename and only disambiguates collisions WITHIN a single invocation — so two same-named files
175175
# in different chunks (e.g. the two NSDate+Helpers.swift / SupportDataProvider.swift) would otherwise
176176
# overwrite each other in a shared dir and silently drop strings.
177-
files.each_slice(400).with_index do |chunk, index|
177+
batches = files.each_slice(400).to_a
178+
batches.each_with_index do |chunk, index|
178179
chunk_dir = File.join(output_dir, "chunk-#{index}")
179180
FileUtils.mkdir_p(chunk_dir)
180-
sh('xcrun', 'xcstringstool', 'extract', *chunk, *flags, '--output-directory', chunk_dir)
181+
UI.message("Extracting strings… (batch #{index + 1}/#{batches.size})")
182+
# log: false — each command lists up to 400 file paths; echoing them buries the output.
183+
sh('xcrun', 'xcstringstool', 'extract', *chunk, *flags, '--output-directory', chunk_dir, log: false)
181184
end
182185
end
183186

@@ -194,7 +197,9 @@ def sync_localizable_catalog(stringsdata_dir:)
194197
stringsdata = stringsdata_files(stringsdata_dir)
195198
UI.user_error!('xcstringstool produced no .stringsdata') if stringsdata.empty?
196199

197-
sh('xcrun', 'xcstringstool', 'sync', LOCALIZABLE_CATALOG, *stringsdata.flat_map { |f| ['--stringsdata', f] })
200+
UI.message("Syncing #{stringsdata.count} extracted file(s) into #{File.basename(LOCALIZABLE_CATALOG)}…")
201+
# log: false — the command passes a `--stringsdata <path>` pair per file (thousands of args).
202+
sh('xcrun', 'xcstringstool', 'sync', LOCALIZABLE_CATALOG, *stringsdata.flat_map { |f| ['--stringsdata', f] }, log: false)
198203
JSON.parse(File.read(LOCALIZABLE_CATALOG))['strings'].count
199204
end
200205

@@ -229,7 +234,7 @@ def current_english_values(stringsdata_dir)
229234
fresh = File.join(tmp, 'Localizable.xcstrings')
230235
File.write(fresh, "#{JSON.pretty_generate('sourceLanguage' => 'en', 'strings' => {}, 'version' => '1.0')}\n")
231236
stringsdata = stringsdata_files(stringsdata_dir)
232-
sh('xcrun', 'xcstringstool', 'sync', fresh, *stringsdata.flat_map { |f| ['--stringsdata', f] })
237+
sh('xcrun', 'xcstringstool', 'sync', fresh, *stringsdata.flat_map { |f| ['--stringsdata', f] }, log: false)
233238
english_values(JSON.parse(File.read(fresh)))
234239
end
235240
end

0 commit comments

Comments
 (0)