Template talk:Other date

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Strange link[edit]

Hi everyone, Jarekt, don't know since when but now this template generates a strange link to edit the template (example: File:Meyers b5 s0529 b3.png). Before only the the date was rendered without any link. --Arnd (talk) 04:46, 22 June 2018 (UTC)[reply]

Arnd, I am sorry but I do not see any link in the date field. I tried English and German versions. Can you clarify? --Jarekt (talk) 11:39, 22 June 2018 (UTC)[reply]
Jarekt, u r right now. It disappeared. Before the entire rendered date was linked to [1]. --Arnd (talk) 11:41, 22 June 2018 (UTC)[reply]

Broken with several browsers[edit]

I am getting errors with this template with several browsers on several computers.

  • On File:Cambridge Street Tram.jpg, {{other date|circa|1880|1890}} is rendered as [//commons.wikimedia.org/w/index.php?title=Module:I18n/complex_date&action=edit circa 1880-circa 1890] This used to display correctly.
  • On the Template:Other date page most of the 'output' columns are displayed in red. The examples with 'circa' show code in red, similar to that given above.

I see these errors on:

  • Google Chrome on Windows 10 (tested on two computers)
  • Microsoft Internet Explorer on Windows 10
  • Firefox on Ubuntu Linux

The errors do not appear on Microsoft Edge on Windows 10. The software on these computers is up-to-date. Verbcatcher (talk) 16:21, 26 June 2018 (UTC)[reply]

It doesn’t depend on the browser. It does appear both in Firefox (Ubuntu 18.04) and Edge (Windows 10 Fall Creators Update) using Welsh interface, and doesn’t appear in either using English. The red texts show that that particular text is not translated into the user interface language, and feel free to translate them. The displayed URL, however, seems not to be intentional. @Jarekt?Tacsipacsi (talk) 19:25, 26 June 2018 (UTC)[reply]
Fixed? @Verbcatcher and Verbcatcher: I think I fixed it. Please verify. --Jarekt (talk) 20:35, 26 June 2018 (UTC)[reply]
The i18n links have disappeared. If it’s intentional, than it seems good for me. —Tacsipacsi (talk) 20:54, 26 June 2018 (UTC)[reply]
Yes, it is fixed, and I am seeing no red text using the English Language interface. I had to click on More->Purge to get the template page to display correctly. Thanks, Verbcatcher (talk) 20:59, 26 June 2018 (UTC)[reply]

I suspect that I was not seeing the problem with Edge was because I was not logged-in on that browser, which presumably was using the default language (US English?). On the other browsers I was logged in with my user preferences set to British English. Verbcatcher (talk) 21:18, 26 June 2018 (UTC)[reply]

The problem again occurs. Example File:Spisning av nävgröt och stekt fläsk NMA.0027743.jpg -> with [//commons.wikimedia.org/w/index.php?title=Module:I18n/complex_date&action=edit circa 1900-circa 1924] as date. --Arnd (talk) 11:57, 17 August 2018 (UTC)[reply]

Yes, I am seeing the same thing, on the page you have identified, at File:Cambridge Street Tram.jpg, and most clearly at Template:Other date. I only see errors with some interface languages (specify the language by clicking on the language name at the top of the page). With my default British English I get the same red errors and bare URLs that I described before. I have tried several languages: the following give errors: British English, Canadian English, Cymraig, Gaeilge, Scots. The following look ok: English, Deutsch, español, français, italiano, svenska. Jarekt, has you fix failed? Verbcatcher (talk) 20:54, 17 August 2018 (UTC)[reply]
I investigated the issue with regards to British English and Canadian English (and probably the others, but I haven't checked yet). In MediaWiki all languages have a "fallback chain" where if a translations for the exact language isn't available a related language is used instead (e.g. 'nds' Low German -> 'de' German -> 'en' English). All languages fallback to English as the language of last resort. I think the problem happens with languages whose only fallback language is English and for which English would be a perfectly acceptable fallback (instead of just a fallback of last resort). The langSwitch function in the Fallback module (and the custom version of this function in Complex date) insert a 'default' language just before English, on the assumption that code may wish to override the behavior of falling back to English as a last resort. If you look at Module:I18n/complex date you can see that the Complex date module does make use of this 'default' language. So, for British English the fallback will be 'en-gb' -> 'default' -> 'en'. In Module:I18n/complex date you can see that translations for 'from-until', 'between', 'century' (and many others) don't have a British English translation and have a 'default' translation. So for these date forms the default will be used (which is the red 'please translate me' form) instead of falling back to English. I think the solution is to add explicit translation for British English and Canadian English to Module:I18n/complex date for any form that has a 'default' language specified. —RP88 (talk) 21:57, 17 August 2018 (UTC)[reply]
I think I understand your analysis. I would have thought it preferable to fix the fallback mechanism rather than papering-over the problem by adding translations for closely-related languages, but I am not familiar with the code and don't know the pressures on the team that maintains it. (Also, Module:I18n/complex date is protected, so only administrators can edit it.) Your analysis does not appear to explain the problem with the circa syntax with two dates, where a bare URL is displayed that includes 'Module:I18n'. Verbcatcher (talk) 22:40, 17 August 2018 (UTC)[reply]
Also, your analysis does not explain why this functionality has switched between working and broken at least twice in the last few months. Verbcatcher (talk) 22:50, 17 August 2018 (UTC)[reply]
I think fallback is working correctly in that 'default' is supposed to be 'run custom code before using English'. The MediaWiki software itself (which provides the fallback chain) doesn't provide any kind of "closeness" estimate as part of the chain so the code has no way to know that "en-GB -> en" is "closer" than "de -> en". The difference in appearance between the 'please translate me' forms appears to be due to a difference in reporting the need for translation (simpler forms use the {{Please translate}} template, more complex conjunctions output an edit link with additional details about the parameters). I've updated the support for British English and Canadian English. How do they look? I don't know the translations for the other languages you mentioned, so I didn't add them. —RP88 (talk) 23:18, 17 August 2018 (UTC)[reply]
Thanks, the British English and Canadian English versions look now ok (I had to purge the file pages). You seem to have accidentally deleted eo='printempo $date1', which appears to be Esperanto for Spring.
I am still seeing [//commons.wikimedia.org/w/index.php?title=Module:I18n/complex_date&action=edit circa 1999-circa 2000] in Template:Other date with Cymraeg selected. Are you saying this is 'working as designed'? Verbcatcher (talk) 23:48, 17 August 2018 (UTC)[reply]
The difference in appearance for the 'please translate me' error doesn't appear to be a deliberate design decision. When dates have a complex nested structure (a translatable conjunction between two date forms modified by adjectives) the code outputs nested calls to {{Please translate}}, which don't really work correctly:
date1 = {{Please translate|circa 1999|page}} -> circa 1999
date2 = {{Please translate|circa 2000|page}} -> circa 2000
conjunction = {{Please translate|date1—date2|page}} -> date1—date2
nested = {{Please translate|{{Please translate|circa 1999|page}}—{{Please translate|circa 2000|page}}|page}} -> [//commons.wikimedia.org/w/index.php?title=Page&action=edit circa 1999circa 2000]
So it is a bug that when both the base forms and the conjunction are missing translations the code outputs difficult to decipher 'please translate me' messages. I'm not sure what is the best way to fix this. It only occurs for languages that are missing both the simple and complex translations. For example, if we added just the translation for the single date form of 'circa' for Cymraeg the dual date form would still show a red error, but the message would be reasonable. —RP88 (talk) 00:02, 18 August 2018 (UTC)[reply]
Thanks for noticing the Esperanto 'spring' omission, I've fixed it. —RP88 (talk) 00:13, 18 August 2018 (UTC)[reply]
Thank you. Unfortunately I don't speak enough Cymraig (Welsh), Gaeilge (Irish) or Scots to contribute these translations. For the problem with {{Please translate}} my initial approach would be try to modify the template to detect if it is a nested call, and for any outer-layer calls to not modify the data. Is this feasible and desirable? Is anything else going to call {{Please translate}} in this way? If this can't be fixed then at this stage then I suggest leaving a note at Template talk:Please translate. Thanks, Verbcatcher (talk) 00:57, 18 August 2018 (UTC)[reply]
I removed {{Please translate}} from Module:I18n/complex date and replaced it with red English version. Hopefully that should fix it. RP88 thanks for working on this, your diagnosis and fixes were very accurate. --Jarekt (talk) 13:51, 18 August 2018 (UTC)[reply]

Thank you for fixing this. The downside is that the links for adding a translation are not generated. I suggest we add a note to the template page to explain what the red text means and how to add a translation. I can't add this note because the page is protected and I'm unsure how one contributes a translation. Verbcatcher (talk) 16:04, 18 August 2018 (UTC)[reply]

I added a note to Template:Other date/doc, which is not protected. --Jarekt (talk) 16:29, 18 August 2018 (UTC)[reply]
Thank you. I am now seeing another error: at 'era parameter': Lua error in Module:Complex_date at line 336: bad argument #1 to 'sub' (string expected, got nil). This is shown with all the languages I have tried including English. I think this is new today. Verbcatcher (talk) 19:29, 18 August 2018 (UTC)[reply]
Looks like that error was introduced today at the edit Special:Diff/315243962, apparently intended to support the addition of wikidata QS codes to some of the two-date forms. I added a quick patch to get rid of the error and restore the original functionality, but I am not familiar with wikidata QS codes, so a better fix might have to wait for Jarekt. The error wasn't related to the era parameter, it happened with any date form the QS code couldn't handle, for the example (i.e. {{other date|or|985|986}}) I think it was the pre-gregorian dates. —RP88 (talk) 20:48, 18 August 2018 (UTC)[reply]

Bug in sl[edit]

{{Editprotected}}

Hi. Using some parameters like by or circa in sl language gives "Module:I18n/complex_date:33: Tried to write global yearCase" (example). --Sporti (talk) 09:55, 30 March 2019 (UTC)[reply]

Module:I18n/complex date’s 29th line should be
	local yearCase = {
—note the local. (I can’t fix it myself, as the module is fully protected.) —Tacsipacsi (talk) 14:02, 30 March 2019 (UTC)[reply]
Fixed --Jarekt (talk) 03:24, 2 April 2019 (UTC)[reply]

Error with "other date summer 1999" and similar[edit]

@Jarekt: : Since your rewrite using Lua {{other date|summer|1999}} results into "Summer April 1999". Correct would be "Summer 1999". And I see more such errors on Template:Other date directly. Raymond 14:05, 12 April 2020 (UTC)[reply]

Ok let me look at this. --Jarekt (talk) 14:23, 12 April 2020 (UTC)[reply]
Should be Fixed now. --Jarekt (talk) 14:54, 12 April 2020 (UTC)[reply]
Looks good, thank you for your fast fix. Raymond 15:26, 12 April 2020 (UTC)[reply]

One more error[edit]

We get Expression error: Unrecognized word "en". due to {{taken in|{{other date|between|1932|1937}}}} (example from here). -- Tuválkin 11:09, 14 May 2020 (UTC)[reply]

Fixed I do not know {{Taken in}} but it does not like output of {{other date|between|1932|1937}}. --Jarekt (talk) 12:27, 14 May 2020 (UTC)[reply]
  • I don’t know either, that’s why I come here. That’s no fix. -- Tuválkin 20:15, 14 May 2020 (UTC)[reply]
    • Template modified so that it doesn’t blow up with this input. However, this input doesn’t make any sense: “Taken in between 1932 and 1937” is, while being syntactically valid English, simply doesn’t mean the same thing as “Taken in 1932” or “Taken in May 1932”. So even though there’s no expression error, I still support Jarekt’s version on this particular file page. —Tacsipacsi (talk) 23:15, 14 May 2020 (UTC)[reply]
@Tuvalkin: this is not {{Other date}} issue which translates date related expressions to other languages, and it is also not an issue with {{Taken in}} which clearly states in the documentation that it takes date in ISO format. The issue is that someone was combining templates which were never designed to go together. If there is a need for {{Taken in}} template which can take input in other formats, than someone should write it, but until then we do not have a way to combine those. --Jarekt (talk) 01:25, 15 May 2020 (UTC)[reply]

Swedish translation[edit]

Please change c:a to cirka in the Swedish translation of this template. Thank you. Förbätterlig (talk) 11:19, 16 November 2022 (UTC)[reply]