Re: Info request on new Wiki translations - any automatic handling of translation headers and translated pages?
On Fri, Aug 08, 2025 at 08:56:06PM +0800, Maytham Alsudany wrote:
> On Fri, 2025-08-08 at 12:15 +0200, Beatrice Torracca wrote:
> > Hi all,
> >
> > sorry if this is been discussed elsewhere. I gave a look at the new test
> > wiki at wiki2025.debian.org and I wasn't able to find a dummy translated
> > page to have an idea.
> >
> > Is there a more "automatic" way in which translations will be handled by
> > the new wiki. Especially considering that, in the current one, the
> > translation header at the top has to be maintained manually both for the
> > English master page and the translations (though for that we created the
> > work around of including the header from the master page). I think there
> > is, if I look at Wikipedia for instance.
>
> https://www.mediawiki.org/wiki/Extension:Translate
> Not installed yet but we plan to set this up.
I haven't tried that extension before, but from the documentation I don't see a
way to e.g. create a "translations" header automatically. Here's a potential
solution - [0] and [1] show translated versions of a page,
[2] will automatically gain a header if someone creates [3].
The interface for editors is very simple - just prepend "{{PageHeader}}"
to the page. The underlying implementation is more complicated...
The PageHeader template[4] includes any content we would want to place
at the top of the page. I haven't found an equivalent of MediaWiki:Sitenotice
that's displayed within the page content, so it seems like a good idea to
make a hook like this (manually or with a bot that monitors page edits),
so we can add any other functionality in future.
{{PageHeader}} currently only transcludes {{TranslationList}}[5], which
uses a collection of language templates[6] to render the list of translations.
It also translates the word "Translations" (currently only English and the
Google Translate for Italian, which may well be incorrect).
The language templates do things like call a template once for each supported
language, or determine the "upstream" version of a page.
Note 1: I've called it the "upstream" page because the relationship between
English and other languages resembles the relationship between upstream
projects and Debian. Easy enough to change if there's a better name?
Note 2: the current wiki uses page names like "it/Foo", but MediaWiki requires
the first letter to be a capital ("It/Foo"). Working around that involved a
bit of case-manipulation in the templates, and may be the source of weird bugs
in future.
> > What about links inside a page, would there be an automated way to
> > create links to translated pages.
> > What I mean is, right now when there is a (interwiki)link in a page, a
> > translator (at least me, I hope I was not missing some obvious feature)
> > has to check if there is a translated page for that link and point the
> > link there or otherwise point to the English page. Will there be an
> > automated way in which the Wiki knows if there is a translated version
> > of a page and points there if there is, or automatically defaults to
> > English if there is not?
>
> I believe the current solution that is used on all the other wikis is
> prefixing every URL with "/Special:MyLanguage/". Most of the time, this
> is hidden away behind a template that adds the prefix for you.
That's a good idea. I've put together a possible implementation at [7],
which tries /Special:MyLanguage/, then the language for the current page,
then finally English. We could add some logic around e.g. pt_BR -> pt_PT
translations some day, but it's probably best to wait until requested
(zh_HK -> zh_CN translations may not be appreciated!)
Again, a better name than "Lang" would be welcome :)
[0] https://wiki2025.debian.org/wiki/ExampleForTranslation
[1] https://wiki2025.debian.org/wiki/It/ExampleForTranslation
[2] https://wiki2025.debian.org/wiki/ExampleForProposedMerge
[3] https://wiki2025.debian.org/wiki/It/ExampleForProposedMerge
[4] https://wiki2025.debian.org/wiki/Template:PageHeader
[5] https://wiki2025.debian.org/wiki/Template:TranslationList
[6] https://wiki2025.debian.org/wiki/Category:LanguageMachinery
[7] https://wiki2025.debian.org/wiki/Template:Lang
Reply to: