Page MenuHomeDevCentral

D525.id1282.diff
No OneTemporary

D525.id1282.diff

diff --git a/create_given_name b/create_given_name
--- a/create_given_name
+++ b/create_given_name
@@ -66,12 +66,20 @@
'U': 'l10n/givenname-u.json'
}
+script_dir = os.path.dirname(os.path.realpath(__file__))
+
+# Gets whitelist latin languages to avoid create the element in other scripts.
+latin_languages_file = os.path.join(script_dir, 'l10n/latin-whitelist.json')
+with open(latin_languages_file) as data_file:
+ latin_languages = json.load(data_file)
+
# Gets descriptions from l10n file, and fill labels for these languages.
-script_directory = os.path.dirname(os.path.realpath(__file__))
-l10n_file = os.path.join(script_directory, l10n_files[genre])
+l10n_file = os.path.join(script_dir, l10n_files[genre])
with open(l10n_file) as data_file:
descriptions = json.load(data_file)
-labels = {lang:givenname for lang in descriptions.keys()}
+
+labels_languages = set(descriptions.keys()).intersection(latin_languages)
+labels = {lang: givenname for lang in labels_languages}
item.editLabels(labels, summary='Adding given name labels')
item.editDescriptions(descriptions, summary='Adding given name descriptions')
diff --git a/create_surname b/create_surname
--- a/create_surname
+++ b/create_surname
@@ -42,12 +42,20 @@
item = pywikibot.ItemPage(repo, title=title)
item.get()
+script_dir = os.path.dirname(os.path.realpath(__file__))
+
+# Gets whitelist latin languages to avoid create the element in other scripts.
+latin_languages_file = os.path.join(script_dir, 'l10n/latin-whitelist.json')
+with open(latin_languages_file) as data_file:
+ latin_languages = json.load(data_file)
+
# Gets descriptions from l10n file, and fill labels for these languages.
-script_directory = os.path.dirname(os.path.realpath(__file__))
-l10n_file = os.path.join(script_directory, 'l10n', 'surname.json')
+l10n_file = os.path.join(script_dir, 'l10n', 'surname.json')
with open(l10n_file) as data_file:
descriptions = json.load(data_file)
-labels = {lang: surname for lang in descriptions.keys()}
+
+labels_languages = set(descriptions.keys()).intersection(latin_languages)
+labels = {lang: surname for lang in latin_languages}
item.editLabels(labels, summary='Adding surname labels')
item.editDescriptions(descriptions, summary='Adding surname descriptions')

File Metadata

Mime Type
text/plain
Expires
Sun, Jan 19, 02:29 (19 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2354525
Default Alt Text
D525.id1282.diff (2 KB)

Event Timeline