Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F4016827
D525.id1282.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D525.id1282.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D525: Use latin script languages whitelist
Attached
Detach File
Event Timeline
Log In to Comment