Template talk:Expand language
Template:Expand language is permanently protected from editing because it is a heavily used or highly visible template. Substantial changes should first be proposed and discussed here on this page. If the proposal is uncontroversial or has been discussed and is supported by consensus, editors may use {{edit template-protected}} to notify an administrator or template editor to make the requested edit. Usually, any contributor may edit the template's documentation to add usage notes or categories.
Any contributor may edit the template's sandbox. Functionality of the template can be checked using test cases. |
This is the talk page for discussing improvements to the Expand language template. |
|
Archives: 1, 2Auto-archiving period: 12 months |
This template does not require a rating on Wikipedia's content assessment scale. It is of interest to the following WikiProjects: | |||||||||||||||
|
This template was nominated for deletion. Please review the prior discussions if you are considering re-nomination:
|
Location of this and related templates within articles
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 template
@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 documentation
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)
- @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)
- 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)
- 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)
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 templates
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)
- @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
- 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)
- 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)
- @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)
- 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)
- 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)
Comprehensive category ifexist checking
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)
- 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)
Recommendation of third resource tip for "machine translator" basis
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)
Improving wording/usability
The Click [show] for important translation instructions.
is rather awkward. Wouldn't it be better for the button itself to explain what it does intuitively, rather than having that information elsewhere in the tag? {{u|Sdkb}} talk 06:07, 22 October 2021 (UTC)
Merging all Expand language family templates
By dint of some changes I've made to the doc recently and several months ago, I've now persuaded myself that it is possible to merge all of the Expand language family of templates into one main template. The main differences between specific "Expand LanguageName" templates involve differences in the use of topic codes, topic names, and subcategorization, and a single suite of doc pages already handles this for all languages. Further changes of this nature, along with some config data in the right place (which could just be a few parallel subtemplates amounting to a long #switch statement with one case statement per language, and one subtemplate per field, or perhaps an {{Item}} data structure for everything, or even new properties at d:Q34770) to store and isolate the language differences, with a single top-level template replacing all of the Expand French, Expand Spanish, and other templates. (Besides making a merger feasible and fairly straightforward, if done correctly this would also facilitate porting the merged template to other Wikipedias, since all of the items needing translation would be isolated in one place, with the core template code ideally remaining identical across Wikipedias.)
There are some minor discrepancies in topics, such as Italian topic code 'transport' equating to topic name 'Transportation', whereas French 'transport' equates to 'Transport', but those can be dealt with via Category redirects at the outset. There will probably be various other little glitches of that nature in a merger this big, and I could be mistaken, but at this point I don't foresee anything that would be a deal-breaker to performing a merge. If designed correctly, I anticipate that this merger will be tedious, long, and somewhat involved, but not complex as far as design, construction, or code-reading issues. I expect it to be simpler than the current {{Expand language}} template, with a suite of supporting helper-subtemplates.
The current {{Expand language}} template has separate functionality which includes multiple languages, and that would not merge well with the others, at least not at the outset, and would probably have to continue as "Expand language multi" for a while, until after the dust settled from the first mega-merge, and it might not be practical to merge it with the unified single-language version.
I'm not going to get to this right away, or anytime soon probably, and I'm not even sure if it's worth doing, but I know it's possible, now. User:Primefac recently did something analogous to this, with the merger of the Template:Family name hatnote suite of templates (except for a couple of stragglers) all united in one template. Mathglot (talk) 08:10, 5 November 2021 (UTC) updated by Mathglot (talk) 20:27, 6 November 2021 (UTC)
- This sounds like a great idea! I started attempting this ages ago and gave up because it was too hard. Calliopejen1 (talk) 02:51, 12 November 2021 (UTC)
Template-protected edit request on 4 March 2022
It is requested that an edit be made to the template-protected template at Template:Expand language. (edit · history · last · links · sandbox · edit sandbox · sandbox history · sandbox last edit · sandbox diff · test cases · transclusion count · protection log) This template must be followed by a complete and specific description of the request, so that an editor unfamiliar with the subject matter could complete the requested edit immediately.
Edit requests to template-protected pages should only be used for edits that are either uncontroversial or supported by consensus. If the proposed edit might be controversial, discuss it on the protected page's talk page before using this template. Consider making changes first to the template's sandbox and test them thoroughly here before submitting an edit request. To request that a page be protected or unprotected, make a protection request. When the request has been completed or denied, please add the |
I propose editing the bullet points that talk about copyright attribution so that the otherarticle parameter is no longer required. Here is the new code for that, commented out so as not to break the page:
* You '''must''' provide [[Wikipedia:Copying within Wikipedia|copyright attribution]] in the [[Help:Edit summary|edit summary]] accompanying your translation by providing an [[Help:Interlanguage links|interlanguage link]] to the source of your translation. A model attribution edit summary is {{#if: {{Mw lang|fn=is_code|{{{langcode}}}}} | <code>Content in this edit is translated from the existing {{#language:{{{langcode|}}}|en}} Wikipedia article at <nowiki>[[:</nowiki>{{{langcode}}}<nowiki>:</nowiki>{{#if:{{{otherarticle|}}}|{{{otherarticle}}}|{{#if:{{Wikidata sitelink|lang={{{langcode|}}}}}|{{Wikidata sitelink|lang={{{langcode|}}}}}|Exact name of the article}}}}<nowiki>]]</nowiki>; see its history for attribution.</code> | (using German): <code>Content in this edit is translated from the existing German Wikipedia article at <nowiki>[[:de:Exact name of German article]]</nowiki>; see its history for attribution.</code> }}
* You should also add the template {{#if:{{{otherarticle|}}}|<code><nowiki>{{Translated|</nowiki>{{{langcode|}}}<nowiki>|</nowiki>{{{otherarticle}}}<nowiki>}}</nowiki></code>|{{#if:{{Wikidata sitelink|lang={{{langcode|}}}}}|{{Wikidata sitelink|lang={{{langcode|}}}}}|{{tl|Translated page}}}}}} to the [[{{TALKPAGENAME}}|talk page]].
-- Numberguy6 (talk) 18:07, 4 March 2022 (UTC) Numberguy6 (talk) 18:07, 4 March 2022 (UTC)
Template-protected edit request on 6 March 2022
It is requested that an edit be made to the template-protected template at Template:Expand language. (edit · history · last · links · sandbox · edit sandbox · sandbox history · sandbox last edit · sandbox diff · test cases · transclusion count · protection log) This template must be followed by a complete and specific description of the request, so that an editor unfamiliar with the subject matter could complete the requested edit immediately.
Edit requests to template-protected pages should only be used for edits that are either uncontroversial or supported by consensus. If the proposed edit might be controversial, discuss it on the protected page's talk page before using this template. Consider making changes first to the template's sandbox and test them thoroughly here before submitting an edit request. To request that a page be protected or unprotected, make a protection request. When the request has been completed or denied, please add the |
It seems that there is a bug in the code that generates links to Google Translate.
Problem: At Pinuccio Sciola, the "View" link leads to [1] which says "Can't translate this page". It seems that it has to do with the space between the words, and if you replace "+" there with "_", it works: [2].
Suggested fix: Replace {{urlencode:{{{otherarticle}}}}} with {{urlencode:{{{otherarticle}}}|WIKI}}. Whym (talk) 12:23, 6 March 2022 (UTC)
- Template-Class Translation studies articles
- NA-importance Translation studies articles
- WikiProject Translation studies (general) articles
- WikiProject Translation studies articles
- Template-Class language articles
- NA-importance language articles
- WikiProject Languages articles
- Wikipedia template-protected edit requests