diff --git a/scripts/make-language-lists b/scripts/make-language-lists new file mode 100755 index 00000000..c60297bb --- /dev/null +++ b/scripts/make-language-lists @@ -0,0 +1,30 @@ +#!/usr/bin/python3 + +import glob +import gzip +import os + + +translations = set() +for fname in glob.glob('po/*.po'): + translations.add(os.path.splitext(os.path.basename(fname))[0]) + +print('found translations', translations) + +console_langs = open('languagelist-console', 'w') +ssh_langs = open('languagelist-ssh', 'w') +data = gzip.open('/usr/share/localechooser/languagelist.data.gz', mode='rt') + +for line in data: + level, code, name, desc = line.strip().split(':') + if code not in translations: + continue + level = int(level) + new_line = "{}:{}\n".format(code, desc) + ssh_langs.write(new_line) + if level <= 2: + console_langs.write(new_line) + +console_langs.close() +ssh_langs.close() +data.close() diff --git a/snapcraft.yaml b/snapcraft.yaml index 9f7129e8..baa35101 100644 --- a/snapcraft.yaml +++ b/snapcraft.yaml @@ -124,6 +124,15 @@ parts: font/subiquity.psf: subiquity.psf stage: - subiquity.psf + languagelists: + plugin: nil + build-packages: + - localechooser-data + override-build: | + scripts/make-language-lists + stage: + - languagelist-console + - languagelist-ssh probert: plugin: python build-packages: [python-setuptools, libnl-3-dev, libnl-genl-3-dev, libnl-route-3-dev]