e1f4ee73d0
- recipe_list.html: lista ricette con filtri, paginazione, cards Alpine.js - recipe_editor.html: form metadati, upload drag-and-drop, canvas Fabric.js per annotazioni - annotation-editor.js: editor annotazioni Fabric.js (marker, frecce, rettangoli, zoom, pan) - task_editor.html: editor task/subtask inline con drag-and-drop reorder e tolleranze - recipe_preview.html: anteprima ricetta come MeasurementTec - version_history.html: timeline versioni con conteggio misurazioni AJAX - maker.py: 6 route pagina + 13 proxy AJAX, gestione sicura risposte lista API - i18n: 170+ stringhe tradotte IT/EN per tutti i template Maker Architect review: 3 CRITICO + 5 MEDIO + 3 NEW risolti, 2 BASSO differiti Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
44 lines
1.2 KiB
Python
44 lines
1.2 KiB
Python
#!/usr/bin/env python
|
|
"""Compile .po files to .mo files for Flask-Babel."""
|
|
from pathlib import Path
|
|
from babel.messages.mofile import write_mo
|
|
from babel.messages.pofile import read_po
|
|
|
|
def compile_po_file(po_path: Path) -> None:
|
|
"""Compile a single .po file to .mo."""
|
|
mo_path = po_path.with_suffix('.mo')
|
|
|
|
print(f"Compiling {po_path} -> {mo_path}")
|
|
|
|
with open(po_path, 'rb') as po_file:
|
|
catalog = read_po(po_file)
|
|
|
|
with open(mo_path, 'wb') as mo_file:
|
|
write_mo(mo_file, catalog)
|
|
|
|
print(f" {len(catalog)} messages compiled")
|
|
|
|
def main():
|
|
"""Find and compile all .po files in translations directory."""
|
|
translations_dir = Path(__file__).parent / 'translations'
|
|
|
|
if not translations_dir.exists():
|
|
print(f"ERROR: {translations_dir} does not exist")
|
|
return
|
|
|
|
po_files = list(translations_dir.rglob('*.po'))
|
|
|
|
if not po_files:
|
|
print(f"No .po files found in {translations_dir}")
|
|
return
|
|
|
|
print(f"Found {len(po_files)} .po file(s)")
|
|
|
|
for po_file in po_files:
|
|
compile_po_file(po_file)
|
|
|
|
print("\n✓ All translations compiled successfully")
|
|
|
|
if __name__ == '__main__':
|
|
main()
|