From 963d42c1fe608b38d62e1b227581eba71ed22a2b Mon Sep 17 00:00:00 2001 From: Eli Bosley Date: Wed, 2 Jul 2025 15:27:02 -0400 Subject: [PATCH] fix: file naming --- ...final_fixed.py => extract_translations.py} | 30 +++++++++---------- .github/workflows/crowdin-upload.yml | 9 +++--- 2 files changed, 19 insertions(+), 20 deletions(-) rename .github/translations/{extract_translations_final_fixed.py => extract_translations.py} (91%) diff --git a/.github/translations/extract_translations_final_fixed.py b/.github/translations/extract_translations.py similarity index 91% rename from .github/translations/extract_translations_final_fixed.py rename to .github/translations/extract_translations.py index 781da26b8..e43608f4c 100644 --- a/.github/translations/extract_translations_final_fixed.py +++ b/.github/translations/extract_translations.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 """ -Final fixed translation string extraction for Unraid webgui codebase. +Translation string extraction for Unraid webgui codebase. Properly handles nested parentheses and complex patterns. """ @@ -89,7 +89,7 @@ def extract_nested_parens(text, start_pos): return text[start:pos-1], pos return None, start_pos -def extract_translation_strings_final_fixed(directory): +def extract_translation_strings(directory): """Extract all translation strings from the codebase with proper nested parentheses handling.""" translation_strings = set() file_sources = defaultdict(list) # Track which files contain each string @@ -155,12 +155,12 @@ def extract_translation_strings_final_fixed(directory): return sorted(list(translation_strings)), file_sources -def create_po_file_final_fixed(translation_strings, file_sources, output_file): +def create_po_file(translation_strings, file_sources, output_file): """Create a clean .po file from the extracted translation strings.""" po_content = [ '# Translation file for Unraid webgui', - '# This file was automatically generated with final fixed filtering', + '# This file was automatically generated', '# Contains translatable strings found in the codebase', '#', 'msgid ""', @@ -199,11 +199,11 @@ def create_po_file_final_fixed(translation_strings, file_sources, output_file): with open(output_file, 'w', encoding='utf-8') as f: f.write('\n'.join(po_content)) -def create_summary_report_final_fixed(translation_strings, file_sources, output_file): - """Create a summary report of the final fixed extraction.""" +def create_summary_report(translation_strings, file_sources, output_file): + """Create a summary report of the extraction.""" report_content = [ - '# Translation Extraction Summary (Final Fixed)', + '# Translation Extraction Summary', f'# Total unique strings found: {len(translation_strings)}', f'# Generated on: {__import__("datetime").datetime.now().strftime("%Y-%m-%d %H:%M:%S")}', '', @@ -267,7 +267,7 @@ def create_summary_report_final_fixed(translation_strings, file_sources, output_ def main(): if len(sys.argv) != 2: - print("Usage: python extract_translations_final_fixed.py ") + print("Usage: python extract_translations.py ") sys.exit(1) source_dir = sys.argv[1] @@ -277,23 +277,23 @@ def main(): sys.exit(1) print(f"Extracting translation strings from {source_dir}...") - translation_strings, file_sources = extract_translation_strings_final_fixed(source_dir) + translation_strings, file_sources = extract_translation_strings(source_dir) print(f"Found {len(translation_strings)} unique translation strings") # Create .po file - po_file = "unraid-webgui-final-fixed.po" - print(f"Creating final fixed .po file: {po_file}") - create_po_file_final_fixed(translation_strings, file_sources, po_file) + po_file = "unraid-webgui.po" + print(f"Creating .po file: {po_file}") + create_po_file(translation_strings, file_sources, po_file) # Create summary report - report_file = "translation-extraction-report-final-fixed.txt" + report_file = "translation-extraction-report.txt" print(f"Creating summary report: {report_file}") - create_summary_report_final_fixed(translation_strings, file_sources, report_file) + create_summary_report(translation_strings, file_sources, report_file) print("Done!") print(f"Files created:") - print(f" - {po_file}: Final fixed .po file with {len(translation_strings)} strings (proper nested parentheses handling)") + print(f" - {po_file}: .po file with {len(translation_strings)} strings") print(f" - {report_file}: Summary report") if __name__ == "__main__": diff --git a/.github/workflows/crowdin-upload.yml b/.github/workflows/crowdin-upload.yml index 78c2b3061..824e6b45b 100644 --- a/.github/workflows/crowdin-upload.yml +++ b/.github/workflows/crowdin-upload.yml @@ -29,10 +29,10 @@ jobs: cd .github/translations python extract_js_translations_from_page.py - - name: Extract all translations with final fixed script + - name: Extract all translations run: | cd .github/translations - python extract_translations_final_fixed.py ../../ + python extract_translations.py ../../ - name: List generated files run: | @@ -52,10 +52,10 @@ jobs: # Configure source files directly in workflow source: | .github/translations/unraid-webgui-js.po - .github/translations/unraid-webgui-final-fixed.po + .github/translations/unraid-webgui.po translation: | translations/%locale%/webgui-js.po - translations/%locale%/webgui-final-fixed.po + translations/%locale%/webgui.po env: CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} @@ -68,4 +68,3 @@ jobs: path: | .github/translations/*.po .github/translations/*.txt - retention-days: 30