glibc/convnames.py
2019-09-30 11:36:45 -04:00

19 lines
568 B
Python
Executable File

#!/usr/bin/python3
# This code is called by glibc.spec via lua to generate the mapping
# from language code to language name. The code uses langtable to
# do the mapping. The information in langtable is a harmonization
# of CLDR and glibc lang_name data.
import sys
try:
import langtable
except ImportError:
# if the import fails, don't translate anything
langtable = None
for lang in sys.argv[1:]:
if langtable:
name = langtable.language_name(languageId=lang, languageIdQuery='en')
print(name or lang)
else:
print(lang)