Page MenuHomePhabricator

Consistent tvar convention
Open, Needs TriagePublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  • Tag for translation a section containing multiple paragraphs and links using https://toolhub.wikimedia.org/tools/toolforge-translatetagger
  • The process shall include nested <tvar> elements within these distinct blocks/paragraphs.
  • Observe if the tvar naming mechanism resets its integer counter for each independent block or maintains a global count.

What happens?:

Currently, the tvar naming mechanism may struggle to maintain consistent auto-incrementing when multiple separate <translate> blocks are present, potentially leading to name collisions or non-intuitive numbering across the page.

What should have happened instead?:

The tvar naming mechanism should be improved to ensure that each distinct block/paragraph initiates its own sequence, assigning auto-incrementing integers starting from 1 (e.g., <tvar name="1">, <tvar name="2">) scoped to the specific block. This ensures clear, localised tracking of variables within every paragraph.

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):
N/A

Other information (browser name/version, screenshots, etc.):

The desired implementation is as follows:

<translate>
This is a paragraph linking [[<tvar name="1">Special:MyLanguage/Wikipedia</tvar>|Wikipedia]] and [[<tvar name="2">Special:MyLanguage/Wikimedia Commons</tvar>|Wikimedia Commons]].

And this is a paragraph that links to [[<tvar name="1">Special:MyLanguage/Wikidata</tvar>|Wikidata]], restarting the count from "1".</translate>

Each block resets the counter, allowing name="1" to be reused logically across separate translation units.