|
97 | 97 | UI.success("Downloaded GlotPress translations for #{locales.values.uniq.size} locale(s). Next: run localize_catalog (same locales:).") |
98 | 98 | end |
99 | 99 |
|
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. |
103 | 105 | # |
104 | 106 | # Uploading the AI drafts back to GlotPress as needs-review (the eventual "step 4") is a separate step, not |
105 | 107 | # done here — it builds on the existing GlotPress import integration (cf. gp_update_metadata_source). |
106 | 108 | # |
107 | 109 | # STAGED, NOT SHIPPED: Localizable.xcstrings isn't the runtime store yet (the app still ships |
108 | 110 | # Localizable.strings), so this only pre-populates it for the cutover — it changes nothing users see. |
109 | 111 | # |
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)' |
114 | 115 | lane :localize_catalog do |options| |
| 116 | + UI.user_error!("#{LOCALIZABLE_CATALOG} not found — run generate_strings_catalog first") unless File.exist?(LOCALIZABLE_CATALOG) |
115 | 117 | locales = catalog_target_locales(options[:locales]) |
116 | 118 |
|
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. |
121 | 120 | catalog = JSON.parse(File.read(LOCALIZABLE_CATALOG)) |
122 | 121 | written = CatalogStrings.fold_translations!( |
123 | 122 | catalog, |
|
0 commit comments