Santhosh has uploaded a new change for review. https://gerrit.wikimedia.org/r/292528
Change subject: Correct the wt value of adapted templates ...................................................................... Correct the wt value of adapted templates As per https://www.mediawiki.org/wiki/Specs/HTML/1.2.1#Transclusion_content data-mw.parts.template.target.wt can have the template name like "foo" or "Template:Foo". Their resulting wikitext will be slightly different as in: {{Foo}} or {{Template:Foo}}, but the resulting HTML rendering for both of this is same - Template Foo will be used. You can try this by this example {{Template:En}} and {{En}} Content translation was adapating the templates with wt set as Template:Foo so far. It works as per the above explanation. But when you try to restore such translation drafts, Template names were read as Template:Foo and processing blindly adds another Template: prefix resulting deconstruction of such templates by not finding it in target wiki. Search for "wt":"Plantilla" in https://en.wikipedia.org/w/api.php?action=query&list=contenttranslationcorpora&translationid=132485 to see some examples of this. In this commit two fixes are done: 1. getTemplateData made to exit when the first template definition found. 2. adaptTitle changed to use template name without namespace Testplan: Follow the steps in T136817. Another one: Translation: Tree Rollins, fr to es, play with the list item "(en) Profil d'entraƮneur sur NBA.com" and MT card. At any case the translation should have the template data and should never be deconstructed. Bug: T136817 Change-Id: If6a2166e922b753dad2a85fc072a9a5a9e9b1604 --- M modules/tools/ext.cx.tools.template.js 1 file changed, 6 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation refs/changes/28/292528/1 diff --git a/modules/tools/ext.cx.tools.template.js b/modules/tools/ext.cx.tools.template.js index 5851f46..d6b8e04 100644 --- a/modules/tools/ext.cx.tools.template.js +++ b/modules/tools/ext.cx.tools.template.js @@ -54,6 +54,8 @@ $fragment.attr( 'data-mw' ) ) { templateData = $fragment.data( 'mw' ); + // Exit. + return false; } } ); @@ -111,8 +113,10 @@ * Adapt the template name to the equivalent in the target wiki */ TemplateTool.prototype.adaptTitle = function ( targetTitle ) { - // Update the name of the template - this.templateData.parts[ 0 ].template.target.wt = targetTitle; + var templateName; + // Update the name of the template. We need template name without namespace + templateName = targetTitle.split( ':' )[ 1 ] || targetTitle; + this.templateData.parts[ 0 ].template.target.wt = templateName; this.$template.attr( 'data-mw', JSON.stringify( this.templateData ) ); }; -- To view, visit https://gerrit.wikimedia.org/r/292528 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If6a2166e922b753dad2a85fc072a9a5a9e9b1604 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/ContentTranslation Gerrit-Branch: master Gerrit-Owner: Santhosh <[email protected]> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
