File tree Expand file tree Collapse file tree 2 files changed +29
-6
lines changed
Expand file tree Collapse file tree 2 files changed +29
-6
lines changed Original file line number Diff line number Diff line change 1+ """Apply translations from CSV back to pyRevit bundle YAML files.
2+
3+ This script reads a CSV file containing translations (generated by
4+ extract_translations.py) and applies them to the corresponding bundle.yaml
5+ files, updating or creating multilingual field dictionaries.
6+
7+ Configuration:
8+ TRANSLATION_CSV: Path to the CSV file containing translations
9+ LANGUAGE_KEY: Translation language key to apply (e.g., 'chinese_s')
10+ SOURCE_LANG: Source language key (default: 'en_us')
11+ """
112import csv
213from pathlib import Path
314from ruamel .yaml import YAML # pip install ruamel.yaml
415
516# -------- CONFIG --------
6- TRANSLATION_CSV = r"C:\temp\translations.csv"
7- LANGUAGE_KEY = "chinese_s"
8- SOURCE_LANG = "en_us"
17+ TRANSLATION_CSV = r"C:\temp\translations.csv" # same path as in other script
18+ LANGUAGE_KEY = "chinese_s" # same as in other script
19+ SOURCE_LANG = "en_us" # same as in other script
920# ------------------------
1021
1122yaml = YAML ()
@@ -98,7 +109,7 @@ def main():
98109 with open (yaml_file , "w" , encoding = "utf-8" ) as f :
99110 yaml .dump (data , f )
100111
101- print (f"[Updating ] { yaml_file } " )
112+ print (f"[Processing ] { yaml_file } " )
102113
103114 except Exception as e :
104115 print (f"[ERROR] writing { yaml_file } : { e } " )
Original file line number Diff line number Diff line change 1+ """Extract translation strings from pyRevit bundle YAML files.
2+
3+ This script scans bundle.yaml files for title and tooltip fields,
4+ extracting English source text and any existing translations to a CSV file
5+ for easier translation workflow.
6+
7+ Configuration:
8+ BASE_DIR: Root directory containing bundle YAML files
9+ OUTPUT_CSV: Path where the CSV file will be written
10+ LANGUAGE_KEY: Translation language key (e.g., 'chinese_s')
11+ SOURCE_LANG: Source language key (default: 'en_us')
12+ """
113import os
214from pathlib import Path
315from ruamel .yaml import YAML # pip install ruamel.yaml
416import csv
517
618# -------- CONFIG --------
7- BASE_DIR = r"C:\Program Files\pyRevit-Master\extensions\pyRevitTools.extension"
8- OUTPUT_CSV = r"C:\temp\translations.csv"
19+ BASE_DIR = r"C:\Program Files\pyRevit-Master\extensions\pyRevitTools.extension" # adjust for custom installation
20+ OUTPUT_CSV = r"C:\temp\translations.csv" # same path as in other script
921LANGUAGE_KEY = "chinese_s" # translation key to extract/merge
1022SOURCE_LANG = "en_us" # main source language
1123# ------------------------
You can’t perform that action at this time.
0 commit comments