Last modified: 2014-10-16 20:55:16 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T73114, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 71114 - Update {{#translation}} parser function in the Translate extension
Update {{#translation}} parser function in the Translate extension
Status: NEW
Product: MediaWiki extensions
Classification: Unclassified
Translate (Other open bugs)
unspecified
All All
: Normal enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-09-22 09:35 UTC by Paul Kaganer
Modified: 2014-10-16 20:55 UTC (History)
5 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Paul Kaganer 2014-09-22 09:35:25 UTC
Currently, this function is worked for currrent page only: 
called as {{#translation:}} and is returned "/code", if page is translation, or empty string otherwise.

Proposed update for ability to using this function for specified target page, as  {{#translation:pagename}} or {{#translation:namespace:pagename}}.

This will be useful for eliminate widely used templates {{ifTranslation}}/{{ifNotTranslation}}, {{TNT}}/{{TNTN}} and {{Ll}}.

Taret result for my proposal: 

1) if current page is translation, and {{#translation:}} is returned "/code", then {{#translation:pagename}} should be return "pagename/code" (if this page is exist) or "pagename" otherwise;

2) if current page is _not_ a translation, and {{#translation:}} is returned empty result, {{#translation:pagename}} should be return "pagename"

Note: maybe this should be separate magic word, as '#tlink' or '#tl' (or simple create these short aliases for this function)?
Comment 1 Niklas Laxström 2014-10-16 10:31:33 UTC
Can you explain me how exactly could the templates be replaced with this magic word?

For TNT, would it work like this:
If I am on page, Foo/fi would {{#translation:Template}} return Template/fi if that page exists and Template otherwise? Then you would call it as {{{{#translation:Template}}}}.

What about the other templates? I'm not familiar with what they do.
Comment 2 Paul Kaganer 2014-10-16 20:55:16 UTC
Yes; explanations:

{{TNT|Template}} > {{ {{#translation:Template}} }}

{{TNTN|Template}} > {{#translation:Template}} (currently, these same, but without transcluding)

{{Ll}} will receive the code more simple, by eliminating calls {{tntn}} (see https://www.mediawiki.org/w/index.php?title=Template:Localized_link&action=edit )

{{ifTranslation}}/{{ifNotTranslation}} - they are nothing to do with, I was mistaken ;) But they used Module:Template_translation (see https://meta.wikimedia.org/wiki/Module:Template_translation) - maybe it's code also possible to simplify (if this feature has available through API)?

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links