From 3588e2820ebdada0befecbb698b93a9aadc8a510 Mon Sep 17 00:00:00 2001 From: Chris Cormack Date: Sun, 8 Apr 2012 20:10:19 +1200 Subject: [PATCH 1/2] Bug 6709 : Patch for testing translating .xml files Signed-off-by: Bernardo Gonzalez Kriegel Signed-off-by: Katrin Fischer Comment on second patch. Signed-off-by: Jared Camins-Esakov --- misc/translator/tmpl_process3.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/translator/tmpl_process3.pl b/misc/translator/tmpl_process3.pl index cd46997c79..993e2a8ce8 100755 --- a/misc/translator/tmpl_process3.pl +++ b/misc/translator/tmpl_process3.pl @@ -236,7 +236,7 @@ usage_error('You must at least specify input and string list filenames.') if !@in_files || !defined $str_file; # Type match defaults to *.tt plus *.inc if not specified -$type = "tt|inc|xsl" if !defined($type); +$type = "tt|inc|xsl|xml" if !defined($type); # Check the inputs for being files or directories for my $input (@in_files) { From b6518e632ddf1c2e97fe9f49d9dd307a3047266b Mon Sep 17 00:00:00 2001 From: Bernardo Gonzalez Kriegel Date: Mon, 29 Apr 2013 13:07:11 -0300 Subject: [PATCH 2/2] Bug 6709 - marc21_field_006.xml and marc21_field_008.xml can't be translated This patch changes 1) structure and schema for xml files used in MARC21 006 and 008 value builders. 2) JavaScript functions used to show value builders. Xml processing is enabled in previous patch Any translatable string has been moved to an xml element, those strings that no need translation remains as xml attributes. NOTE_1: I do not include as translatable material types codes, because those values are restricted in schema definition. But this restriction can be removed. NOTE_2: Anyone with experience in XML/XSD please check the new schema definition. NOTE_3: Anyone with experience in the former and JavaScript please check xmlControlfield.js To test: 1) Apply the patch 2) Verify that 006 and 008 value builders show and work properly 3) Update translation files for your favorite language, a new set of strings must show up corresponding to names and descriptions on value builders. Note: messed up patches, sending again. Signed-off-by: Katrin Fischer All tests and QA script pass. Did regression tests on the plugins for 006 and 008 and could spot no differences in behavior of the plugins to before. Also tested the translation process and found it working nicely. Thank you for fixing this long standing translation bug! Signed-off-by: Jared Camins-Esakov --- .../prog/en/js/xmlControlfield.js | 23 +- .../value_builder/marc21_field_006.xml | 1462 +++++----- .../value_builder/marc21_field_008.xml | 2388 ++++++++--------- .../value_builder/marc21_field_CF.xsd | 26 +- 4 files changed, 1953 insertions(+), 1946 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/xmlControlfield.js b/koha-tmpl/intranet-tmpl/prog/en/js/xmlControlfield.js index 608b79bd67..eccdba47eb 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/js/xmlControlfield.js +++ b/koha-tmpl/intranet-tmpl/prog/en/js/xmlControlfield.js @@ -241,7 +241,7 @@ function changeH4Result(form, h4_result, tr_result, pos, value) var arrEquiv = new Array(); for (var i=0; i < nodeMaterial.length; i++) { id = nodeMaterial[i].attributes.getNamedItem("id").nodeValue; - name = nodeMaterial[i].attributes.getNamedItem("name").nodeValue; + name = nodeMaterial[i].getElementsByTagName('name')[0].textContent; arrEquiv[id] = i; arrSort.push(id); } @@ -249,7 +249,7 @@ function changeH4Result(form, h4_result, tr_result, pos, value) var j; for (var i=0; i < arrSort.length; i++) { j = arrEquiv[arrSort[i]]; - add_option(this.select, arrSort[i] + " - " + nodeMaterial[j].attributes.getNamedItem("name").nodeValue, arrSort[i], (this.idMaterial != "" && arrSort[i] == this.idMaterial)?true:false); + add_option(this.select, arrSort[i] + " - " + nodeMaterial[j].getElementsByTagName('name')[0].textContent, arrSort[i], (this.idMaterial != "" && arrSort[i] == this.idMaterial)?true:false); } } else if (this.idMaterial != "") { for (var i=0; i < this.select.options.length; i++) { @@ -292,16 +292,21 @@ function changeH4Result(form, h4_result, tr_result, pos, value) var selected; var index; var url; + var description; + var name; while (nodePos != null) { if (nodePos.nodeType == 1 && nodePos.nodeName == "Position") { tr = tbody.insertRow(tbody.rows.length); td = tr.insertCell(tr.cells.length); pos = nodePos.attributes.getNamedItem("pos").nodeValue; - title = ((nodePos.getAttributeNode("description") || nodePos.hasAttribute("description")) && nodePos.getAttribute("description") != "")?nodePos.attributes.getNamedItem("description").nodeValue:nodePos.attributes.getNamedItem("name").nodeValue; + // description is required by schema + description = nodePos.getElementsByTagName('description')[0].textContent; + name = nodePos.getElementsByTagName('name')[0].textContent + title = ( description != "")?description:name; try { - url = ((nodePos.getAttributeNode("url") || nodePos.hasAttribute("url")) && nodePos.getAttribute("url") != "" && nodePos.getAttribute("urltext") != "")?" " + nodePos.attributes.getNamedItem("urltext").nodeValue + "":""; + url = ((nodePos.getAttributeNode("url") || nodePos.hasAttribute("url")) && nodePos.getAttribute("url") != "" && nodePos.getElementsByTagName('urltext')[0].textContent != "")?" " + nodePos.getElementsByTagName('urltext')[0].textContent + "":""; } catch (e) { url = "";} - td.innerHTML = ""; + td.innerHTML = ""; td = tr.insertCell(tr.cells.length); value = returnValuePosFromResult(result, pos); if ((index = pos.indexOf("-")) > 0) { // Position interval @@ -312,14 +317,16 @@ function changeH4Result(form, h4_result, tr_result, pos, value) } else { strInnerHTML = "