Jump to content

Project talk:Terminology gadget

From translatewiki.net
Latest comment: 28 days ago by Stjn in topic Automatic mode support
This discussion page previously used LiquidThreads. You can see and continue those discussions on the LiquidThreads archive page (all archives).


German localization broken because of FORMAL

@Jon Harald Søby: While I was working with the interface today I noticed that the "Add term" dialog shows the German translation MediaWiki:Gadget-term-dialog-footnote/de raw, unparsed. I believe this revert was done for this reason, and undoing it was not correct. But I don't want to get involved in an edit-war. It looks like messages that are parsed in the frontend really can't use the FORMAL feature as long as phab:T366602 is not fixed (and deployed here). The responsible jqueryMsg and mw.language modules don't contain any code for FORMAL and apparently break and stop working when curly braces are nested in a way the code can't understand. TMg (talk) 11:00, 6 August 2024 (UTC)Reply

@TMg: That's not the reason the revert was made, that user just really doesn't like this feature. But yeah, I've just reverted it now until gerrit:1038812 (or an alternative) is merged. Jon Harald Søby (talk) 11:26, 6 August 2024 (UTC)Reply

Newlines eaten on the legacy interface

Please take a look at https://translatewiki.net/w/i.php?title=MediaWiki:Blockedtext-partial/hu&action=edit. Before the gadget loads (or if it’s disabled), the English message contains several line breaks. Once the gadget loads, they disappear. The same message appears as expected on Special:Translate; the newlines are kept there. Could you please fix the legacy interface? Thanks in advance! —Tacsipacsi (talk) 16:33, 13 August 2024 (UTC)Reply

@Tacsipacsi: Thanks for the report! It should be fixed with this and this edit. Please verify. :-) Jon Harald Søby (talk) 11:05, 14 August 2024 (UTC)Reply
@Jon Harald Søby: Thanks, looks good! However, the JS change looks a bit scary: what if the line break is formatted differently (<br />, <br style=""> etc.)? Maybe the Translate code should be changed so that it also uses white-space:pre-wrap instead of HTML line breaks. —Tacsipacsi (talk) 11:16, 14 August 2024 (UTC)Reply
Created phab:T372463. —Tacsipacsi (talk) 11:38, 14 August 2024 (UTC)Reply
@Tacsipacsi: I think it should be safe, because the <br /> tags are inserted by the extension (converting line breaks into <br \>), and I don't see any reason why that would change to something different in the foreseeable future. But yeah, changing it in the extension would also solve the problem, but I'll leave that to someone else for the moment. :-) Jon Harald Søby (talk) 11:41, 14 August 2024 (UTC)Reply

Automatic mode support

@Jon Harald Søby: currently, the gadget works fine in night mode, but it doesn’t support automatic mode with prefers-color-scheme: dark. Can you modify MediaWiki:Gadget-terminology.css to also have automatic mode support, as shown in mw:Recommendations for night mode compatibility on Wikimedia wikis#Target night mode using standard media query as well as HTML classes? stjn[ru] 14:53, 19 October 2024 (UTC)Reply

Additionally, in my opinion, it would be good to not duplicate styles between MediaWiki:Gadget-terminology.css#L-111 and Template:Discuss term and just put all of them into Template:Discuss term/styles.css. I moved the existing styles to that page to solve the Special:LintErrors/night-mode-unaware-background-color lint error that was coming from the template usage. stjn[ru] 11:23, 21 October 2024 (UTC)Reply
I don’t think merging them is feasible. Editing gadget styles requires a higher level of trust than TemplateStyles. While storing the gadget styles as TemplateStyles closes many of the attack vectors, some still remain (e.g. TemplateStyles constrain the styles to parser output as a security measure, but this doesn’t happen if you load the page as if it was a gadget style page).
On the other hand, supporting automatic dark mode is absolutely possible and necessary; in fact, I also wanted to complain about it, but you were quicker. —Tacsipacsi (talk) 18:33, 23 October 2024 (UTC)Reply
I think you misunderstood me. I am not proposing moving entire gadget styles into a TemplateStyles page, I am proposing moving the parts that are related to Template:Discuss term template (that’s why I linked to that page specifically and to specific line), not the entire gadget styles. I think it’s reasonable to store those on that page and not on the gadget page.
If Jon wants to make them non-editable by the wider public, they can protect the page in question to admin level (though it would be annoying in case something would need to be fixed again). stjn[ru] 22:22, 23 October 2024 (UTC)Reply
gadget-term-discuss is used in MediaWiki:Gadget-terminology.js, so it needs to load the styles, and that is the point at which we have the trust problem (even if the page was fully protected: there are currently 59 admins on the wiki, of which only six are interface admins, so 53 users without interface admin rights would get access to it). Or all occurrences of this class in the script refer to the template, and the script itself doesn’t need the styles? —Tacsipacsi (talk) 22:38, 23 October 2024 (UTC)Reply
The gadget can obviously continue to refer to that class. The problem is that template defined a bunch of its own styling for no-JS case and then the gadget defines a bunch of mostly duplicated styling separately. I am suggesting that template-specific styles should be defined in the template styles. stjn[ru] 23:13, 23 October 2024 (UTC)Reply