Is it possible to mark attributes at non-translatable using XPath?

If I have the following XML tag:

<Property ID="MaxNumberOfFiles" DataType="UINT" Value="1" Name-en="Maximum number of files" Description-en="This value defines the number of .csv files that are generated after a 'Record' command. The 'RecordDone' output is set to TRUE when the files have been created" ValueRange="1-65535" />

And only need to translate the text under attribute "Description-en", is it possible to extract all of the other attributes for display in the Trados Studio 2019 editor for "informational purposes" (text is present but locked). I know this is possible with tag elements themselves (inline / non-translatable / Include), but I can't seem to get it to work with attributes. Also tried with embedded content but to no avail.

Anyone know if this is possible?

Top Replies

Parents
  • Thanks again for the replies! I like the DSI app solution because it works out of the box and provides information "on the fly",  i.e. the screen is updated when moving along units, which is nice.

    I would have also liked to try out the stylesheet solution from Paul, but I am a stylesheet noob apparently and am only able to get the attributes for the first unit shown but not for all the rest. If I'm not mistaken, this would not be an "on the fly" solution, but rather will present ALL of the information at once in the Preview dialog. If I could get ALL the information shown, then I could try my hand at formatting in a way that is pleasing to the eye (table, colors, font size, etc.).

    Here's a sample of the REAL code:

    <?xml version="1.0" encoding="utf-8"?>
    <Configuration Location="Application/mapp/Config">
    <Group ID="DataRecorder" Name-en="DataRecorder">
    <Property ID="MaxNumberOfFiles" DataType="UINT" Value="1" Name-en="Maximum number of files" Description-en="This value defines the number of .csv files that are generated after a 'Record' command. The 'RecordDone' output is set to TRUE when the files have been created" ValueRange="1-65535" />
    <Property ID="MaxFileSize" DataType="UDINT" Value="1000" Unit-en="kB" Name-en="Maximum file size" Description-en="Defines the size of a file" ValueRange="1-51200" />
    <Property ID="DecimalDigits" DataType="UINT" Value="2" Name-en="Decimal digits" Description-en="Specifies how many decimal positions are saved" ValueRange="0-15" />
    <Property ID="SaveInterval" DataType="DINT" Value="10000" Unit-en="ms" Name-en="Save interval" Description-en="Specifies the time interval used to transfer data from internal memory to the file" ValueRange="2000-3600000" />
    <Property ID="BufferSize" DataType="UINT" Value="100" Unit-en="kB" Name-en="Buffer size" Description-en="Defines the size of internal memory" ValueRange="1-65535" />
    <Property ID="PowerFailSafe" DataType="BOOL" Value="TRUE" Name-en="Power fail-safe" Description-en="Specifies whether the data should survive a power failure (internal memory in DRAM or SRAM)" />
    </Group>
    </Configuration>

    And here's the modified stylesheet Paul was good enough to help with (basically changed for-each select):

    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0"
    xmlns:xsl="">www.w3.org/.../Transform">
    <xsl:template match="/">
    <html>
    <body>

    <xsl:for-each select="Configuration/Group"><br/>
    <i>ID = <font color="#0000FF" size="2"><xsl:value-of select="Property/@ID"/></font></i><br/>
    <i>DataType = <font color="#0000FF" size="2"><xsl:value-of select="Property/@DataType"/></font></i><br/>
    <i>Value = <font color="#0000FF" size="2"><xsl:value-of select="Property/@Value"/></font></i><br/>
    <i>Name-en = <font color="#0000FF" size="2"><xsl:value-of select="Property/@Name-en"/></font></i><br/>
    <i>ValueRange = <font color="#0000FF" size="2"><xsl:value-of select="Property/@ValueRange"/></font></i><br/>
    </xsl:for-each>

    </body>
    </html>
    </xsl:template>
    </xsl:stylesheet>


    I looked into for-each and from what I understand it should find all instances of those attributes, but it only finds the ones from MaxNumberofFiles, not MaxFileSize for example. I don't know what I'm doing wrong. If it's something easy I'm overlooking, I would appreciate some additional help; otherwise, I am quite happy with the DSI app solution from Daniel, though I wish it was easier to adapt the font size to my aging eyes ;-))

    Thanks again for all your help!

  • I got that far, but I was looking for a way to indicate where the translator is actually working on. This looks nice:

    (I just added a line with "Description-en" to "for-each-select".)

    But unfortunately each segment confirmation produces an error (although it does not seem to cause any harm):

    Daniel

  • Which version of Studio and which XML filetype did you use?  Interestingly I did the same thing but the preview isn't highlighting for me... although I don't get an errror.  I was going to test the other variations next:

  • ok - used the new XML version 2 and now I get the highlighting... and your error!

    I tested all the xml filetypes now and will log a few bugs as a result of this exercise.

  • I tried the above on 2019 SR2 CU5 and CU6 Beta, no difference. I used the XML2 filetype with Element Rules. Now I just tried the old XML filetype 1.2 with legacy embedded content and I also don't get any highlighting (also no error). However, I think you need to include the attribute into your XSL that is extracted for translation (Description-en). Only this could be highlighted anyways, but I don't see it in your screenshot.

    Daniel

  • However, I think you need to include the attribute into your XSL that is extracted for translation (Description-en). Only this could be highlighted anyways, but I don't see it in your screenshot.

    Look closer ;-)  I put it at the top of each set of info.

  • Look closer ;-)

    Oh, I see, it's just bold text without the attribute name...

    Well, after all this it seems that the DSI viewer is not such a bad option for the time being. Or you treat it as text and let Studio display the tag text.

    Daniel

  • Indeed... shame though.  I like the preview option.

  • Any chance these for bugfixes to get done in time for CU6?

    Daniel

  • I would say zero chance because I don't think has even been made aware of them all yet, and it's also a bit late for CU6.  For your reference the bug numbers are:

    CRQ-18395: XML: Unable to generate the file for previewing. The document may no longer be available

    CRQ-18404: XML2- highlighting in preview fails when you have multiple segments in a paragraph unit

    CRQ-18408: XML 1 - no preview highlighting

  • Hi

    I am setting up a custom xml file type for a fairly large long-term project. Could you tell me where the three CRQs above are at?

    Daniel

  • CRQ-18395: XML: Unable to generate the file for previewing. The document may no longer be available

    This one is apparently fixed. If it's not working in CU6 then that means it'll be in Studio 2021, and possibly a future update to 2019.

    CRQ-18404: XML2- highlighting in preview fails when you have multiple segments in a paragraph unit

    Same again... apparently fixed.

    CRQ-18408: XML 1 - no preview highlighting

    This is closed with the comment "This is an unsupported feature due to a limitation in the architecture of the framework. As a solution use XML2 which addresses this limitation."

    I suggest you test them all in CU6 using XML2 and also in the Beta of 2021.

Reply
  • CRQ-18395: XML: Unable to generate the file for previewing. The document may no longer be available

    This one is apparently fixed. If it's not working in CU6 then that means it'll be in Studio 2021, and possibly a future update to 2019.

    CRQ-18404: XML2- highlighting in preview fails when you have multiple segments in a paragraph unit

    Same again... apparently fixed.

    CRQ-18408: XML 1 - no preview highlighting

    This is closed with the comment "This is an unsupported feature due to a limitation in the architecture of the framework. As a solution use XML2 which addresses this limitation."

    I suggest you test them all in CU6 using XML2 and also in the Beta of 2021.

Children
No Data