mirror of
https://gh.llkk.cc/https://github.com/WeblateOrg/language-data.git
synced 2025-10-04 15:12:29 +08:00
39 lines
1.1 KiB
Python
Executable file
39 lines
1.1 KiB
Python
Executable file
#! /usr/bin/env python3
|
|
#
|
|
# Copyright © 2018 Michal Čihař <michal@cihar.com>
|
|
#
|
|
# This file is part of Weblate <https://weblate.org/>
|
|
#
|
|
|
|
OLDCODES = set(('in', 'iw', 'jw', 'ji', 'no'))
|
|
|
|
import csv
|
|
|
|
# Read the definitions
|
|
def parse_csv(name):
|
|
result = {}
|
|
with open(name, 'r') as csvfile:
|
|
reader = csv.reader(csvfile, delimiter=';')
|
|
for data in reader:
|
|
if data[0] in result:
|
|
print('Duplicate {} in {}!'.format(data[0], name))
|
|
continue
|
|
result[data[0]] = data
|
|
return result
|
|
|
|
LANGUAGES = parse_csv('languages.csv')
|
|
CLDR = parse_csv('cldr.csv')
|
|
|
|
# Iterate over common languages
|
|
for code in sorted(set(CLDR) & set(LANGUAGES)):
|
|
if CLDR[code] != LANGUAGES[code]:
|
|
print('Defintion for {} differs:'.format(code))
|
|
print('Gettext:', LANGUAGES[code])
|
|
print('CLDR:', CLDR[code])
|
|
print()
|
|
|
|
# List missing ones
|
|
for code in sorted(set(CLDR) - set(LANGUAGES) - OLDCODES):
|
|
print('Defintion for {} missing in gettext:'.format(code))
|
|
print('CLDR:', CLDR[code])
|
|
print()
|