mirror of
https://github.com/imputnet/helium.git
synced 2026-10-22 03:03:13 -05:00
rough sketch of the pipeline:
- generic + platform patches -> `devutils/i18n generate` ->
`i18n/source.gen.json` ("source of truth" for translations)
- `i18n/source.gen.json` -> `devutils/i18n translate` -> machine
translations generated into `i18n/translations/{lang}.json`
- those should be reviewed and fixed up by representative community
members that actually speak the corresponding language
- `i18n/source.gen.json` + `i18n/translations/*` -> `utils/i18n_apply`
-> fingerprints source strings and applies translations into XTB files
fixes #1109
33 lines
955 B
Python
33 lines
955 B
Python
#!/usr/bin/env python3
|
|
# Copyright 2026 The Helium Authors
|
|
# You can use, redistribute, and/or modify this source code under
|
|
# the terms of the GPL-3.0 license that can be found in the LICENSE file.
|
|
"""Resolve translation file owners for notification."""
|
|
|
|
import sys
|
|
import yaml
|
|
|
|
|
|
def main():
|
|
"""Read changed files from stdin, print mention comment."""
|
|
with open('i18n/owners.yml', encoding='utf-8') as file:
|
|
owners = yaml.safe_load(file).get('owners', {})
|
|
|
|
mentions = set()
|
|
for line in sys.stdin:
|
|
path = line.strip()
|
|
if not path or not path.endswith('.json'):
|
|
continue
|
|
if '/translations/' not in path:
|
|
continue
|
|
lang = path.split('/')[-1].removesuffix('.json')
|
|
for user in owners.get(lang, []):
|
|
mentions.add(f'@{user}')
|
|
|
|
if mentions:
|
|
print('Translation review requested: ' + ' '.join(sorted(mentions)))
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|