@@ -139,6 +139,82 @@ jobs:
139139 print("Transifex configuration and all seven builtins mappings validated.")
140140 PY
141141
142+ - name : Diagnose builtins index resource
143+ run : |
144+ python - <<'PY'
145+ import ast
146+ import configparser
147+ from pathlib import Path
148+
149+ config = configparser.ConfigParser()
150+ config.read(".tx/config")
151+
152+ section = "o:python-doc:p:python-newest:r:builtins--index"
153+
154+ if not config.has_section(section):
155+ raise SystemExit(f"ERROR: missing Transifex resource: {section}")
156+
157+ print("=== Generated Transifex mapping ===")
158+ for key in ("file_filter", "source_file", "type", "resource_name"):
159+ print(f"{key} = {config.get(section, key, fallback='<missing>')}")
160+
161+ po_path = Path("builtins/index.po")
162+
163+ if not po_path.is_file():
164+ raise SystemExit(f"ERROR: translation file not found: {po_path}")
165+
166+ print(f"\nTranslation file exists: {po_path}")
167+
168+ entries = []
169+ msgid = None
170+ msgstr = ""
171+ field = None
172+
173+ for line in po_path.read_text(encoding="utf-8").splitlines() + [""]:
174+ if line.startswith("msgid "):
175+ if msgid is not None:
176+ entries.append((msgid, msgstr))
177+ msgid = ast.literal_eval(line[6:])
178+ msgstr = ""
179+ field = "msgid"
180+
181+ elif line.startswith("msgstr "):
182+ msgstr = ast.literal_eval(line[7:])
183+ field = "msgstr"
184+
185+ elif line.startswith('"') and field:
186+ value = ast.literal_eval(line)
187+ if field == "msgid":
188+ msgid += value
189+ else:
190+ msgstr += value
191+
192+ elif not line.strip():
193+ if msgid is not None:
194+ entries.append((msgid, msgstr))
195+ msgid = None
196+ msgstr = ""
197+ field = None
198+
199+ translated = [
200+ (source, target)
201+ for source, target in entries
202+ if source and target.strip()
203+ ]
204+
205+ print(f"Non-empty translated entries: {len(translated)}")
206+
207+ for source, target in translated:
208+ print(f" {source[:100]!r} -> {target[:100]!r}")
209+
210+ if len(translated) < 5:
211+ raise SystemExit(
212+ "ERROR: expected at least five translated entries in builtins/index.po"
213+ )
214+
215+ print("Builtins index diagnostic passed.")
216+ PY
217+
142218 - name : Push Punjabi translations
143219 env :
144220 TX_TOKEN : ${{ secrets.TX_TOKEN }}
@@ -148,6 +224,15 @@ jobs:
148224 --languages "$TX_LANGUAGE" \
149225 --use-git-timestamps
150226
227+ - name : Verify Transifex index resource status
228+ if : always()
229+ env :
230+ TX_TOKEN : ${{ secrets.TX_TOKEN }}
231+ run : |
232+ echo "The push command has finished."
233+ echo "Inspect the preceding Transifex CLI logs for builtins--index."
234+ echo "This step does not independently verify remote translation contents."
235+
151236 push-sources :
152237 name : Generate and push source templates
153238 needs : push-translations
@@ -253,4 +338,4 @@ jobs:
253338 env :
254339 TX_TOKEN : ${{ secrets.TX_TOKEN }}
255340 run : |
256- /usr/local/bin/tx push --source --skip
341+ /usr/local/bin/tx push --source --skip
0 commit comments