Last modified: 2014-09-22 09:38:12 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 T70385, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 68385 - Add {{#translation}} as parser function in the Translate extension
Add {{#translation}} as parser function in the Translate extension
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
Translate (Other open bugs)
unspecified
All All
: Normal normal (vote)
: MW 1.24 version
Assigned To: Pratik Lahoti
:
Depends on:
Blocks: 65740 66880
  Show dependency treegraph
 
Reported: 2014-07-22 17:10 UTC by Pratik Lahoti
Modified: 2014-09-22 09:38 UTC (History)
8 users (show)

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


Attachments

Description Pratik Lahoti 2014-07-22 17:10:21 UTC
{{translate}} needs to be added as a magic word for it to be used by Special:PagePreparation, a tool for preparing the page for translation.
Comment 1 Nemo 2014-07-22 17:50:17 UTC
Cc the creator of [[mw:Template:Translation]], Happy-melon, and some others, in case they want to specify some requirements for such a magic word.
Comment 2 Gerrit Notification Bot 2014-07-23 20:23:21 UTC
Change 148759 had a related patch set uploaded by BPositive:
'translation' added as magic word in Translate extension

https://gerrit.wikimedia.org/r/148759
Comment 3 Niklas Laxström 2014-08-02 16:46:42 UTC
I want the magic word to start with # sign.
Comment 4 Nemo 2014-08-02 17:15:51 UTC
Niklas veto'ed any {{translation}} magic word for fear of incompatibility with existing templates, so it's useless to discuss about it. For now making a non-standard magic word prefixed by # is easiest.

As compatibility with existing wikitext is no longer an aim, should we also change the syntax from [[Category:A{{translation}}|B]] to {{#translation:Category:A|B}} (in a followup patch)?

The {{#translation}} parser function could also be used to transclude translatable templates in the future: is this in scope for Translate, Niklas? If the answer is yes, BPositive, please file a separate bug for that.
Comment 5 Gerrit Notification Bot 2014-08-14 07:26:14 UTC
Change 148759 merged by jenkins-bot:
'#translation' added as magic word in Translate extension

https://gerrit.wikimedia.org/r/148759
Comment 6 Paul Kaganer 2014-08-15 12:05:49 UTC
(In reply to Nemo from comment #4)
> As compatibility with existing wikitext is no longer an aim, should we also
> change the syntax from [[Category:A{{translation}}|B]] to
> {{#translation:Category:A|B}} (in a followup patch)?

Not a very good idea. In my opinion, '#translation' should not be generate wikilinks, only pagename in plain text.

Instead [[Category:A{{translation}}|B]] should be approximately next code: [[{{#translation:Category:A}}|B]]. By common way, pipe ("|") is traditionally used as delimanation simbol for parser functions; it may still be needed in  this case.
Comment 7 Paul Kaganer 2014-08-15 12:12:04 UTC
Niklas, maybe update this feature, to make it work not only for currrent page, as {{#translation:}} (current state) - but also 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}}.
Comment 8 Paul Kaganer 2014-08-15 12:20:11 UTC
(In addition to comment #7)

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"
Comment 9 Paul Kaganer 2014-08-15 12:22:33 UTC
(In addition to comment #7 and comment #8)

maybe this should be separate magic word, as '#tlink' or '#tl'?
Comment 10 Nemo 2014-08-15 18:38:36 UTC
(In reply to Paul Kaganer from comment #8)
> 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"

This sounds reasonable to me, and hopefully not too hard to implement (especially if reusing some Special:MyLanguage code to find the appropriate target subpage). Are you able to submit a patch (I don't think Pratik will have time during GSoC).
Comment 11 Paul Kaganer 2014-08-16 19:05:43 UTC
(In reply to Nemo from comment #10)
> Are you able to submit a patch (I don't think Pratik will
> have time during GSoC).

No, I do not have such skills. Let's wait for someone who can do it :(
Comment 12 Nemo 2014-09-20 20:15:57 UTC
1.24 was branched, let's have a closed bug against 1.24 for bugzilla searchers.

(In reply to Nemo from comment #10)
> (In reply to Paul Kaganer from comment #8)
> > 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"
> 
> This sounds reasonable to me, and hopefully not too hard to implement
> (especially if reusing some Special:MyLanguage code to find the appropriate
> target subpage). Are you able to submit a patch (I don't think Pratik will
> have time during GSoC).

Kaganer, can you file these as a separate bug?
Comment 13 Paul Kaganer 2014-09-22 09:38:12 UTC
> Kaganer, can you file these as a separate bug?

Nemo, see bug 71114

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


Navigation
Links