Hello , Tim Starling told me that i can ask here to approve me for commit access, i am working always with python and as i am working in Persian community, my codes is about working on Persian Wikis you can see a summary here http://fa.wikinews.org/wiki/%DA%A9%D8%A7%D8%B1%D8%A8%D8%B1:Mjbmrbot#Robot_Tasks_In_This_Wiki and i would like to work on localization and some minor edits that would be helpful, here is example of my codes :
# -*- coding: utf-8 -*- import wikipedia, urllib, re, os, datetime, calendar from xml.dom import minidom from time import strftime
Lang="fa" Family="wikinews"
RR = (u'??????', u'?????', u'????', u'?????', u'??', u'????', u'?????', u'???', u'???????', u'?????', u'??????', u'??????') RR2 = (u'January', u'February', u'March', u'April', u'May', u'June', u'July', u'August', u'September', u'October', u'November', u'December') RRfr = (u'janvier', u'février', u'mars', u'avril', u'mai', u'juin', u'juillet', u'août', u'septembre', u'octobre', u'novembre', u'décembre') RRfr2 = (u'Janvier', u'Février', u'Mars', u'Avril', u'Mai', u'Juin', u'Juillet', u'Août', u'Septembre', u'Octobre', u'Novembre', u'Décembre') RR3 = (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)
MMM = int(strftime("%m")) YYY = strftime("%Y") YYY2 = strftime("%Y") YYY = YYY.replace(u'1', u'1') YYY = YYY.replace(u'2', u'2') YYY = YYY.replace(u'3', u'3') YYY = YYY.replace(u'4', u'4') YYY = YYY.replace(u'5', u'5') YYY = YYY.replace(u'6', u'6') YYY = YYY.replace(u'7', u'7') YYY = YYY.replace(u'8', u'8') YYY = YYY.replace(u'9', u'9') YYY = YYY.replace(u'0', u'0') site = wikipedia.getSite(Lang, Family) FF = "" for i in range(1, RR3[MMM-1] + 1): site = wikipedia.getSite(Lang, Family) DD = str(i) DD2 = str(i) DDfr = str(i) if (DDfr==u'1'): DDfr = u"1er" DDfr2 = str(i) if (len(DDfr2)==1): DDfr2 = u'0' + DDfr2 DD = DD.replace(u'1', u'1') DD = DD.replace(u'2', u'2') DD = DD.replace(u'3', u'3') DD = DD.replace(u'4', u'4') DD = DD.replace(u'5', u'5') DD = DD.replace(u'6', u'6') DD = DD.replace(u'7', u'7') DD = DD.replace(u'8', u'8') DD = DD.replace(u'9', u'9') DD = DD.replace(u'0', u'0') FF = FF + u"== [[/" + DD + u'|' + DD + u' ' + RR[MMM-1] + u"]] ==\n{{/" + DD + u'}}\n\n' pagename = (u'???:' + DD + u' ' + RR[MMM-1] + u' ' + YYY) page = wikipedia.Page(site, pagename) AA = (u'[[???:' + RR[MMM-1] + u' ' + YYY + u']]\n[[???:' + DD + u' ' + RR[MMM-1] + u']]\n\n[[en:Category:' + RR2[MMM-1] + u' ' + DD2 + u', ' + YYY2 + u']]\n[[fr:Catégorie:' + DDfr + u' ' + RRfr[MMM-1] + u' ' + YYY2 + u']]') CCC = (u'????: ????? ???????? ??? ' + RR[MMM-1] + u' ' + YYY) wikipedia.output(u"Loading %s..." % pagename) try: text = page.get() except wikipedia.NoPage: print "Page doesn't exist, creating it ..." page.put(AA, comment=CCC, watchArticle = None, minorEdit = False)
pagename = (u'???:' + DD + u' ' + RR[MMM-1]) page = wikipedia.Page(site, pagename) AA = (u'{{' + RR[MMM-1] + u'}}\n{{?????????|{{????????}}}}\n{{??????????-???|' + DD2 + u' ' + RR2[MMM-1] + u'}}\n\n[[en:Category:' + RR2[MMM-1] + u' ' + DD2 + u']]\n[[fr:Catégorie:' + DDfr + u' ' + RRfr[MMM-1] + u']]') CCC = (u'????: ????? ??????? ??? ' + RR[MMM-1]) wikipedia.output(u"Loading %s..." % pagename) try: text = page.get() except wikipedia.NoPage: print "Page doesn't exist, creating it ..." page.put(AA, comment=CCC, watchArticle = None, minorEdit = False)
pagename = (u'????????:' + YYY + u'/' + RR[MMM-1] + u'/' + DD) page = wikipedia.Page(site, pagename) AA = (u'<onlyinclude>\n<DynamicPageList>\ncategory=????????\ncategory=' + DD + u' ' + RR[MMM-1] + u' ' + YYY + u'\nsuppresserrors=true\nstablepages=only\n</DynamicPageList>\n</onlyinclude>\n\n[[en:Wikinews:' + YYY2 + u'/' + RR2[MMM-1] + u'/' + DD2 + u']]\n[[fr:Wikinews:' + YYY2 + u'/' + RRfr[MMM-1] + u'/' + DDfr2 + u']]') CCC = (u'????: ????? ???????? ??? ' + RR[MMM-1] + u' ' + YYY) wikipedia.output(u"Loading %s..." % pagename) try: text = page.get() except wikipedia.NoPage: print "Page doesn't exist, creating it ..." page.put(AA, comment=CCC, watchArticle = None, minorEdit = False)
pagename = (u'????????:' + YYY + u'/' + RR[MMM-1]) page = wikipedia.Page(site, pagename) FF = FF + u'[[???:' + RR[MMM-1] + u' ' + YYY + ']]\n\n[[en:Wikinews:' + YYY2 + u'/' + RR2[MMM-1] + u']]\n[[fr:Wikinews:' + YYY2 + u'/' + RRfr[MMM-1] + ']]' CCC = (u'????: ????? ????? ????? ?? ??? ' + RR[MMM-1] + u' ' + YYY) wikipedia.output(u"Loading %s..." % pagename) try: text = page.get() except wikipedia.NoPage: print "Page doesn't exist, creating it ..." page.put(FF, comment=CCC, watchArticle = None, minorEdit = False)
pagename = (u'???:' + RR[MMM-1] + u' ' + YYY) page = wikipedia.Page(site, pagename) AA = (u'[[???:' + RR[MMM-1] + u']]\n[[???:'+ YYY + u']]\n\n[[en:Category:' + RR2[MMM-1] + u' ' + YYY2 + u']]\n[[fr:Catégorie:' + RRfr2[MMM-1] + u' ' + YYY2 + u']]') CCC = (u'????: ????? ???? ??? ' + RR[MMM-1] + u' ' + YYY) try: text = page.get() except wikipedia.NoPage: print "Page doesn't exist, creating it ..." page.put(AA, comment=CCC, watchArticle = None, minorEdit = False)
pagename = (u'???:' + YYY) page = wikipedia.Page(site, pagename) AA = (u'{{???????????|' + YYY2 + u'}}\n\n[[???:????? ?? ???? ?????]]\n\n[[en:Category:' + YYY2 + u']]\n[[fr:Catégorie:' + YYY2 + u']]') CCC = (u'????: ????? ???? ??? ' + YYY) try: text = page.get() except wikipedia.NoPage: print "Page doesn't exist, creating it ..." page.put(AA, comment=CCC, watchArticle = None, minorEdit = False)
This is a simple code that create date category pages and templates, my user name in wmf projects is Mjbmr and i have a bot with Mjbmrbot username that it have a global flag, I hope you accept my request, Regards -- Mjbmr