Is there a way (similar to {{int:lang}}) of getting the language code of the current translation? This is needed to build something similar to Template:Msg-mw on e.g. Commons.
Topic on Extension talk:Translate
That would be bugzilla:57603. As a workaround you can use titleparts magic word to extract language code from the page name.
That workaround works for translations done directly on the page (i.e. going to commons:Translations:Commons:Welcome to Commons brochure/text/192/ru) but not when going through the translation interface since the detected pagename is API.
Looking at bugzilla:57603 it is also not obvious if this would solve the issue of determining the language in the translation interface. How is this solved in translatewiki.net?
I don't understand what "determining the language in the translation interface" means. Language of what? Determining for what purpose? What part of the translation interface?
I see you linked a Special:Translate page view but I don't see the specific problem you want to report about it, please be specific. I guess somewhere a magic word or something is rendered incorrectly in Special:Translate itself? In that case, this is not a real problem: the parsing in page view is limited by nature and doesn't need to be perfect (it's not like you send people there to read the page). Translators of course need to know where their wikitext will end up in order to translate properly, the solution when it's not obvious is that you must clarify that in the qqq documentation.
Sorry. I thought the link to the Msg-mw template explained it but I'll clarify:
- Purpose
I'd like to add a note that text 1 depends on the the translation of text 2 or similarly that an update of 1 should lead to an update of 2. In order to be useful though the link should go to the particular language version of text 2 which we are currently editing (and/or transclude said message). This is frequently done in translatewiki.net using the above mentioned template.
- Attempted solution(s)
In order to do this a comment is added to the documentation of text 1 (i.e. .../1/qqq) linking to text .../2/LANGCODE. There are two distinct interfaces for translating messages where the documentation is shown.
- a) The wikipage of the actual translation. I.e. something like
- b) The Special:Translation interface ( filtered by "Wikipedia, page 4 step 1, top of Commons main page" for the same message as the one above)
For the example above we want the .../192/qqq message to display a link to .../47/ru.
- {{int:lang}} cannot be used since this gives the interface language
- *{{#titleparts:{{PAGENAME}}|0|-1}} works for a) but not for b) since {{PAGENAME}}=API on this page.
Some way of detecting the language set by tux-languageselector would work for b)
As Kaganer says, you only need the page language. If that's not displayed correctly in every place you'd want, I recommend subst'ing.
Substing is not an alternative since the message should be dynamically updated depending on the current language of the translation.
meta:Template:Pagelang won't do the trick since this also relies on #titleparts which will not give the relevant result on Special:Translation.
"Page content language" on the info page is what is needed for a) but for b) we would instead want "data-language" or "data-targetlangcode". I'll add a note about this on bugzilla:57603. Upon closer inspection of translatewiki.net I see that their template also breaks on Special:Translation (returning the interface language instead of the target language)* so I'll consider this to not have a solution for now. To avoid confusion the Commons template now only returns the transcluded message in a) (leaving a link to the english page for b).
Anyway thanks for helping me get to the bottom of this.
- To see:
Last post was also by me. Sorry for the mixed log-ins.