Page MenuHomePhabricator

Convert english template titles to localised ones with cosmetic_changes.py
Open, LowPublic

Description

Those wikipedias who import templates from English wikipedia, generally create redirects of english title to local one. But many times original english names of template are being used in pages. Is it possible to add feature in cosmetic_changes.py to convert these english titles to localised ones? Hope this feature is useful for many wikipedias.

You may see this edit
https://ur.wikipedia.org/wiki/خاص:فرق/3594616

Event Timeline

Restricted Application added subscribers: pywikibot-bugs-list, Aklapper. · View Herald TranscriptDec 30 2018, 4:29 PM
Xqt added a subscriber: Xqt.Dec 30 2018, 8:13 PM

This feature is implemented already but needs some localizing updates.

Xqt triaged this task as Low priority.Dec 30 2018, 8:13 PM

This feature is implemented already but needs some localizing updates.

Implemented in cc or in any other script?

Change 481605 had a related patch set uploaded (by Xqt; owner: Xqt):
[pywikibot/core@master] [L10N] Localize deprecated templates for ur-wiki

https://gerrit.wikimedia.org/r/481605

Xqt added a comment.Dec 31 2018, 1:30 PM

@MuhammadShuaib, could you please review this patch?

Xqt added a comment.Dec 31 2018, 1:41 PM

This feature is implemented already but needs some localizing updates.

Implemented in cc or in any other script?

implemented in cc. With the patch given above you may use it like:

pwb.py cosmetic_changes -ref:"Template:Infobox Former Country" -simulate -lang:ur -family:wikipedia

MuhammadShuaib added a comment.EditedDec 31 2018, 1:42 PM

@MuhammadShuaib, could you please review this patch?

They are not deprecated, still in use but redirected to local titles. And these templates are many in number. I want something like "load_redirects" function in this script which uses particular project page on wiki where we may easily put hundreds of templates instead of inserting them directly in code.

https://github.com/legoktm/pywikipedia-scripts/blob/master/awb_gen_fixes.py

Xqt added a comment.Dec 31 2018, 3:56 PM

@MuhammadShuaib: is there a page or category where these redirects can be retrieved?

@MuhammadShuaib: is there a page or category where these redirects can be retrieved?

Yes, Urdu wikipedia's page is here
https://ur.wikipedia.org/wiki/ویکیپیڈیا:AutoWikiBrowser/Template_redirects

Other languages' pages are connected on wikidata
https://www.wikidata.org/wiki/Q13380729

Xqt added a comment.Jan 1 2019, 9:18 AM

Other languages' pages are connected on wikidata
https://www.wikidata.org/wiki/Q13380729

Great. Then we can have a solution for all sites. Why should this become a solution of cc and not of template.py or fixing_redirects.py?

Other languages' pages are connected on wikidata
https://www.wikidata.org/wiki/Q13380729

Great. Then we can have a solution for all sites. Why should this become a solution of cc and not of template.py or fixing_redirects.py?

You knows better, but I think that fixing_redirects.py is meant to fix broken redirects. Isnt it?

MuhammadShuaib added a comment.EditedJan 1 2019, 1:50 PM

And one more cosmetic change can be added.
If an article starts with such words that match ecactly with current article title, cc will add ''' around them to make them bold. This feature exists in AWB.

Like this edit on Urdu wiki where title and starting words are same:
https://ur.wikipedia.org/wiki/Special:Diff/3742808

Dvorapa added a comment.EditedJan 1 2019, 2:42 PM

Other languages' pages are connected on wikidata
https://www.wikidata.org/wiki/Q13380729

Great. Then we can have a solution for all sites. Why should this become a solution of cc and not of template.py or fixing_redirects.py?

You knows better, but I think that fixing_redirects.py is meant to fix broken redirects. Isnt it?

I thought it would make complete sense to add this into fixing_redirects.py. But I realized, that for conversion between latin and non-latin script, cosmetic_changes.py is much more apropriate. I suggest to add this feature to the fixing_redirects and import it in cosmetic_changes for some chosen wikis.

And one more cosmetic change can be added.
If an article starts with such words that match ecactly with current article title, cc will add ''' around them to make them bold. This feature exists in AWB.
Like this edit on Urdu wiki where title and starting words are same:
https://ur.wikipedia.org/wiki/Special:Diff/3742808

Seems easy to do

Framawiki renamed this task from [Feature] Feature request in cosmetic_changes.py to Convert english template titles to localised ones with cosmetic_changes.py.Jan 1 2019, 3:54 PM
Framawiki added a subscriber: Framawiki.
Xqt added a comment.Jan 1 2019, 7:27 PM

I thought it would make complete sense to add this into fixing_redirects.py. But I realized, that for conversion between latin and non-latin script, cosmetic_changes.py is much more apropriate. I suggest to add this feature to the fixing_redirects and import it in cosmetic_changes for some chosen wikis.

I propose the other way in that sense: fixing_redirect.py is just a script but cc is the library part.

I thought it would make complete sense to add this into fixing_redirects.py. But I realized, that for conversion between latin and non-latin script, cosmetic_changes.py is much more apropriate. I suggest to add this feature to the fixing_redirects and import it in cosmetic_changes for some chosen wikis.

I propose the other way in that sense: fixing_redirect.py is just a script but cc is the library part.

Oh yes, sure.

Change 483434 had a related patch set uploaded (by Dvorapa; owner: Dvorapa):
[pywikibot/core@master] [IMPR] Load deprecated templates from Wikibase

https://gerrit.wikimedia.org/r/483434

Dvorapa claimed this task.Jan 10 2019, 2:54 PM
Dvorapa moved this task from Backlog to Needs Review on the Pywikibot board.

Change 483445 had a related patch set uploaded (by Dvorapa; owner: Dvorapa):
[pywikibot/core@master] [IMPR] Fix also deprecated templates in fixing_redirects.py

https://gerrit.wikimedia.org/r/483445

Xqt added a comment.Feb 4 2019, 9:57 AM

@Dvorapa: Does your patch include my https://gerrit.wikimedia.org/r/#/c/pywikibot/core/+/481605/? and can it be abandoned then?

Yes, it does include it