From b6f02521c2b1f7e42d98bfc74f5df32ed038efba Mon Sep 17 00:00:00 2001 From: Frisk Date: Sat, 16 Jun 2018 14:09:28 +0200 Subject: [PATCH] Added language related files, fixes --- .gitignore | 1 + locale/pl/LC_MESSAGES/rcgcdw.mo | Bin 0 -> 5367 bytes locale/pl/LC_MESSAGES/rcgcdw.po | 250 ++++++++++++++++++++++++++++++++ rcgcdw.pot | 247 +++++++++++++++++++++++++++++++ rcgcdw.py | 16 +- 5 files changed, 507 insertions(+), 7 deletions(-) create mode 100644 locale/pl/LC_MESSAGES/rcgcdw.mo create mode 100644 locale/pl/LC_MESSAGES/rcgcdw.po create mode 100644 rcgcdw.pot diff --git a/.gitignore b/.gitignore index e38da20..19f395d 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ settings.json +pygettext.py diff --git a/locale/pl/LC_MESSAGES/rcgcdw.mo b/locale/pl/LC_MESSAGES/rcgcdw.mo new file mode 100644 index 0000000000000000000000000000000000000000..9cd2b8a52b8b6f4c1e8edd58e9c1faf9b5cbc0a9 GIT binary patch literal 5367 zcmb7{TZ~&r8OMh-4Pc0TOhPJsVu*oi~B&|}RFg|DO9s79Z z=v>yZ9ZOL}RPlyNL0TeFctG&L3#1Q7gcsOFLPDaz1LA?3g!+WUYe7Qr|K?n5Z<0ni z(#g+f_M4e+zT15H%OiWg$?(+iK92XF?_z8fy!8P7!SnWB#){y-!4HEo4>I;KZ~=S| zxC%ZBz63r2YH$YpI{0buCipP;dywS*0qzI?lYT$3kFk&9`x)>ExC)Z|*TDVY4e+zz zFTlsZw?JC=zu;%U$KTD^$H67=3*ZIt5%7E90q_m*bKu`V()U69^Az|HI14U-B-aF= z244kf-JgT=;Gfg+hu@p%xdeU?a3d#OO z@F9G!fgHR9&Vg4!I`2*JY4DFAooCPcl64*hX`dPh6S5;9>3a+$|6Bs$Di(sI*JY4{ zuYx~;Z*PJJ@!kADBL5AL{PqJ7CS|_{KLoxBlHL9elHU8EEb$;n{#pmgpKXxj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$AZWngiKUGB7=%m1L{DOE_*^p$%OYJ==J&iwI@YAt78jQ#sAG$hwY; zT_rVQ1{bug)C18&Z8SSK95s;^W2sgU!!Pm9t$u{1wd&AHN!3NoGDw~-A8_C7T-(0x z46wB9vh%6tW~vJrk52Uq)kZnZKHb%jP6fto-cuZq8}wD?HFoJL@*$0BG7Oj#CI{wcoKCf zXi|hr7K93DQ_!sxlWwInvHJL6fkMIw?!^t>#udRaXhOApy(K&?vX;i` zxO0tXrs}7r8rkGRhlkE4X>8aX(GOP+fO!krdTS;cjnP7fw~oiCS, YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: RcGcDw\n" +"POT-Creation-Date: 2018-06-16 13:32+0200\n" +"PO-Revision-Date: 2018-06-16 13:58+0200\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: pygettext.py 1.5\n" +"X-Generator: Poedit 2.0.8\n" +"Last-Translator: Frisk \n" +"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" +"Language: pl\n" + +#: rcgcdw.py:88 +msgid "New file version {name}" +msgstr "Nowa wersja pliku (name)" + +#: rcgcdw.py:89 +msgid "([preview]({link}) | [undo]({undolink}))" +msgstr "([podgląd]({link}) | [wycofaj]({undolink}))" + +#: rcgcdw.py:89 rcgcdw.py:105 +msgid "Options" +msgstr "Opcje" + +#: rcgcdw.py:91 +msgid "New file {name}" +msgstr "Nowy plik {name}" + +#: rcgcdw.py:105 +msgid "([preview]({link}))" +msgstr "([podgląd]({link})" + +#: rcgcdw.py:106 +msgid "" +"{desc}\n" +"License: {license}" +msgstr "" +"{desc}\n" +"Licencja: {license}" + +#: rcgcdw.py:111 +msgid "Deleted {article}" +msgstr "Usunięto {article}" + +#: rcgcdw.py:116 +msgid "Deleted redirect ({article}) to make space for moved page" +msgstr "Usunięto przekierowanie ({article}) aby utworzyć miejsce dla przenoszonej strony" + +#: rcgcdw.py:120 +msgid "A redirect has been made" +msgstr "Zostało utworzone przekierowanie" + +#: rcgcdw.py:120 +msgid "No redirect has been made" +msgstr "Nie utworzono przekierowania" + +#: rcgcdw.py:121 +msgid "Moved \"{article}\" to \"{target}\"" +msgstr "Przeniesiono \"{article}\" do \"{target}\"" + +#: rcgcdw.py:124 +msgid "Moved {article} to redirect page ({title})" +msgstr "Przeniesiono {article} do przekierowania ({title})" + +#: rcgcdw.py:128 +msgid "Moved protection settings from {article} to {title}" +msgstr "Przeniesiono ustawienia zabezpieczeń z {article} do {title}" + +#: rcgcdw.py:133 +msgid "infinity and beyond" +msgstr "wieczność" + +#: rcgcdw.py:134 +msgid "Blocked {blocked_user} for {time}" +msgstr "Zablokowano {blocked_user} na {time}" + +#: rcgcdw.py:140 +msgid "Reapplied the block on {blocked_user}" +msgstr "Ponownie nałożono blokadę na {blocked_user}" + +#: rcgcdw.py:146 +msgid "Removed the block on {blocked_user}" +msgstr "Usunięto blokadę na {blocked_user}" + +#: rcgcdw.py:151 +msgid "Left a comment on {target}'s profile" +msgstr "Pozostawiono komentarz na profilu użytkownika {target}" + +#: rcgcdw.py:154 +msgid "Replied to a comment on {target}'s profile" +msgstr "Odpowiedziano na komentarz na profilu użytkownika {target}" + +#: rcgcdw.py:157 +msgid "Edited a comment on {target}'s profile" +msgstr "Edytowano komentarz na profilu użytkownika {target}" + +#: rcgcdw.py:161 +msgid "Location" +msgstr "Lokacja" + +#: rcgcdw.py:163 +msgid "About me" +msgstr "O mnie" + +#: rcgcdw.py:183 +msgid "Unknown" +msgstr "Nieznana" + +#: rcgcdw.py:184 +msgid "Edited {target}'s profile" +msgstr "Edytowano profil użytkownika {target}" + +#: rcgcdw.py:185 +msgid "{field} field changed to: {desc}" +msgstr "pole {field} zostało zmienione na: {desc}" + +#: rcgcdw.py:188 +msgid "Removed a comment on {target}'s profile" +msgstr "Usunięto komentarz na profilu użytkownika {target}" + +#: rcgcdw.py:191 +msgid "Changed {target}'s user groups" +msgstr "Zmieniono grupy użytkownika {target}" + +#: rcgcdw.py:195 rcgcdw.py:197 +msgid "none" +msgstr "brak" + +#: rcgcdw.py:198 +msgid "Groups changed from {old_groups} to {new_groups} with reason given: {desc}" +msgstr "Grupy zmienione z {old_groups} do {new_groups} z powodu: {desc}" + +#: rcgcdw.py:201 +msgid "Protected the page {target}" +msgstr "Zabezpieczono stronę: {target}" + +#: rcgcdw.py:206 +msgid "Modified protection settings for {article}" +msgstr "Zmodyfikowano ustawienia zabezpieczeń dla {article}" + +#: rcgcdw.py:211 +msgid "Removed protection for {article}" +msgstr "Usunięto zabezpieczenia dla {article}" + +#: rcgcdw.py:215 +msgid "Removed revision(s) from public view for {article}" +msgstr "Usunięto edycje z widoku publicznego dla {article}" + +#: rcgcdw.py:218 +msgid "Imported {article} with {count} revision(s)" +msgstr "Zaimportowano {article} z {count} wersjami" + +#: rcgcdw.py:221 +msgid "Restored {article}" +msgstr "Przywrócono {article)" + +#: rcgcdw.py:224 +msgid "Removed events" +msgstr "Usunięto wydarzenia" + +#: rcgcdw.py:227 +msgid "Imported interwiki" +msgstr "Zaimportowano interwiki" + +#: rcgcdw.py:230 +msgid "Edited abuse filter number {number}" +msgstr "Edytowano filtr nadużyć numer (number)" + +#: rcgcdw.py:233 +msgid "Merged revision histories for {article}" +msgstr "Połączono historie artykułu dla {article}" + +#: rcgcdw.py:236 +msgid "Added interwiki entry" +msgstr "Dodano intwrwiki" + +#: rcgcdw.py:237 rcgcdw.py:241 +msgid "Prefix: {prefix}, website: {website} | {desc}" +msgstr "Prefix: {prefix}, strona: {website} | desc" + +#: rcgcdw.py:240 +msgid "Edited interwiki entry" +msgstr "Edytowano interwiki" + +#: rcgcdw.py:244 +msgid "Deleted interwiki entry" +msgstr "Usunięto interwiki" + +#: rcgcdw.py:245 +msgid "Prefix: {prefix} | {desc}" +msgstr "Prefix: {prefix} | {desc}" + +#: rcgcdw.py:248 +msgid "Changed content model of {article}" +msgstr "Zmieniono model zawartości {article}" + +#: rcgcdw.py:249 +msgid "Model changed from {old} to {new}: {reason}" +msgstr "Model został zmieniony z {old} na {new}: reason" + +#: rcgcdw.py:252 +msgid "Edited the sprite for {article}" +msgstr "Edytowano sprite dla {article}" + +#: rcgcdw.py:255 +msgid "Created the sprite sheet for {article}" +msgstr "Utworzono sprite sheet dla {article}" + +#: rcgcdw.py:258 +msgid "Edited the slice for {article}" +msgstr "Edytowano część sprite dla {article}" + +#: rcgcdw.py:261 +msgid "Created a tag \"{tag}\"" +msgstr "Utworzono tag \"{tag}\"" + +#: rcgcdw.py:264 +msgid "Deleted a tag \"{tag}\"" +msgstr "Usunięto tag \"{tag}\"" + +#: rcgcdw.py:283 +msgid "No description provided" +msgstr "Nie podano opisu zmian" + +#: rcgcdw.py:364 +msgid "Unable to process the event" +msgstr "Nie udało się odczytać wydarzenia" + +#: rcgcdw.py:364 +msgid "error" +msgstr "błąd" + +#: rcgcdw.py:445 +msgid "Connection status" +msgstr "Problem z połączeniem" + +#: rcgcdw.py:445 +msgid "Minecraft Wiki seems to be down or unreachable." +msgstr "Minecraft Wiki nie działa lub jest nieosiągalna." + +#: rcgcdw.py:445 +msgid "https://i.imgur.com/2jWQEt1.png" +msgstr "https://i.imgur.com/2jWQEt1.png" diff --git a/rcgcdw.pot b/rcgcdw.pot new file mode 100644 index 0000000..2d1759b --- /dev/null +++ b/rcgcdw.pot @@ -0,0 +1,247 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2018-06-16 13:32+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: pygettext.py 1.5\n" + + +#: rcgcdw.py:88 +msgid "New file version {name}" +msgstr "" + +#: rcgcdw.py:89 +msgid "([preview]({link}) | [undo]({undolink}))" +msgstr "" + +#: rcgcdw.py:89 rcgcdw.py:105 +msgid "Options" +msgstr "" + +#: rcgcdw.py:91 +msgid "New file {name}" +msgstr "" + +#: rcgcdw.py:105 +msgid "([preview]({link}))" +msgstr "" + +#: rcgcdw.py:106 +msgid "" +"{desc}\n" +"License: {license}" +msgstr "" + +#: rcgcdw.py:111 +msgid "Deleted {article}" +msgstr "" + +#: rcgcdw.py:116 +msgid "Deleted redirect ({article}) to make space for moved page" +msgstr "" + +#: rcgcdw.py:120 +msgid "A redirect has been made" +msgstr "" + +#: rcgcdw.py:120 +msgid "No redirect has been made" +msgstr "" + +#: rcgcdw.py:121 +msgid "Moved \"{article}\" to \"{target}\"" +msgstr "" + +#: rcgcdw.py:124 +msgid "Moved {article} to redirect page ({title})" +msgstr "" + +#: rcgcdw.py:128 +msgid "Moved protection settings from {article} to {title}" +msgstr "" + +#: rcgcdw.py:133 +msgid "infinity and beyond" +msgstr "" + +#: rcgcdw.py:134 +msgid "Blocked {blocked_user} for {time}" +msgstr "" + +#: rcgcdw.py:140 +msgid "Reapplied the block on {blocked_user}" +msgstr "" + +#: rcgcdw.py:146 +msgid "Removed the block on {blocked_user}" +msgstr "" + +#: rcgcdw.py:151 +msgid "Left a comment on {target}'s profile" +msgstr "" + +#: rcgcdw.py:154 +msgid "Replied to a comment on {target}'s profile" +msgstr "" + +#: rcgcdw.py:157 +msgid "Edited a comment on {target}'s profile" +msgstr "" + +#: rcgcdw.py:161 +msgid "Location" +msgstr "" + +#: rcgcdw.py:163 +msgid "About me" +msgstr "" + +#: rcgcdw.py:183 +msgid "Unknown" +msgstr "" + +#: rcgcdw.py:184 +msgid "Edited {target}'s profile" +msgstr "" + +#: rcgcdw.py:185 +msgid "{field} field changed to: {desc}" +msgstr "" + +#: rcgcdw.py:188 +msgid "Removed a comment on {target}'s profile" +msgstr "" + +#: rcgcdw.py:191 +msgid "Changed {target}'s user groups" +msgstr "" + +#: rcgcdw.py:195 rcgcdw.py:197 +msgid "none" +msgstr "" + +#: rcgcdw.py:198 +msgid "Groups changed from {old_groups} to {new_groups} with reason given: {desc}" +msgstr "" + +#: rcgcdw.py:201 +msgid "Protected the page {target}" +msgstr "" + +#: rcgcdw.py:206 +msgid "Modified protection settings for {article}" +msgstr "" + +#: rcgcdw.py:211 +msgid "Removed protection for {article}" +msgstr "" + +#: rcgcdw.py:215 +msgid "Removed revision(s) from public view for {article}" +msgstr "" + +#: rcgcdw.py:218 +msgid "Imported {article} with {count} revision(s)" +msgstr "" + +#: rcgcdw.py:221 +msgid "Restored {article}" +msgstr "" + +#: rcgcdw.py:224 +msgid "Removed events" +msgstr "" + +#: rcgcdw.py:227 +msgid "Imported interwiki" +msgstr "" + +#: rcgcdw.py:230 +msgid "Edited abuse filter number {number}" +msgstr "" + +#: rcgcdw.py:233 +msgid "Merged revision histories for {article}" +msgstr "" + +#: rcgcdw.py:236 +msgid "Added interwiki entry" +msgstr "" + +#: rcgcdw.py:237 rcgcdw.py:241 +msgid "Prefix: {prefix}, website: {website} | {desc}" +msgstr "" + +#: rcgcdw.py:240 +msgid "Edited interwiki entry" +msgstr "" + +#: rcgcdw.py:244 +msgid "Deleted interwiki entry" +msgstr "" + +#: rcgcdw.py:245 +msgid "Prefix: {prefix} | {desc}" +msgstr "" + +#: rcgcdw.py:248 +msgid "Changed content model of {article}" +msgstr "" + +#: rcgcdw.py:249 +msgid "Model changed from {old} to {new}: {reason}" +msgstr "" + +#: rcgcdw.py:252 +msgid "Edited the sprite for {article}" +msgstr "" + +#: rcgcdw.py:255 +msgid "Created the sprite sheet for {article}" +msgstr "" + +#: rcgcdw.py:258 +msgid "Edited the slice for {article}" +msgstr "" + +#: rcgcdw.py:261 +msgid "Created a tag \"{tag}\"" +msgstr "" + +#: rcgcdw.py:264 +msgid "Deleted a tag \"{tag}\"" +msgstr "" + +#: rcgcdw.py:283 +msgid "No description provided" +msgstr "" + +#: rcgcdw.py:364 +msgid "Unable to process the event" +msgstr "" + +#: rcgcdw.py:364 +msgid "error" +msgstr "" + +#: rcgcdw.py:445 +msgid "Connection status" +msgstr "" + +#: rcgcdw.py:445 +msgid "Minecraft Wiki seems to be down or unreachable." +msgstr "" + +#: rcgcdw.py:445 +msgid "https://i.imgur.com/2jWQEt1.png" +msgstr "" + diff --git a/rcgcdw.py b/rcgcdw.py index 1d1c58c..4b9c017 100644 --- a/rcgcdw.py +++ b/rcgcdw.py @@ -1,12 +1,14 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -import time, logging, json, requests, datetime, re +import time, logging, json, requests, datetime, re, gettext from bs4 import BeautifulSoup from collections import defaultdict logging.basicConfig(level=logging.DEBUG) #logging.warning('Watch out!') #DEBUG, INFO, WARNING, ERROR, CRITICAL +pl = gettext.translation('rcgcdw', localedir='locale', languages=['pl']) +pl.install() with open("settings.json") as sfile: settings = json.load(sfile) @@ -39,7 +41,7 @@ def webhook_formatter(action, timestamp, **params): article_encoded = params["title"].replace(" ", "_").replace(')', '\)') if re.match(r"\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b", params["author"]) is not None: author_url = "https://{wiki}.gamepedia.com/Special:Contributions/{user}".format(wiki=settings["wiki"], user=params["author"]) - if params["author"] not in recent_changes.map_ips.keys(): + if params["author"] not in list(recent_changes.map_ips.keys()): contibs = safe_read(recent_changes.safe_request("https://{wiki}.gamepedia.com/api.php?action=query&format=json&list=usercontribs&uclimit=max&ucuser={user}&ucprop=".format(wiki=settings["wiki"], user=params["author"])), "query", "usercontribs") if contibs is None: logging.warning("WARNING: Something went wrong when checking amount of contributions for given IP address") @@ -77,23 +79,23 @@ def webhook_formatter(action, timestamp, **params): undolink = "" link ="https://{wiki}.gamepedia.com/{article}".format(wiki=settings["wiki"], article=article_encoded) if urls is not None: - img_info = urls.itervalues().next()["imageinfo"] + img_info = iter(urls.values()).next()["imageinfo"] embed["image"]["url"] = img_info[0]["url"] else: return if params["overwrite"]: colornumber = 12390624 - img_timestamp = filter(lambda x: x.isdigit(), img_info[1]["timestamp"]) + img_timestamp = [x for x in img_info[1]["timestamp"] if x.isdigit()] undolink = "https://{wiki}.gamepedia.com/index.php?title={filename}&action=revert&oldimage={timestamp}%21{filenamewon}".format(wiki=settings["wiki"], filename=article_encoded, timestamp=img_timestamp, filenamewon = article_encoded[5:]) embed["title"] = _("New file version {name}").format(name=params["title"]) embed["fields"] = [{"name": _("Options"), "value": _("([preview]({link}) | [undo]({undolink}))").format(link=embed["image"]["url"], undolink=undolink)}] else: embed["title"] = _("New file {name}").format(name=params["title"]) - article_content = safe_read(recent_changes.safe_request("https://minecraft.gamepedia.com/api.php?action=query&format=json&prop=revisions&titles={article}&rvprop=content".format(article=urllib.quote_plus(params["title"]))), "query", "pages") #TODO Napewno urllib? + article_content = safe_read(recent_changes.safe_request("https://minecraft.gamepedia.com/api.php?action=query&format=json&prop=revisions&titles={article}&rvprop=content".format(article=urllib.parse.quote_plus(params["title"]))), "query", "pages") #TODO Napewno urllib? if article_content is None: logging.warning("Something went wrong when getting license for the image") return 0 - content = article_content.values()[0]['revisions'][0]['*'].lower() + content = list(article_content.values())[0]['revisions'][0]['*'].lower() if "{{license" not in content: license = "**No license!**" else: @@ -387,7 +389,7 @@ class recent_changes(object): self.ids.pop(0) def fetch(self): self.recent_id = self.fetch_changes() - def fetch_changes(self): + def fetch_changes(self, clean=False): if len(self.cache) == 0: logging.debug("cache is empty, triggering clean fetch") clean = True