رُکُن:RishabhBot/source-code/adj-templates.py

وِکیٖلۄغَتھ پؠٹھٕ

Was used to create adjective templates for all languages

none = ["en", "ta", "bn", "ja", "ojp", "enm", "tr", "ota", "fa", "ml", "pal"]
mfn = ["de", "sa", "ru", "inc-pra", "ang", "goh", "odt", "grc", "peo", "mr", "nl", "kn", "gu", "la", "gmh", "dum", "el"]
mf = ["hi", "ur", "es", "fr", "it", "roa-opt", "pt", "fro", "osp", "ps", "ar", "frm"]
#sd , pa, ks
import pywikibot
import re
site = pywikibot.Site("ks", "wiktionary")
nochange = []
for l in none:
    page = pywikibot.Page(site, "فرما:"+l+"-adj")
    new = "{{head|" + l + "|adjective|ipa={{{ipa|}}}}}"
    if new.strip() != page.text.strip():
        print(page.title())
        print(new)
        page.text = new
        if page.exists():
            page.save(summary = "Bot: Use head template", botflag = True)
        else:
            page.save(summary = "Create headword template", botflag = True)
    else:
        nochange.append(page.title())
for l in mfn:
    page = pywikibot.Page(site, "فرما:"+l+"-adj")
    new = "{{head|" + l + "|adjective|ipa={{{ipa|}}}|جَمَع|{{{pl|no_include}}}|مادٕ|{{{f|no_include}}}|نٔتھؠ|{{{n|no_include}}}}}"
    if new.strip() != page.text.strip():
        print(page.title())
        print(new)
        page.text = new
        if page.exists():
            page.save(summary = "Bot: Use head template", botflag = True)
        else:
            page.save(summary = "Create headword template", botflag = True)
    else:
        nochange.append(page.title())
for l in mf:
    page = pywikibot.Page(site, "فرما:"+l+"-adj")
    new = "{{head|" + l + "|adjective|ipa={{{ipa|}}}|جَمَع|{{{pl|no_include}}}|مادٕ|{{{f|no_include}}}}}"
    if new.strip() != page.text.strip():
        print(page.title())
        print(new)
        page.text = new
        if page.exists():
            page.save(summary = "Bot: Use head template", botflag = True)
        else:
            page.save(summary = "Create headword template", botflag = True)
    else:
        nochange.append(page.title())
print(nochange)