feat: status translation overrides via YAML config
report.status_translation in YAML config overrides/extends the builtin
STATUS_TRANSLATION dictionary; without the section behavior is unchanged.
- AppConfig.report_status_translation + _resolve_str_dict (warns and
skips non-scalar values, resolves ${VAR} references)
- Config.get_status_translation() returns merged copy (lazy import,
builtin dict never mutated)
- build_grouped_report() accepts optional status_translation parameter
- --init-config template gains commented example, docs/CONFIG.md updated
Closes #65
This commit is contained in:
@@ -136,6 +136,16 @@ def _run_init_config(config_path: str, force: bool) -> int:
|
||||
yaml.dump(
|
||||
data, fh, allow_unicode=True, default_flow_style=False, sort_keys=False
|
||||
)
|
||||
fh.write(
|
||||
"\n"
|
||||
"# report.status_translation: переопределение/дополнение перевода\n"
|
||||
"# статусов Redmine. Без секции используется встроенный словарь.\n"
|
||||
"# Пример:\n"
|
||||
"# report:\n"
|
||||
"# status_translation:\n"
|
||||
'# "New": "Новая"\n'
|
||||
'# "Wait Release": "Ожидает релиза"\n'
|
||||
)
|
||||
path.chmod(0o600)
|
||||
|
||||
sections_found = [s for s in data if data[s]]
|
||||
@@ -445,6 +455,7 @@ def main(argv: Optional[List[str]] = None) -> int:
|
||||
issue_hours,
|
||||
fill_time=not no_time,
|
||||
by_activity=args.by_activity,
|
||||
status_translation=Config.get_status_translation(),
|
||||
)
|
||||
|
||||
if args.summary:
|
||||
|
||||
Reference in New Issue
Block a user