People who know about translation (of pages at this wiki), please take a look at the discussion at Topic:Vgyp1i2xclcx598p and explain to me (here) why inserting "manual" anchors that duplicate existing section headings, as in this edit is "required" to make translation work. Or, if that is not actually the case, explain that to User:Shirayuki (there).
Topic on Project:Village Pump/Flow
Appearance
For convenience, when linking to sections from translated pages, the English anchor name is used, to prevent it to be translated and then the section title may have a different translation, causing the link to point to a not existing anchor.
This is one way to solve it, but of course has issues. This can be partially solved if we create a new template for this, that only includes the anchor when inserted on a translated page and not on the main one. However, it will still generate duplicate IDs on translated pages where the section title hasn't been translated and defaults to the English one, or by coincidence the translated section is the same in English.
Another option would be to generate specific anchor IDs not in use by section titles, but that won't be obvious when used inside links.
Not understanding all implications, but if that template would contain as parameters
- English section title
- (optional) translated section title
the template might decide whether both are equal, and create auxilary anchor iff they differ.
Then the section might be addressed always by both English or local name, and will be shown with local name, if needed to be provided.
That would require 2 translation units, one for the section title and another for the parameter of that template. It's like my first proposal, except that it only would cause duplicate IDs in the rare case that the template parameter is translated but the section title is not
It does not create any duplicate.
Template programming would compare both English and other, and create auxilary anchor iff (if and only if) they differ (and on non-English page).
For keywords, names, codes it might easily happen that the title is not translatable.
That would be possible only if the template is responsible of rendering the section title itself, not the current implementation of the anchor template that's rendered outside of the section title.
Yes, it is dedicated to some {{Template:TranslationHeadline|english|local}}
with optional local translation.
If english not equal to local then add additional id=""
.
Since the entire thing is dealing with headlines, it may also bear the headline markup by ==
or <h2>
business with further parameter level (2, 3, 4):
{{TranslationHeadline|level|english|local}}
Hi all . Having fighted with rereading I confirm the anchor is needed because the reference use it. The reference is generally hidden to the translator so that the anchored text to be always at the same position. More of that the anchor is NEVER translated that means it is outside of the 'translate' sections. Then when you read the documentation you see that in the english text, all sections '==' are automatically anchored (call to template is not explicitly required) and this works in the english text but no longer in the translated text because the section title has been internationalized so that the english anchor must be set manually in the root page. At last we can say anchor can be anything but we use the text of the following section to have an idea of what it is about. Multiple anchor definitions of the same referenced element are allowed and they are here to facilitate the calling from different contributors point of view. No major problem found with Template anchor until now.
Christian FR (talk) 12:42, 26 February 2020 (UTC)
Just in case anyone reading this doesn't already know, multiple anchors can be tied to a single section heading using something like:
==<span id="Alternate1"></span><span id="Alternate2"></span>Section==
In this case, "Section" is what is displayed (on, say, the page "Article"), and can be linked to using:
[[Article#Section]]
but these links lead to the same target:
[[Article#Alternate1]] [[Article#Alternate2]]
This is better than using a template call separate from the heading (and can be accomplished by "subst:"ing the {{anchor}} template inside the heading itself), because it avoids having a template call at the end of one section that actually refers to the next section (as happens if the template call is placed above the section heading) and places the anchor inside the section heading itself, unlike what would happen if a template call was used after the section heading. It also produces clean a page history, because the software automatically ignores the 'span' element(s) in that context. For details, see w:Template:Anchor.
I think this approach would also allow translation to proceed in the usual way — e.g., by using, say:
==<span …></span>Section== <!--T:11-->
Am I wrong?
I have not tried this form, but ok if you confirm. All '==' section titles I have met are 'pure' without any overloading. Thus the contents is isolated from the format and it complies with the recommendations of the site. Format uses CSS or content-external declarations like the anchors set apart). Recommendations also reject the beautify actions or presence of link references in titles. On the other side, when separating contents from format, we immediately identify what is where. Keep also in mind that 'anchor' can reference any part of the html page and not titles only.
Just FYI: I think I understand the first two sentences of what Wladek92 just said, but pretty much nothing after that. Since I do not know anything about translation, people should not rely on me to act on any recommendations put forth in this discussion.
That would be my option 2 of my first message. Note that such spans should be inside <tvar> sections to prevent translators to changing them, and also remove that markup from translations
Since this discussion has petered out, I'd like to ask the participants (or anyone else) whether any consensus has actually been arrived at, and if so, what actions have been taken as a result. Have any instructions/recommendations about translation been changed anywhere? Is anyone doing translation differently? If not, then nothing will have been gained by anything said here.
I have answered to your question requesting clarification and dont see what is wrong or should be modified : "explain to me (here) why inserting "manual" anchors that duplicate existing section headings".
Christian FR (talk) 17:04, 9 March 2020 (UTC)
Hmm. You may have tried to answer my question, but I'm afraid it did not serve as "clarification" from my perspective.
Since you say you don't see what is wrong, I will explain in great detail:
The way the "anchor" template is being used on pages like Help:Links results in multiple "id" attributes having the same value in the generated HTML. This makes the HTML invalid.
The current version of Help:Links contains the following duplicate "id" attribute values:
- Internal_links
- External_links
- External_links_to_internal_pages
- Interwiki_links
- Interlanguage_links
- See_also
In the first case, for example, the wiki markup:
{{anchor|Internal|Internal links}} <translate> == Internal links == <!--T:3-->
results in the following generated HTML:
<p><span id="Internal"></span><span id="Internal_links"></span> </p> <h2><span class="mw-headline" id="Internal_links">[...]</h2>
The fact that there are two different "span" elements having the same "id" attribute value "Internal_links" makes the HTML invalid. If this kind of thing can be avoided (and it sounds like it can be, based on what others are saying here), that would be preferable.
Hi I'm back. I just reread your text and I effectively from W3C it is considered as an error => https://validator.w3.org/nu/?doc=https%3A%2F%2Fwww.mediawiki.org%2Fwiki%2FHelp%3ALinks
On the translated pages the problem disappears and it is why the 'anchor' forced declaration has been used reestablishing the funtionality; here example in FR page:
<p><span id="Internal"></span><span id="Internal_links"></span> </p> <h2><span class="mw-headline" id="Liens_internes">
So apart source is not W3C compliant, can you explain which problem this brings to you ? Then we can bring a solution but at lowest costs, that means updating the pages calling this anchor and knowing its is always delicate to start by modifying the templates. On the other side, if it was only a remark, just ignored as proposed by Shirayuki.
Christian FR (talk) 14:54, 29 March 2020 (UTC)
I have no further explanation to give. The invalid HTML is the problem. (Along with the suboptimal situation of "having a template call at the end of one section that actually refers to the next section".)