jenkins-bot submitted this change.
[i18n] Add category.CleanBot to the i18n system
- create summary message from i18n system
- fix verbose_output format strings
- pass colored message to user_confirm() method
- -simulate option should always be handled by data.api
Change-Id: I97a8cc6bcd97451560c8a744173304e2e817d2a3
---
M scripts/category.py
1 file changed, 18 insertions(+), 10 deletions(-)
diff --git a/scripts/category.py b/scripts/category.py
index c396b09..26d0b78 100755
--- a/scripts/category.py
+++ b/scripts/category.py
@@ -1336,10 +1336,11 @@
Stubs categories are exception.
+ .. versionadded:: 7.0
+
For details please read:
https://en.wikipedia.org/wiki/WP:SUBCAT
https://en.wikipedia.org/wiki/WP:DIFFUSE
-
"""
update_options = {
@@ -1373,23 +1374,30 @@
overcategorized = sorted(grandchildren & self.children)
if not overcategorized:
return
+
if config.verbose_output:
- pywikibot.output('Subcategory "{}" is parent for:'.format(
- format(child.title(with_ns=False))))
+ pywikibot.output('Subcategory "{}" is parent for:'
+ .format(child.title(with_ns=False)))
+
for grandchild in overcategorized:
- pywikibot.output('\t{}'. format(grandchild.title()))
+ pywikibot.output('\t{}'.format(grandchild.title()))
+
for grandchild in overcategorized:
- pywikibot.output(color_format(
+ msg = color_format(
'Remove "{lightpurple}{}{default}" from "{}" '
'because it is already under '
'subcategory "{green}{}{default}"?',
grandchild.title(with_ns=False),
- self.cat.title(with_ns=False), child.title(with_ns=False)))
- if not self.user_confirm('') or config.simulate:
- # Treat 'simulate' here to be keep output quiet and nice
+ self.cat.title(with_ns=False),
+ child.title(with_ns=False))
+
+ if not self.user_confirm(msg):
continue
- summary = ('Already in [[:{}]]'
- .format(child.title()))
+
+ opts = {'as_link': True, 'textlink': True}
+ summary = i18n.twtranslate(grandchild.site, 'category-clean',
+ {'category': self.cat.title(**opts),
+ 'child': child.title(**opts)})
grandchild.change_category(self.cat, None, summary)
To view, visit change 758089. To unsubscribe, or for help writing mail filters, visit settings.