Template talk:Expand language

Active discussions

Location of this and related templates within articlesEdit

For information, there is a discussion at Templates for discussion about where this and related templates should appear in articles, with a possible outcome that they should be placed only at or towards the ends of articles, and not at the beginning. Hallucegenia (talk) 19:23, 18 April 2021 (UTC)[]

improving templateEdit

@Mathglot: pinging you at your request. My earlier post: " Right now the link for corresponding article has a switch so that it calls Wikidata information where the article is not specified. I would like the same behavior to happen for the creation of the machine translation link at translate.google.com." Basically, if there is not an article name specified, I want there to be a Google translate link generated based on the title in the foreign language at wikidata. (Currently, if no title is specified, no machine translation link is added.) This behavior already exists elsewhere in the template, just trying to add it for the machine translation as well. Calliopejen1 (talk) 13:34, 16 September 2020 (UTC)[]

@Mathglot: thoughts? Calliopejen1 (talk) 23:00, 25 September 2020 (UTC)[]
Calliopejen1, this might need a feature that is not yet available in order to implement it. I got a response at Module talk:Wd#Titles from other wikipedias to a question I posed there, regarding a subtask that I believe would be necessary in order to implement your request. I'm still looking around for other methods that might work; perhaps Thayts will have an idea. Mathglot (talk) 05:45, 27 April 2021 (UTC)[]

Improving multiple language documentationEdit

Hi Mathglot, just wanted to follow-up from the template discussion. I poked around and I think my confusion came from the fact that only (I believe) Template:Expand language can have the multiple language codes. I had assumed the daughter templates, like Expand Italian, could take the multiple language arguments, but they failed when I tried to use them. If either the main template multiple languages header had another sentence or the daughter templates had a single line to the effect of "You have to use Expand language to link to multiple language wikis", I think I would have been able to figure it out. —Wingedserif (talk) 12:22, 20 April 2021 (UTC)[]

@Wingedserif: thanks for adding your experiences here. That makes sense and should be easy to fix. The template itself is protected, but the doc page (Template:Expand language/doc) is not. This is a wiki; if you'd like to make an addition or change to the template doc to add that line, or some other wording that might have helped you earlier, by all means do so. As far as the daughter templates, I'll take a look later to see if they transclude bits of the doc, or if we'd have to add wording individually to each one. Thanks, Mathglot (talk) 19:51, 20 April 2021 (UTC)[]
Now that I look at it, there have been a number of changes made to the functionality of this template, which changed it from a template not to be used on article pages, to one that is designed for article pages. The documentation was not altered to keep up fully with those changes, as it should have been at the time those changes were made. In any case, we may need to make additional changes to the doc of this page to rectify that, beyond just the one issue you raised here. However, this type of additional change isn't on you, Wingedserif; I'm only mentioning it here while it's fresh in my mind so I don't forget, and to alert other habitual editors of the template of this situation. If you make just the one change based on the issue you first identified, that would be plenty. That said, you have as much right as anybody else to dive in and fix up the entire doc page based on the current state of the template code, if you feel like it. Thanks again for your comment above. Mathglot (talk) 20:12, 20 April 2021 (UTC)[]
The lacking documentation is probably largely on me (I added the multi-language support and some other minor improvements in early 2020). I I'll have a look and see what I can do. --Trialpears (talk) 20:19, 20 April 2021 (UTC)[]
I've gone through the docs and tried to improve it and make sure everything is documented. Don't have more time today, but I believe there should be some categorisation improvements to the template as well to prevent nonexsistent topic or fa categories to be added when used in the main template directly. When that is done basically everything should be possible to do using the main template without issues. With a solution like {{globalize/name}} it would be possible to add aliases to allow for things like "French" instead of fr which would make it possible to have one easy to use template for all languages. I'm not sure if that last step would be desirable though. --Trialpears (talk) 20:55, 20 April 2021 (UTC)[]
@Trialpears:, I can see that there is already code to prevent non-existent category generation per fa or bad topic, but I haven't run tests to see if they work or not. Maybe add some testcases, and we can work from there. Adding 'fr' or 'French' already exists in some templates, such as {{Needtrans}} and is pretty easy to do. I wouldn't bother with the code, though, until the active Tfd resolves itself. Mathglot (talk) 00:48, 23 April 2021 (UTC)[]
Mathglot The non-existent categorization code was not comprehensive and not fully applied for topics and FAs. It is now however. There is still some problems with missing categories for topic though which I may fix shortly (no promises though). I don't feel like this is the project I want to push for right now, but I could help out with implementation if you want to. --Trialpears (talk) 23:59, 24 April 2021 (UTC)[]

Starting with Wingedserif's comment and fix, I started to look at the doc, and realized it was inscrutable and incomplete. The most basic feature of the template, namely that it has two rather different purposes, for which only some parameters are used in each case, was completely ignored. (Not that any of the parameters were described before. I start chipping away, and in the end, all the little chips ended up amounting to a rewrite. Because of the double purpose, the standard set of template doc sections didn't really work well, so I came up with something different, which I think works; see what you think. I'm not done yet (categorization isn't completely described, and there are other problems) but I'm stopping for now. Jump in and lend a hand, if you feel like. Mathglot (talk) 00:52, 23 April 2021 (UTC)
I'm switching to the /howto now, and expanding it, adding some doc for stuff that isn't available for all languages, like |fa= and |topic=, and I'm trying a couple of ways of handling it. Mathglot (talk) 05:50, 27 April 2021 (UTC)[]

Improving documentation of daughter templatesEdit

The daughter template documentation has been expanded, in the sections on Parameters, Categorization, and especially in connection with the table of valid topics, and their associated subcategories. I've updated the /howto to include sections on Topics map to subcategories. The the rows in the the topic table are dynamically generated based on whether the category for the topic code exists. The |geo= code (Geography topic) is by far the most common subcategory and the most highly populated, so its associated subcat is used as a proxy for whether to mention topics at all for a given Expand <language> daughter template. Details at {{Expand language table row}}. Mathglot (talk) 10:17, 28 April 2021 (UTC)[]

Trialpears, I've completed the documentation upgrade for the daughter templates. Can you give it a once-over? Also, there's a white-space issue I haven't been able to fully resolve, although I can live with the current version. Contrast, for example, the "topic table" in the #Categorization section of the doc, as seen in Expand FOO templates that have many table rows and subcategories (such as {{Expand French}}, {{Expand German}}, and {{Expand Italian}}) with templates that have just a few rows/subcats ({{Expand Catalan}}, {{Expand Czech}}, {{Expand Estonian}}), and notice the white space above in each case. In the shorter tables, the extra white space above is rendered as one or more sets of paired <p></p> tags, each pair generating another blank line above. There's a strong correlation between the number of p-tag pairs, and the number of "missing" rows in the table, based on subcats that don't exist; thus, the shorter the table, the more white space above. The rendered topic table html structure in the generated page html looks correct to me, and I don't see how a "missing" row would generate a pair of p-tags above the whole table, because that would impl a two-pass compiler, I think, and I always assumed it was one-pass, but who knows.
In any case, like I said, I can live with the extra white space, and I wouldn't spend much time on this, but I admit to being curious what's going on here, as I'd like to understand what mediawiki is doing in this case. I should also probably mention that the use of direct html for the table was my second choice, and I first tried it with wiki table markup. I switched to an Html table after multiple attempts to fix an earlier white space problem were unsuccessful, and corrupted rows in the table itself. I finally abandoned the wiki table, and switched to html. You can find the evidence of my attempts to fix the earlier problem in the history of the table row generating template if you're curious.
I also gave a bit of thought to thinking how one could unite the main table at {{Expand French}} with the single-row table below it (for pacommune) but then decided fairly quickly it wasn't worth it, especially, because the French template may be the *only* template that uses a non-standard topic and subcat like this, although theoretically, any of the daughter templates could. If you think of a clever way to fuse the two tables, though, let me know. But the main thing is if you can just give the doc on the daughter templates an overall, global look, and see what you think. Thanks, Mathglot (talk) 19:37, 28 April 2021 (UTC)[]
@Trialpears:, managed to unify the table; was easier than I thought. It simply involves a /topics subpage of the daughter template, containing any supplementary rows that are needed. In the case of French, this is in Template:Expand French/topics. I also added another topics table column for cat counts, which I find useful. See {{Expand French}} as an example. Mathglot (talk) 09:30, 1 May 2021 (UTC)[]
That looks good! The French commune tree looks like a right mess though with direct in article cleanup categories and such. Not gonna bother with it though. --Trialpears (talk) 10:55, 1 May 2021 (UTC)[]
Indeed; I was hoping that exposing the numbers right in the doc, might serve both as a reminder to use the topic param, as well as spur someone perhaps to work on the categories. I have in mind another change that might catch editors right when they are adding the template, which is either something in preview mode, or something in the expanded banner (i.e., after they click 'show') which would list the ten topic codes, possibly with the article counts, and gently suggest they use the topic param if relevant to the article that has the banner. Mathglot (talk) 11:37, 1 May 2021 (UTC)[]
@Trialpears:, I ended up implementing something for the expanded banner, but cut it way back to just a suggestion to use 'topic' for cases where it's not already being used, and where the main category contains over 200 articles. There's a link in the prompt to the topic table for the language, so they can choose a topic from the ones already in use. Examples: Chamber of Deputies (Mexico) (shows the prompt); Province of Barcelona (no prompt: already uses 'topic'); Seget, Croatia (no prompt: doesn't use 'topic', but <200 articles in the main category). Mathglot (talk) 19:44, 13 June 2021 (UTC)[]
Mathglot That looks quite nice! If it wasn't already collapsed I would consider placing it as a preview notice instead, but only people deliberately expanding the banner would see it so that isn't a problem. Do you know if all major languages support the topic parameter? If not that should probably be ensured to avoid non applicable messages. --Trialpears (talk) 19:55, 13 June 2021 (UTC)[]
Not sure I understand the question 100%, but the way I read you, "yes", but also, "it doesn't matter", because I believe the current code will avoid displaying any non-applicable messages whether they support 'topic' or not. If you can think of some test cases that would produce the failure (or that would produce it if future changes break the conditionals that currently avoid that problem), can you please add them to the test cases page?
I'm agnostic about whether it should be a Preview message or not; I guess the reason I went with the expanded banner, is that for 99% of page visitors it doesn't matter, since they won't expand the banner (is there a way to get statistics on that?), and for the 1%, the banner is already pretty long, and if that scares them they'll back off, and if it doesn't we've lengthened the banner by 10% or so, and I thought that was pretty insignificant. Maybe we should do both, and add it to Preview mode as well, because that is seen by a different set of editors (and by "seen", I mean the 1% of non-banner blinded users that are really looking at the Preview). Mathglot (talk) 20:13, 13 June 2021 (UTC)[]
Add missing ping @Trialpears:. Mathglot (talk) 20:15, 13 June 2021 (UTC)[]
The case I was reffering to was the message being displayed on an instance of {{Expand Fooian}} but Fooian didn't have topic level subcategories. I don't see how that would be prevented in the current code but I think the best solution would just be to make sure all languages which may reasonably have 200 uses of the template also has topic categories. --Trialpears (talk) 20:42, 13 June 2021 (UTC)[]
@Trialpears: Ah yes; I remember coding something for that case and thought it was in {{Expand language}}, but turns out it's in the template that generates the /doc pages for the specific languages. Note the difference, for example, in the topic tables at {{Expand Spanish}}, {{Expand Catalan}}, and {{Expand Basque}}. The key in skipping the table in the Basque case, is a fact I noted about topic geo in the hidden comment at Template:Expand language/howto—search the wikicode for 'proxy'.
To address the issue you posed, we should just import that same condition into the test for whether to generate the 'topic' prompt in the expanded banner. I probably won't get to that soon, but feel free if you're so inclined. That will add one expensive parser function, but that shouldn't be an issue for any page other than a vastly expanded testcases page, and probably not even there. P.S. It's conceivable that things could evolve, such that the "geo-proxy trick" won't work perfectly at some point in the future for some language, but things change slowly and I think the proxy trick is good enough for now. I believe it works for all major languages, and possibly for all languages at present. If you find a counterexample, please add it to the comments. Mathglot (talk) 22:51, 13 June 2021 (UTC)[]

Comprehensive category ifexist checkingEdit

Hi, Trialpears, can you explain what you were going for in this edit? What functionality or fix do we have now, that we didn't have before? Also, if you meant to include all categories, what about the topic-defined subcats? Mathglot (talk) 11:07, 28 April 2021 (UTC)[]

Mathglot, it prevents the template from adding articles to nonexistent categories. Not all categories were checked to exist before this edit. I think I took care of the topic categories? --Trialpears (talk) 13:34, 28 April 2021 (UTC)[]
Ah okay, thanks. Because of the use of expensive parser function calls, this should probably be mentioned in the /doc somewhere. See the row template doc for an example of how I did it. Mathglot (talk) 19:39, 28 April 2021 (UTC)[]
Sorry kind of forgot about this. I've added a bit about the expensive parser functions. Shouldn't be a problem anywhere since this template is only used once and doesn't use a ridiculous number of them, but might as well mention it. --Trialpears (talk) 11:03, 1 May 2021 (UTC)[]

Recommendation of third resource tip for "machine translator" basisEdit

The template already recommends DeepL and Google Translate. As a third starting-point, I believe the template should also mention Yandex Translate which is both notable and reliable in both my and others' experience. The quality for common languages such as e.g. German, French seems to, on average, range somewhere between DeepL and GT. YT does seem to have a higher rate of explicit mistakes like not translating certain terms; however I've had many cases where Yandex had the best tone overall. So, I believe "third time's the charm" here.--~Sıgehelmus♗(Tøk) 03:15, 14 May 2021 (UTC)[]

Return to "Expand language" page.