Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Paste
P94103
(An Untitled Masterwork)
Active
Public
Actions
Authored by
Pppery
on Jun 14 2026, 3:28 PM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Project Tags
None
Referenced Files
F88493377: raw-paste-data.txt
Jun 14 2026, 3:28 PM
2026-06-14 15:28:06 (UTC+0)
Subscribers
None
import
pywikibot
import
time
import
logging
logging
.
disable
(
level
=
logging
.
WARNING
)
site
=
pywikibot
.
Site
(
url
=
"https://translatewiki.net"
)
groups
=
site
.
simple_request
(
action
=
"query"
,
meta
=
"messagegroups"
,
mgformat
=
"tree"
)
.
submit
()[
"query"
][
"messagegroups"
]
groupkeys
=
[
group
[
"id"
]
for
group
in
groups
]
for
bad
in
(
"!recent"
,
"!additions"
,
"wikimedia-mailman-templates"
):
groupkeys
.
remove
(
bad
)
optional
=
[]
ignored
=
[]
for
key
in
groupkeys
:
for
what
,
result
in
((
"optional"
,
optional
),(
"ignored"
,
ignored
)):
continue_
=
{}
while
True
:
req
=
site
.
simple_request
(
action
=
"query"
,
list
=
"messagecollection"
,
mcgroup
=
key
,
mclimit
=
"max"
,
mclanguage
=
"en"
,
mcfilter
=
what
,
mcprop
=
""
,
**
continue_
)
data
=
req
.
submit
()
result
.
extend
(
k
[
"title"
]
for
k
in
data
[
"query"
][
"messagecollection"
])
if
"continue"
in
data
:
continue_
=
data
[
"continue"
]
print
(
"...continuing"
)
else
:
break
print
(
"..."
,
key
,
what
)
optional2
=
[]
ignored2
=
[]
notranslate
=
[]
for
page
in
site
.
page_embeddedin
(
pywikibot
.
Page
(
site
,
"Template:Optional"
)):
tit
=
page
.
title
()
.
replace
(
"/qqq"
,
"/en"
)
optional2
.
append
(
tit
)
for
page
in
site
.
page_embeddedin
(
pywikibot
.
Page
(
site
,
"Template:Ignored"
)):
tit
=
page
.
title
()
.
replace
(
"/qqq"
,
"/en"
)
ignored2
.
append
(
tit
)
for
page
in
site
.
page_embeddedin
(
pywikibot
.
Page
(
site
,
"Template:Notranslate"
)):
tit
=
page
.
title
()
.
replace
(
"/qqq"
,
"/en"
)
notranslate
.
append
(
tit
)
print
(
"Ignored but no template"
)
def
validity_check
(
page
):
try
:
site
.
simple_request
(
action
=
"query"
,
meta
=
"messagetranslations"
,
mttitle
=
page
)
.
submit
()
req
.
_warning_handler
=
lambda
*
junk
:
True
except
pywikibot
.
exceptions
.
APIError
as
e
:
if
e
.
code
==
"nomessagefortitle"
:
return
False
raise
return
True
def
progress
(
array
):
total
=
0
for
elem
in
array
:
yield
elem
if
total
%
20
==
0
:
print
(
"..."
,
total
,
"/"
,
len
(
array
))
total
+=
1
for
page
in
ignored
:
if
page
not
in
ignored2
and
page
not
in
notranslate
:
print
(
page
)
print
(
"Ignored template but not ignored"
)
for
page
in
progress
(
ignored2
):
if
page
not
in
ignored
and
validity_check
(
page
):
print
(
page
)
print
(
"Optional but no template"
)
for
page
in
optional
:
if
page
not
in
optional2
:
print
(
page
)
print
(
"Optional template but not optional"
)
for
page
in
progress
(
optional2
):
if
page
not
in
optional
and
validity_check
(
page
):
print
(
page
)
print
(
"Notranslate template but not ignored"
)
for
page
in
progress
(
notranslate
):
if
page
not
in
ignored
and
validity_check
(
page
):
print
(
page
)
Event Timeline
Pppery
created this paste.
Jun 14 2026, 3:28 PM
2026-06-14 15:28:06 (UTC+0)
Pppery
mentioned this in
T429085: Make sure that {{notranslate}} tags are marked ignored and {{optional}} tags are marked optional
.
Log In to Comment