Skip to content

Commit 8f6850e

Browse files
committed
Separate the code scan from the AI fill in the catalog flow
localize_catalog no longer re-runs generate_strings_catalog — scanning the code is its own lane (generate_strings_catalog), so you can refresh the English catalog without ever invoking the AI. The three stages are now independent fastlane invocations: generate_strings_catalog (scan) -> download_catalog_strings (download) -> localize_catalog (fold + AI-fill) localize_catalog errors if the catalog hasn't been generated yet.
1 parent 768a7c5 commit 8f6850e

1 file changed

Lines changed: 10 additions & 11 deletions

File tree

fastlane/lanes/localization_catalog.rb

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -97,27 +97,26 @@
9797
UI.success("Downloaded GlotPress translations for #{locales.values.uniq.size} locale(s). Next: run localize_catalog (same locales:).")
9898
end
9999

100-
# LOCALIZE (steps 1 + 3) — build Localizable.xcstrings from the ALREADY-DOWNLOADED strings: scan the code into
101-
# the English catalog, fold the GlotPress translations in (human => translated), and AI-fill the cells they
102-
# leave empty (=> needs_review). Run `download_catalog_strings` (or `download_localized_strings`) first.
100+
# LOCALIZE (fold + AI-fill) — fill the per-locale translations into the EXISTING Localizable.xcstrings: fold
101+
# the downloaded GlotPress translations in (human => translated), then AI-fill the cells they leave empty
102+
# (=> needs_review). It does NOT scan the code and does NOT download — so each stage is its own invocation:
103+
# generate_strings_catalog (scan) -> download_catalog_strings (download) -> localize_catalog (this).
104+
# Running the scan separately means you can refresh the catalog without ever touching the AI.
103105
#
104106
# Uploading the AI drafts back to GlotPress as needs-review (the eventual "step 4") is a separate step, not
105107
# done here — it builds on the existing GlotPress import integration (cf. gp_update_metadata_source).
106108
#
107109
# STAGED, NOT SHIPPED: Localizable.xcstrings isn't the runtime store yet (the app still ships
108110
# Localizable.strings), so this only pre-populates it for the cutover — it changes nothing users see.
109111
#
110-
# MANUAL ONLY — not wired into download_localized_strings or any CI step: it runs xcstringstool extraction,
111-
# calls the translation API (cost), and commits a large catalog. Set ANTHROPIC_API_KEY for the AI rung; scope
112-
# a cheap run with `locales:fr`.
113-
desc 'Localize step: build Localizable.xcstrings from downloaded strings — scan + fold + AI-fill (staged; manual, not CI)'
112+
# MANUAL ONLY — not wired into download_localized_strings or any CI step: it calls the translation API (cost)
113+
# and commits a large catalog. Set ANTHROPIC_API_KEY for the AI rung; scope a cheap run with `locales:fr`.
114+
desc 'Localize step: fold downloaded GlotPress translations + AI-fill into the existing Localizable.xcstrings (run generate_strings_catalog first)'
114115
lane :localize_catalog do |options|
116+
UI.user_error!("#{LOCALIZABLE_CATALOG} not found — run generate_strings_catalog first") unless File.exist?(LOCALIZABLE_CATALOG)
115117
locales = catalog_target_locales(options[:locales])
116118

117-
# 1. Scan the code into the English catalog (create / update + reconcile changed sources).
118-
generate_strings_catalog
119-
120-
# Fold the downloaded human translations in (=> translated), then (3) AI-fill the cells they leave empty.
119+
# Fold the downloaded human translations in (=> translated), then AI-fill the cells they leave empty.
121120
catalog = JSON.parse(File.read(LOCALIZABLE_CATALOG))
122121
written = CatalogStrings.fold_translations!(
123122
catalog,

0 commit comments

Comments
 (0)