svn commit: r1934598 - httpd/docs-build/trunk

[email protected]
Newsgroups gmane.comp.apache.cvs
Message-ID <177972582672.3362864.10655987325285149000@svn03-he-fi>
Author: rbowen
Date: Mon May 25 16:17:06 2026
New Revision: 1934598

Log:
Updated tooling to list available translations, in Markdown rather than
raw XML.

Added:
   httpd/docs-build/trunk/list_translations.py   (contents, props changed)
Deleted:
   httpd/docs-build/trunk/list_translations.pl

Added: httpd/docs-build/trunk/list_translations.py
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ httpd/docs-build/trunk/list_translations.py	Mon May 25 16:17:06 2026	(r1934598)
@@ -0,0 +1,96 @@
+#!/usr/bin/env python3
+"""
+Generate the translation status markdown table for the httpd docs-project
+website (avail_translations.md).
+
+Usage:
+    cd docs/manual/
+    python3 build/list_translations.py
+
+Output goes to stdout. Redirect or paste into:
+    httpd-site/content/docs-project/avail_translations.md
+    (replacing the table section, preserving the intro text above it)
+"""
+
+import glob
+import os
+import sys
+
+LANGS = {
+    'de': 'German',
+    'es': 'Spanish',
+    'fr': 'French',
+    'ja': 'Japanese',
+    'ko': 'Korean',
+    'tr': 'Turkish',
+    'zh-cn': 'Simplified Chinese',
+}
+
+# Directories to scan for module/doc XML files (relative to docs/manual/)
+GLOBS = [
+    '*.xml',
+    'mod/*.xml',
+    'ssl/*.xml',
+    'vhosts/*.xml',
+    'programs/*.xml',
+    'rewrite/*.xml',
+]
+
+
+def find_english_files():
+    """Find all English XML source files."""
+    files = []
+    for pattern in GLOBS:
+        files.extend(glob.glob(pattern))
+    # Filter out files that are themselves translations (have a lang extension)
+    english = []
+    for f in files:
+        # Translation files look like: mod_rewrite.xml.fr, bind.xml.ja
+        # English files are just: mod_rewrite.xml, bind.xml
+        # Skip .xml.meta files and .xml.XX files
+        base, ext = os.path.splitext(f)
+        if ext == '.xml':
+            english.append(f)
+    return sorted(english)
+
+
+def find_translations(english_file):
+    """Find which languages have a translation for the given file."""
+    translations = set()
+    for candidate in glob.glob(english_file + '.*'):
+        if candidate.endswith('.meta'):
+            continue
+        lang = candidate[len(english_file) + 1:]  # strip "filename.xml."
+        if lang in LANGS:
+            translations.add(lang)
+    return translations
+
+
+def main():
+    # Check we're in the right directory
+    if not os.path.isdir('mod') or not os.path.isfile('mod/mod_rewrite.xml'):
+        print("Error: Run this from the docs/manual/ directory.", file=sys.stderr)
+        print("  cd ~/devel/apache/httpd/httpd-2.4/docs/manual", file=sys.stderr)
+        print("  python3 build/list_translations.py", file=sys.stderr)
+        sys.exit(1)
+
+    english_files = find_english_files()
+    lang_keys = sorted(LANGS.keys())
+
+    # Header
+    header = '| Document | ' + ' | '.join(LANGS[l] for l in lang_keys) + ' |'
+    separator = '|' + '|'.join(['----------'] + [':------:'] * len(lang_keys)) + '|'
+
+    print(header)
+    print(separator)
+
+    for eng in english_files:
+        translations = find_translations(eng)
+        row = '| ' + eng + ' | '
+        row += ' | '.join('✔' if l in translations else '-' for l in lang_keys)
+        row += ' |'
+        print(row)
+
+
+if __name__ == '__main__':
+    main()
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.