jenkins-bot submitted this change.

View Change

Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
[IMPR] Use "site code" instead of "language" in scripts message

The site code may be different from the site's language, e.g. the
site code "als" has the language "gsw" and single site families
like "meta", "mediawikiwiki" and commons have "en" as language.

Use the site code instead of language code with generate_family_file.py
and generate_user_files.py to avoid missunderstanding.

Bug: T291667
Change-Id: I9186d66a558453c8b2a01f204a6c0b77198c1759
---
M generate_family_file.py
M generate_user_files.py
2 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/generate_family_file.py b/generate_family_file.py
index ef94e59..795ea8b 100755
--- a/generate_family_file.py
+++ b/generate_family_file.py
@@ -10,7 +10,7 @@

<url>: an url from where the family settings are loaded
<name>: the family name without "_family.py" tail.
- <dointerwiki>: predefined answer (y|n) to add multiple language
+ <dointerwiki>: predefined answer (y|n) to add multiple site codes
<verify>: disable certificate validaton `(y|n)

Example::
@@ -56,7 +56,7 @@

:param url: an url from where the family settings are loaded
:param name: the family name without "_family.py" tail.
- :param dointerwiki: Predefined answer to add multiple language
+ :param dointerwiki: Predefined answer to add multiple site
codes. Pass `Y` or `y` for yes `N` or `n` for no and
`E` or `e` if you want to edit the collection of sites.
:param verify: If a certificate verification failes, you may
@@ -138,8 +138,8 @@
self.writefile(verify)

def getlangs(self, w):
- """Determine language of a site."""
- print('Determining other languages...', end='')
+ """Determine site code of a family."""
+ print('Determining other sites...', end='')
try:
self.langs = w.langs
print(' '.join(sorted(wiki['prefix'] for wiki in self.langs)))
@@ -159,7 +159,7 @@
if code_len > 1:
if self.dointerwiki is None:
makeiw = input(
- '\nThere are {} languages available.'
+ '\nThere are {} sites available.'
'\nDo you want to generate interwiki links? '
'This might take a long time. ([y]es/[N]o/[e]dit)'
.format(code_len)).lower()
@@ -172,7 +172,7 @@
elif makeiw == 'e':
for wiki in self.langs:
print(wiki['prefix'], wiki['url'])
- do_langs = input('Which languages do you want: ')
+ do_langs = input('Which sites do you want: ')
self.langs = [wiki for wiki in self.langs
if wiki['prefix'] in do_langs
or wiki['url'] == w.iwpath]
@@ -184,7 +184,7 @@
.format(self.name, wiki['prefix'])

def getapis(self):
- """Load other language pages."""
+ """Load other site pages."""
print('Loading wikis... ')
for lang in self.langs:
key = lang['prefix']
diff --git a/generate_user_files.py b/generate_user_files.py
index be7a5f5..745de1e 100755
--- a/generate_user_files.py
+++ b/generate_user_files.py
@@ -105,13 +105,13 @@
default_lang: Optional[str] = 'en',
default_username: Optional[str] = None, force=False):
"""
- Ask the user for the family, language and username.
+ Ask the user for the family, site code and username.

:param default_family: The default family which should be chosen.
- :param default_lang: The default language which should be chosen, if the
- family supports this language.
+ :param default_lang: The default site code which should be chosen,
+ if the family supports it.
:param default_username: The default username which should be chosen.
- :return: The family, language and username
+ :return: The family, site code and username
:rtype: tuple of three str
"""
known_families = sorted(pywikibot.config.family_files.keys())
@@ -136,14 +136,14 @@
known_langs = []

if not known_langs:
- pywikibot.output('There were no known languages found in {}.'
+ pywikibot.output('There were no known site codes found in {}.'
.format(fam.name))
default_lang = None
elif len(known_langs) == 1:
- pywikibot.output('The only known language: {}'.format(known_langs[0]))
+ pywikibot.output('The only known site code: {}'.format(known_langs[0]))
default_lang = known_langs[0]
else:
- pywikibot.output('This is the list of known languages:')
+ pywikibot.output('This is the list of known site oodes:')
pywikibot.output(', '.join(known_langs))
if default_lang not in known_langs:
if default_lang != 'en' and 'en' in known_langs:
@@ -151,14 +151,14 @@
else:
default_lang = None

- message = "The language code of the site we're working on"
+ message = "The site code of the site we're working on"
mycode = None
while not mycode:
mycode = pywikibot.input(message, default=default_lang, force=force)
if known_langs and mycode and mycode not in known_langs:
if not pywikibot.input_yn(
- fill('The language code {} is not in the list of known '
- 'languages. Do you want to continue?'.format(mycode)),
+ fill('The site code {!r} is not in the list of known '
+ 'sites. Do you want to continue?'.format(mycode)),
default=False, automatic_quit=False):
mycode = None

@@ -181,11 +181,11 @@
# generate_family_file to create one.
family = '{main_family}'

-# The language code of the site to be working on.
+# The site code (language) of the site to be working on.
mylang = '{main_code}'

# The dictionary usernames should contain a username for each site where you
-# have a bot account. If you have a unique username for all languages of a
+# have a bot account. If you have a unique username for all sites of a
# family , you can use '*'
{usernames}


To view, visit change 723424. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I9186d66a558453c8b2a01f204a6c0b77198c1759
Gerrit-Change-Number: 723424
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged