diff options
author | Andreas HABEGGER <andreas.habegger@bfh.ch> | 2023-11-19 22:37:03 +0100 |
---|---|---|
committer | Andreas HABEGGER <andreas.habegger@bfh.ch> | 2023-11-19 22:37:03 +0100 |
commit | 1d496cd5b009d8d420176b00831c4bbd717a4a09 (patch) | |
tree | 1741deb6c67426c4f260896f0a3513f4f429d47d | |
parent | 12caf5a526eb0f72627f6849ba96895dd505ec18 (diff) | |
download | www_shared-1d496cd5b009d8d420176b00831c4bbd717a4a09.tar.gz www_shared-1d496cd5b009d8d420176b00831c4bbd717a4a09.zip |
FC: YAML multifile read for translations; Added global variable to configure properties file
-rwxr-xr-x | list-languages | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/list-languages b/list-languages index 9df48ac..c1379d2 100755 --- a/list-languages +++ b/list-languages | |||
@@ -1,8 +1,18 @@ | |||
1 | #!/usr/bin/env python3 | 1 | #!/usr/bin/env python3 |
2 | 2 | ||
3 | from ruamel.yaml import YAML | ||
4 | from pathlib import Path | 3 | from pathlib import Path |
4 | from ruamel.yaml import YAML | ||
5 | |||
6 | PROPERTIES_YML = "properties.yml" | ||
7 | |||
8 | # NOTE : read-in properties.yml and afterwards all *.yml in properties.d | ||
9 | properties = {} | ||
5 | yaml = YAML(typ="safe") | 10 | yaml = YAML(typ="safe") |
6 | config = yaml.load(Path("www.yml")) | 11 | yaml.preserve_quotes = True |
7 | langs = config["langs_full"] | 12 | properties.update(yaml.load(Path(PROPERTIES_YML))) |
13 | properties_dir = PROPERTIES_YML.removesuffix('.yml') + '.d' | ||
14 | for filepath in Path(properties_dir).glob('*.yml'): | ||
15 | properties.update(yaml.load(filepath)) | ||
16 | |||
17 | langs = properties["langs_full"] | ||
8 | print(" ".join(langs)) | 18 | print(" ".join(langs)) |