Jump to content

User talk:Dudemanfellabra/AddCommonsCatLinks

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Czech translation of the GUI

[edit]
 // text to be displayed in the button you click to start the script
        "ButtonText":"Hledej v Commons chybějící obrázky a kategorie",
 // Error at the beginning of the script to catch templates that don't include the correct CSS class
        "RowMismatch":"Chybné vyznačení řádků! Pravděpodobně je nesprávně formátovaná řádková šablona. Všechny řádkové šablony musejí obsahovat class='vcard', aby je skript mohl identifikovat. Pokud {{ROWTEMPLATE}} neobsahuje class='vcard', dejte mi zprávu na en:User_talk:Dudemanfellabra a já se pokusím problém vyřešit. Skript se nyní sám ukončí. Omlouvám se!",
 // self-explanatory
        "CheckingMatches":"Hledám odkazy k přidání…",
        "EditSummary":"[[:en:User:Dudemanfellabra/AddCommonsCatLinks|Poloautomatické]] přidání obrázku(-ů) of a/nebo odkazu(-ů) commonscat do seznamu",
        "NoneFound":"Nebyl nalezen žádný odkaz k přídání. Skript byl ukončen.",
        "Found":"Nalezeny odkazy k přidání!",
        "FollowingImages":"K objektu NAME byly vyhledány tyto obrázky:",
 // asking to select either a matched image or a category; shouldn't include the words for "image" or "category"
        "SelectOne":"Vyber k přidání:",
        "DontAddImage":"Nepřidávat žádný obrázek",
        "OtherSuggested":"Další doporučené obrázky k objektu „NAME“ z odpovídajících kategorií:",
        "Suggested":"Doporučené obrázky k objektu „NAME“ z odpovídajících kategorií:",
 // included with each suggested image showing which category it is a member of
        "From":"z CATNAME",
        "FollowingCats":"K objektu „NAME“ byly nalezeny tyto kategorie:",
        "DontAddCat":"Nepřídávat žádnou kategorii",
 // shown on the button
        "SelectButton":"Vyber",
        "Done":"Hotovo!<br>Edituji stránku…",
        "SuccessfulEdit":"Hotovo! Pro zobrazení výsledku obnovte stránku!",
        "FailedEdit":"Uložení selhalo, editační filtr hlásí chybu.",
        "LeavePage":"Určitě chcete opustit tuto stránku? Kategorie/soubory, které jste přidal/a, nebudou uloženy!"

Notes to the translation:

  • I found not any suitable Czech equivalent for the substantive "match" and for the verb "match". I replaced the verb "matches" with words "odkazy k přidání" (= "links to be added") and "NAME matches" with "There were found for NAME". The words "matched or existing categories" are replaced with "corresponding categories" without differentiation.
  • In "EditSummary", I used "list" instead of "monument list" to keep the GUI usable for other types of lists. --ŠJů (talk) 16:54, 10 August 2014 (UTC)[reply]
Thanks for this translation! I have now added it to the code!--Dudemanfellabra (talk) 03:40, 11 August 2014 (UTC)[reply]

Thank You! Please correct my mistake, replace "Script" with "Skript" in the Czech text.

  • "NoneFound":"Nebyl nalezen žádný odkaz k přídání. Skript byl ukončen."

--ŠJů (talk) 07:36, 11 August 2014 (UTC)[reply]

Corrections of the Czech translation

[edit]

Please do some small corrections of the Czech translation:

"LeavePage":"Opravdu chcete opustit tuto stránku? Kategorie/soubory, které jste přidal/a, nebudou uloženy!"
 (the word "opravdu" is more common in this usage than "určitě")
"SelectButton":"Vybrat" (infinitive form is more suitable than imperative)
"FollowingImages":"K objektu „NAME“ byly nalezeny tyto obrázky:", (add quotation marks, "nalezeny" instead of "vyhledány")
"EditSummary":"Poloautomatické přidání obrázku(-ů) a/nebo odkazu(-ů) commonscat do seznamu" (remove the English preposition "of")

--ŠJů (talk) 16:13, 12 August 2014 (UTC)[reply]

 Done--Dudemanfellabra (talk) 17:23, 27 September 2014 (UTC)[reply]

Edit summary

[edit]

Would be possible to make the edit summary more specific?

"EditSummary":"Semi-automated update: IMGCOUNT image(s) added, CATCOUNT commonscat link(s) added"

--ŠJů (talk) 16:13, 12 August 2014 (UTC)[reply]

Thank you for the suggestion. I'll look into adding this, but it may take me a while since I've been away from editing and have quite a bit to catch up on.--Dudemanfellabra (talk) 17:23, 27 September 2014 (UTC)[reply]
[edit]

Hi Dudemanfellabra. Could you add a test whether the target commonscategory exists and is not a redirect nor a soft redirect? --ŠJů (talk) 16:34, 13 August 2014 (UTC)[reply]

This script only picks up categories which have been specifically tagged with the relevant template. If a category is a redirect, it should not be tagged. The solution here would simply be to remove the tag on the redirected category and place it on the actual category.--Dudemanfellabra (talk) 17:23, 27 September 2014 (UTC)[reply]
What I meant are cases when the monument list contain a commonscat link which links to a redirected or non-existing category. I would welcome a tool which would detect such cases and deal with them as with missing links (i.e. propose the categories which are tagged with the relevant template instead the link to an untagged category). --ŠJů (talk) 18:47, 27 September 2014 (UTC)[reply]
@ŠJů: Ah, I see now what you mean. I agree that this is a good check to have and have now implemented it. The script checks if the commonscat (and the image, for that matter) that are already included actually exist, and if they do not, the script checks for matching ones. You can see from this diff that the script was able to tell that the included category "Yarningdale Aqueduct" did not exist, and it corrected it to "Yarningale Aqueduct". If the script determines a cat/image does not exist but cannot find a replacement, the script just skips it. Thanks for the suggestion!--Dudemanfellabra (talk) 18:58, 28 September 2014 (UTC)[reply]
@Dudemanfellabra: Well done! However, an explanation should be added to the message. (The linked category doesn't exist in Commons / The linked category is redirected). --ŠJů (talk) 23:28, 28 September 2014 (UTC)[reply]
I'm not really sure any message should be displayed. For one, it would require adding yet another string to the GUI to be translated into every other language. Also, since the script will just replace what is there, I don't see the harm in not notifying the user. If (s)he doesn't want to replace the existing cat/image for whatever reason, there is always the skip button.--Dudemanfellabra (talk) 01:03, 1 October 2014 (UTC)[reply]

Double offered images

[edit]

The section "OtherSuggested" should skip images which are offered in the section "FollowingImages". --ŠJů (talk) 21:56, 14 August 2014 (UTC)[reply]

This will require a simple check to see if image titles match and should be pretty easy to add. I will look into it.--Dudemanfellabra (talk) 17:23, 27 September 2014 (UTC)[reply]
@ŠJů: I have now added this check. If an image is matched itself, it will not be displayed a second time in the other suggested images section. Thanks for the suggestion!--Dudemanfellabra (talk) 18:58, 28 September 2014 (UTC)[reply]

An undetected match

[edit]

Hi. This edit was made manually because AddCommonsCatLinks didn't detect the match. Maybe, it doesn't work with numeric ID without a slash? --ŠJů (talk) 05:28, 15 August 2014 (UTC)[reply]

I'm not sure what happened here, but I just removed the category and ran the script, and it detected the match just fine.--Dudemanfellabra (talk) 17:23, 27 September 2014 (UTC)[reply]
Thank you. None similar case appeared again since 15 August. It seems to be OK. --ŠJů (talk) 18:16, 27 September 2014 (UTC)[reply]

More ID templates - a limit of the tool

[edit]

Hi. Thank you for all fixes!

There is a problem with images which contain more than one protected monument, i.e. more monument templates with different IDs. The tool is able to deal only one of them, using the sorting in the category. However, probably, the principle of the tool cannot solve this problem. Such cases need to be treated manually, I think. --ŠJů (talk) 18:25, 27 September 2014 (UTC)[reply]

@ŠJů: Yes, I am aware of this limitation, and there has been some discussion on my talk page on how to fix it which would require a complete rewrite of the script, but as the script is currently set up, if an image/cat has more than one ID tagged on Commons, the script will only see the last one. Sorry :\ --Dudemanfellabra (talk) 18:58, 28 September 2014 (UTC)[reply]

Behaviour in case of a broken template

[edit]

When one template in the monument list is broken, AddCommonsCatLinks is not able to go through the other (unbroken) templates. However, the error message is unsuitable and confusing for such case and the problematical point of the list is not indicated. I meet this problem at this version of a list. --ŠJů (talk) 23:40, 28 September 2014 (UTC)[reply]

I am aware of this limitation as well and have been thinking for a while on how to allow the script to check for multiple templates on the same page. This will require a massive change to the way the script is set up, so this may take a while to implement, but there have been multiple requests for this type of modification. I'll see what I can do.--Dudemanfellabra (talk) 01:03, 1 October 2014 (UTC)[reply]
@ŠJů: Actually I see the problem now is that the template was broken entirely, i.e. it was missing the closing brackets and causing gibberish to be displayed in the article. In that case, if you want it to work, just fix the template. The coding required to account for this type of error would be massive, and I don't really think I should devote that much time to the issue, especially since the error should be fixed on the article itself anyway. In other words, since the error is in the article itself and not in my code, I don't think I should have to account for it.
That said, I did actually implement the change I was talking about earlier to allow the script to update pages with multiple templates on them. Because there can in general be more than one type of template on a single page, the "RowMismatch" error in the GUI needs to be updated not to reference a single template. I have done this in English; could you possibly update the text in Czech?
  • The English text is "Row mismatch! This is probably due to an incorrectly formatted row template. All row templates must include class='vcard' in order for this script to identify them. If the row template(s) on this page include class='vcard', please let me know at :en:User_talk:Dudemanfellabra, and I will try to resolve the problem. The script will now exit itself. Sorry!"
  • The current Czech text is "Chybné vyznačení řádků! Pravděpodobně je nesprávně formátovaná řádková šablona. Všechny řádkové šablony musejí obsahovat class='vcard', aby je skript mohl identifikovat. Pokud {{ROWTEMPLATE}} neobsahuje class='vcard', dejte mi zprávu na en:User_talk:Dudemanfellabra a já se pokusím problém vyřešit. Skript se nyní sám ukončí. Omlouvám se!"
Could you update it to remove "ROWTEMPLATE" like in the English version?--Dudemanfellabra (talk) 03:11, 5 October 2014 (UTC)[reply]
Also, could you translate this string for the invalid category situation discussed above?:
  • "Invalid":"The existing image and/or category cannot be found on Commons. Selecting a match here will replace the existing one(s). If you do not want to replace anything, choose Do not add any category/image."
Thanks!--Dudemanfellabra (talk) 19:01, 5 October 2014 (UTC)[reply]

Thanks for your answers!

Primarily, the "row mismatch" template should point out that the problem can be a broken (incomplete) template, not only missing 'vcard'. The user need to find the faulty place manually but he need to be notified what is the problem first. Missing 'vcard' is an initial error which can be tuned when the tool is introduced and which should not appear more. Broken template is more probable cause of this error in routine use of the tool.

Czech translation of "Invalid":

  • Odkazovaný obrázek a/nebo kategorie v projektu Commons neexistují. Můžete vybrat jiný odkaz k jejich nahrazení. Pokud chcete ponechat stávající odkazy, zvolte "Nepřidávat žádný obrázek/kategorii."

Btw.: the tool should detect also such cases that the link is invalid but no other match is found,

  • the tool should offer a possibility to remove the invalid link without a replacement (or to add the correct link manually).
  • if the commonscat link is a hard or soft redirect, the link should offer a possibility to change the link to the target of the redirect. --ŠJů (talk) 19:10, 6 October 2014 (UTC)[reply]
I understand your point about the row mismatch error, but since there are so many untested row templates in the various languages that still don't have anyone actively using them, this is likely the most common error that will be encountered. After most of the templates have been routinely used, and it is known that they should work, I may modify the error message. That, or I may be able to add another flag to see if the register has been verified by some editor to work properly and if that flag is set, display a different message. I will look into adding that. I will also look into adding the option to remove an invalid image/category even if a match is not found. Thanks for the suggestions, and thank you also for the translation.--Dudemanfellabra (talk) 04:29, 7 October 2014 (UTC)[reply]

Hi Dudemanfellabra.

  • I used the tool tonight and the "Invalid" message is not translated to Czech yet.
  • Row mismatch: ("... Pokud řádkové šablony použité na této stránce obsahují class='vcard', dejte mi zprávu na en:User_talk:Dudemanfellabra...")
  • what about to add simply the words "If the row template(s) on this page include class='vcard', try to check for broken or incomplete templates, otherwise please let me know at :en:User_talk:Dudemanfellabra..."? ("Pokud řádkové šablony použité na této stránce obsahují class='vcard', zkuste zkontrolovat, zda některá šablona není narušená nebo nekompletní, jinak mi dejte zprávu na en:User_talk:Dudemanfellabra...") --ŠJů (talk) 01:04, 14 October 2014 (UTC)[reply]
Yes, I realize it hasn't been translated yet. As I mentioned above I am going to try to make some changes. I've just been busy for the past while, so I haven't gotten around to doing it yet. I'll let you know when I make these changes. Sorry for the delay.--Dudemanfellabra (talk) 02:50, 14 October 2014 (UTC)[reply]
@ŠJů: I have now edited the code to display a more informative error if the template has been verified to work correctly in most cases. The string I chose is: "Row mismatch! This is probably due to an incorrectly formatted row template in the wikicode, e.g. a missing }} or a misplaced HTML comment. If you cannot find the error on this page or believe it is due to something else, please let me know at :en:User_talk:Dudemanfellabra, and I will try to resolve the problem. The script will now exit itself. Sorry!"
Could you possibly translate that? Thanks!--Dudemanfellabra (talk) 03:51, 23 October 2014 (UTC)[reply]

"Chybné vyznačení řádků! Pravděpodobně je nesprávně formátovaná některá řádková šablona ve zdrojovém wikikódu, například chybí ukončovací }} nebo je chybně vyznačen HTML komentář. Pokud se vám na této stránce nedaří nalézt chybu nebo se domníváte, že příčina je jiná, dejte mi zprávu na :en:User_talk:Dudemanfellabra a já se pokusím problém vyřešit. Skript se nyní sám ukončí. Omlouvám se!" Thanks! --ŠJů (talk) 19:39, 24 October 2014 (UTC)[reply]

[edit]

Hi Dudemanfellabra! Your tool works very well and is very useful (although used only by 2 people at the Czech Wikipedia).

If you have in plan to improve the tool further, I have some small remarks:

  • AddCommonsCatLinks doesn't offer to straight the link when the commonscat link links to a soft or hard redirect page
  • AddCommonsCatLinks doesn't offer to remove the link when the commonscat link links to an unexisting category page.

Could you add such possibility, either defaultly or choosable by personal settings?

Thank You! --ŠJů (talk) 14:27, 20 December 2014 (UTC)[reply]

Chrome issues

[edit]

see Wikipedia:Village_pump_(technical)#User:Dudemanfellabra.2FAddCommonsCatLinks_and_other_scripts_.2F_Chrome -- Agathoclea (talk) 11:24, 16 September 2016 (UTC)[reply]

Only run for images?

[edit]

Hello Dudemanfellabra,

I was pointed to your tool by User:Effeietsanders, who prompted me to make the necessary changes to the templates for lists of French monuments on French-language Wikipedia. I must say I am very impressed − it is very useful and works well. Thanks!

I would have one comment: would it be possible to run the script only to check images? On French lists, it turns out we have a huge backlog of not filling up CommonsCat in monuments lists. Going through the whole list can take a long, long time ; while I may be looking just for the much shorter task of adding images. Additionally, other French users were not so keen on the idea to mass-add CommonsCat links since they are not displayed in the lists and are thus considered “useless” (I would disagree as the maintainer of the Monuments database but eh ;-) − providing the option to only work on images would be a good argument for adoption for these users.

Another comment: since we have such a backlog, the tool may find dozens and dozen matches on one list. However I do not seem to have any other option than to go through all possible matches for the script to save images − is that correct? Would it be possible to stop and save the work already done?

Cheers,

Jean-Fred (talk) 20:33, 18 January 2017 (UTC)[reply]

Hi @Dudemanfellabra:,
Have you given some thoughts to that?
Or alternatively, would it be possible to stop the process at any point and save the current progress? I find it really frustrating when I start matching a dozen of items, and there are still dozens and dozens to go, and my only options is losing my work or committing to go through all of it...
Thanks, Jean-Fred (talk) 11:07, 29 September 2017 (UTC)[reply]
I just added the capability to check only images via a second button generated at the top of the page that appends "(images only)" to the button text. Since I was in a rush, I did not allow this text to be translated to other languages like the rest of the interface, but if the need is there, I can do that later.
I also added the ability to save progress and exit early via a "save progress and exit" button, which immediately edits the page to include all changes up to and including the change the user is making at that moment. Again, I did not allow this button to be translated to other languages, but can do that later as well if necessary. Now with the addition of this new button, it might also be reasonable to change the "Select" button to something like "Continue" or "Next". Either way, these are changes that can be made later.
I only tested these changes on one article and it seemed to work, but please comment on my talk page if you find a situation where it returns an error or doesn't work as expected.
Sorry for ignoring your request earlier. I'm not very active on Wikipedia any more, and only receive messages when I get a notification, so pinging me or commenting on my talk page is the best way to reach me.--Dudemanfellabra (talk) 20:43, 29 September 2017 (UTC)[reply]
I found some extra time to make it so the strings are localizable now. You say you work mostly in the French Wikipedia. Would you be willing to translate the interface into French? Here is all the text in English if you're willing:
        "ButtonText":"Check Commons for images and categories",
        "ImageOnlyText":"Check Commons for images only",
        "RowMismatch":"Row mismatch! This is probably due to an incorrectly formatted row template. All row templates must include class='vcard' in order for this script to identify them. If the row template(s) on this page include class='vcard', please let me know at :en:User_talk:Dudemanfellabra, and I will try to resolve the problem. The script will now exit itself. Sorry!",
        "MalformedRow":"Row mismatch! This is probably due to an incorrectly formatted row template in the wikicode, e.g. a missing }} or a misplaced HTML comment. If you cannot find the error on this page or believe it is due to something else, please let me know at :en:User_talk:Dudemanfellabra, and I will try to resolve the problem. The script will now exit itself. Sorry!",
        "CheckingMatches":"Checking for matches...",
        "EditSummary":"[[:en:User:Dudemanfellabra/AddCommonsCatLinks|Semi-automated]] addition of image(s) and/or commonscat link(s) to monument list",
        "NoneFound":"No matches found or selected. Script exited.",
        "Found":"Matches found!",
        "Invalid":"The existing image and/or category cannot be found on Commons. Selecting a match here will replace the existing one(s). If you do not want to replace anything, choose Do not add any category/image.",
        "FollowingImages":"NAME matches the following images:",
        "SelectOne":"Select one to add:",
        "DontAddImage":"Do not add any image",
        "OtherSuggested":"Other suggested images for NAME from matched or existing categories:",
        "Suggested":"Suggested images for NAME from matched or existing categories:",
        "From":"from CATNAME",
        "FollowingCats":"NAME matches the following categories:",
        "DontAddCat":"Do not add any category",
        "SelectButton":"Continue",
        "SaveButton":"Save progress and exit",
        "Done":"Done!<br>Editing page...",
        "SuccessfulEdit":"Done! Refresh the page to see the result!",
        "FailedEdit":"The edit query returned an error.",
        "LeavePage":"Are you sure you want to leave the page? All categories/files that you have added will not be saved!"
--Dudemanfellabra (talk) 22:51, 29 September 2017 (UTC)[reply]

Added features/supported registers

[edit]

@Agathoclea and Herzi Pinki: I got a message a few days ago that someone wanted an update to this script to allow for searching for only images and to stop early before an entire list had been examined. I recently added these features to this script, but I notice in my extended absence (which will continue indefinitely, mind you) that you two have forked your own versions of the script you seem to be using since I did not respond to your add requests. I have now added support for all the registers you guys have added in your versions. If you'd like, you can either copy over my new edits to the main script or (I prefer) switch back to using this one to get this update and any future updates I make. In the future if you have add requests, leave me a message on my talk page. I won't be actively checking Wikipedia, but if you leave me a notification, I get an email that prompts me to check here, and I should respond in a somewhat timely manner. Also fell free to update the documentation here for the registers I just added and for any that are added in the future.--Dudemanfellabra (talk) 07:35, 3 October 2017 (UTC)[reply]

Failed edit

[edit]

Hi Dudemanfellabra. In the last days, the tool fails. In all cases, its work stops on "FailedEdit" message. (At the Czech Wikipedia.) --ŠJů (talk) 11:39, 11 October 2019 (UTC)[reply]

@ŠJů and TheCatalyst31: I have been out of action myself and just came back to the same error. Possibly https://wiki.riteme.site/w/index.php?title=User%3ATheCatalyst31%2FAddCommonsCatLinks.js&type=revision&diff=921658890&oldid=921658648 is the answer. I have not been able to check it myself yet. Agathoclea (talk) 18:58, 7 November 2019 (UTC)[reply]
There's more background here, but long story short, there was a change to how edit tokens work that broke a lot of user scripts. Since Dudemanfellabra is inactive, I copied the script into my userspace to fix the problem, so you might have more success with that version. (The version I copied has some other changes to support Chrome better, and it might be missing some of the more recent improvements to the original script, so I can't guarantee it will work if you're not in Chrome; if you have issues with it, let me know and I'll look into it. It's also not available on non-English wikis yet, though in theory I can look into that too.) TheCatalyst31 ReactionCreation 00:24, 8 November 2019 (UTC)[reply]