xpath for xml file

Hi everybody.

I need to translate a multiple xml file.

The multilingual xml file type does not pick my file.

I'm using Studio 2022 SR2 - 17.2.10.19084.

How would you fill in the Language Mapping Window with the structure of my xml?

I've tried several options, but there is so much information in this file that I'm not able to detect the actually useful data.

Thank you in advance for your help.

XML code snippet with declaration and a 'tplanguage' element containing a 'language' element for Italian with attributes for language name, ISO name, and language code.

XML code snippet showing multiple 'language' elements within a 'tplanguage' element, including languages like Italian, English (UK), French, German, Spanish, Russian, Chinese (Simplified), Japanese, and Polish.



Generated Image Alt-Text
[edited by: RWS Community AI at 3:45 PM (GMT 1) on 29 May 2024]
emoji
  •  

    It's always a good idea to provide a full sample file as it's easier for people to try and assist you.  For example:

    <?xml version="1.0" encoding="utf-8" standalone="no"?>
    <tplanguage>
        <language longName="Italian" ISOName="ITA" xml:lang="it-IT" code="0x10">
            <message MsgID="1">WSC</message>
            <message MsgID="2">Simulation Board</message>
        </language>
        <language longName="English (United Kingdom)" ISOName="ENG" xml:lang="en-GB" code="0x09">
            <message MsgID="1">WSC</message>
            <message MsgID="2">Simulation Board</message>
        </language>
        <language longName="French" ISOName="FRA" xml:lang="fr-FR" code="0x0C">
            <message MsgID="1">WSC</message>
            <message MsgID="2">Simulation Board</message>
        </language>
        <language longName="German" ISOName="DEU" xml:lang="de-DE" code="0x07">
            <message MsgID="1">WSC</message>
            <message MsgID="2">Simulation Board</message>
        </language>
        <language longName="Spanish" ISOName="ESP" xml:lang="es-ES" code="0x0A">
            <message MsgID="1">WSC</message>
            <message MsgID="2">Simulation Board</message>
        </language>
        <language longName="Russian" ISOName="RUS" xml:lang="ru-RU" code="0x19">
            <message MsgID="1">WSC</message>
            <message MsgID="2">Simulation Board</message>
        </language>
        <language longName="Chinese (Simplified)" ISOName="CHS" xml:lang="zh-CN" code="0x04">
            <message MsgID="1">WSC</message>
            <message MsgID="2">Simulation Board</message>
        </language>
        <language longName="Japanese" ISOName="JPN" xml:lang="ja-JP" code="0x11">
            <message MsgID="1">WSC</message>
            <message MsgID="2">Simulation Board</message>
        </language>
        <language longName="Polish" ISOName="PLK" xml:lang="pl-PL" code="0x15">
            <message MsgID="1">WSC</message>
            <message MsgID="2">Simulation Board</message>
        </language>
    </tplanguage>

    Only contains what you seem able to share so easy enough to create.

    Having got this far the only bits you need are at least one unique attribute to identify the language.  In this case any one of the attributes you have would work, but makes sense to use xml:lang I guess since the relate to what you'll use to add the languages in Studio anyway.  Then you can specify the path for each language.  So I thought I could use this:

    Root:
    /tplanguage

    Language (for example using Italian)
    language[@xml:lang='it-IT']/message

    However, this only seems to get me this which is the first line only:

    Screenshot of Trados Studio interface showing a segment with the text 'WSC' in both source and target panels, without any visible errors or warnings.

    I'm not sure why, might be a bug, might be a result of how the filetype works, but it's not helpful.  So I tried this:

    language[@xml:lang='it-IT']

    That got me this:

    Screenshot of Trados Studio interface displaying a segment with the source text 'WSC' and the target text 'Simulation Board', with no visible errors or warnings.

    I get all the segments, but not segmented.  So also not helpful.  I then tried various other ways to get this but each time the same results... so I'm a bit stumped :-(

    I've asked the developer to take a look when he gets some time and if there is a way to do this we'll come back to you... unless someone else responds before we get there.

    Paul Filkin | RWS Group

    ________________________
    Design your own training!

    You've done the courses and still need to go a little further, or still not clear? 
    Tell us what you need in our Community Solutions Hub

    emoji


    Generated Image Alt-Text
    [edited by: RWS Community AI at 4:59 PM (GMT 1) on 29 May 2024]
  • Hi Paul. Thank you so much for looking into this. If you (the most competent person who could reply to my question) were not able to make it work, I'm afraid I will have to make all steps manually (export single languages, align them in order to retrieve legacy translations, create a project for every language combination, etc.) The problem here is that I have a complex tree of folders, with approx. 30 xml files in up to 12 languages. I was definitely counting on this plug in :( Thank you anyway for your time and help.

    emoji
  •  

    I did speak to the developer and he showed me the error of my ways!  I missed the obvious really which was to add a new rule in the html embedded content processor as we can use this for the segmentation, set to "All Paragraphs" in the Multilingual XML processor.  So here's a quick video to show you:

    .

    Paul Filkin | RWS Group

    ________________________
    Design your own training!

    You've done the courses and still need to go a little further, or still not clear? 
    Tell us what you need in our Community Solutions Hub

    emoji
  • Thank you very much Paul! I'll try this today and let you know. I really appreciate your help.

    emoji
  • Hi Paul, I get 6 messages reported while trying to generate multilingual translations (xml):

    Error dialog box with a message: Unexpected exception when configuring file multiFileConverter for task 'Generate Multilingual Translations (XML)': Only Exception type is allowed.

    any idea?

    thank you in advance

    emoji


    Generated Image Alt-Text
    [edited by: RWS Community AI at 9:15 AM (GMT 1) on 30 May 2024]
  •  

    First of all can you provide the full error stack please?  Click on the disk, save the file to your desktop and then attach it to your reply.  The images like this are not helpful.

    Error dialog box with a red cross icon indicating an 'Unexpected exception when configuring file multiFileConverter for task Generate Multilingual Translations (XML); Only Exception type is allowed.' Two links below: Knowledge Base and Community.

    Now, the error could be due to a few things:

    1. your source file is not the same as the one I made up!
    2. you have different version of Trados Studio and a different version of the plugin
    3. I'm using a new version on the plugin that is in QA right now so you won't have this one and I know we have a few fixes in there

     fyi

    In the meantime here's what I did from start to finish.  Perhaps there is something in there to help.

    Paul Filkin | RWS Group

    ________________________
    Design your own training!

    You've done the courses and still need to go a little further, or still not clear? 
    Tell us what you need in our Community Solutions Hub

    emoji


    Generated Image Alt-Text
    [edited by: RWS Community AI at 10:06 AM (GMT 1) on 30 May 2024]
  • Good morning Paul. I did what you did, so I guess the problem is the version of the plug in? Please find the log file of the error. Thank you, Chiara

    <SDLErrorDetails time="31/05/2024 12:51:28">
      <ErrorMessage>Unexpected exception when configuring file multiFileConverter for task 'Generate Multilingual Translations (XML)': Only Exception type is allowed.</ErrorMessage>
      <Exception>
        <Type>Sdl.ProjectApi.ProjectApiException, Sdl.ProjectApi, Version=17.0.0.0, Culture=neutral, PublicKeyToken=c28cdb26c445c888</Type>
        <HelpLink />
        <Source>Sdl.ProjectApi.Implementation</Source>
        <HResult>-2146233088</HResult>
        <StackTrace><![CDATA[   at Sdl.ProjectApi.Implementation.TaskExecution.ContentProcessingTaskImplementation.TaskFileExecuter.ConfigureConverter(IMultiFileConverter multiFileConverter, Language targetLanguage)
       at Sdl.ProjectApi.Implementation.TaskExecution.ContentProcessingTaskImplementation.TaskFileExecuter.CreateMultiFileConverter(IProjectFile tf, String filePath)
       at Sdl.ProjectApi.Implementation.TaskExecution.ContentProcessingTaskImplementation.TaskFileExecuter.Parse(String targetFilePath)]]></StackTrace>
        <InnerException>
          <Type>System.Exception, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</Type>
          <HelpLink />
          <Source>Sdl.ProjectAutomation.FileBased</Source>
          <HResult>-2146233088</HResult>
          <StackTrace><![CDATA[   at Sdl.ProjectAutomation.FileBased.FileBasedProject.RunAutomaticTask(Guid[] projectFileIds, String taskTemplateId)
       at Multilingual.XML.FileType.BatchTasks.ExportBatchTask.ConfigureConverter(ProjectFile projectFile, IMultiFileConverter multiFileConverter)
       at Sdl.ProjectApi.Implementation.TaskExecution.ContentProcessingTaskImplementationAdapter.ConfigureConverter(IExecutingTaskFile executingTaskFile, IMultiFileConverter multiFileConverter)
       at Sdl.ProjectApi.Implementation.TaskExecution.ContentProcessingTaskImplementation.TaskFileExecuter.ConfigureConverter(IMultiFileConverter multiFileConverter, Language targetLanguage)]]></StackTrace>
          <InnerException>
            <Type>System.Exception, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</Type>
            <HelpLink />
            <Source>Sdl.ProjectAutomation.FileBased</Source>
            <HResult>-2146233088</HResult>
            <StackTrace><![CDATA[   at Sdl.ProjectAutomation.FileBased.FileBasedProject.RunAutomaticTask(Guid[] projectFileIds, String taskTemplateId, EventHandler`1 statusEventHandler, EventHandler`1 messageEventHandler)
       at Sdl.ProjectAutomation.FileBased.FileBasedProject.RunAutomaticTask(Guid[] projectFileIds, String taskTemplateId)]]></StackTrace>
            <InnerException>
              <Type>System.Runtime.Serialization.SerializationException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</Type>
              <HelpLink />
              <Source>Sdl.ProjectApi.Implementation</Source>
              <HResult>-2146233076</HResult>
              <StackTrace><![CDATA[   at Sdl.ProjectApi.Implementation.Util.DeserializationBinder.BindToType(String assemblyName, String typeName)
       at System.Runtime.Serialization.Formatters.Soap.ObjectReader.Bind(String assemblyString, String typeString)
       at System.Runtime.Serialization.Formatters.Soap.SoapHandler.ProcessGetType(String value, String xmlKey, String& assemblyString)
       at System.Runtime.Serialization.Formatters.Soap.SoapHandler.ProcessArray(ParseRecord pr, Int32 firstIndex, Boolean IsInterop)
       at System.Runtime.Serialization.Formatters.Soap.SoapHandler.ProcessType(ParseRecord pr, ParseRecord objectPr)
       at System.Runtime.Serialization.Formatters.Soap.SoapHandler.ProcessAttributes(ParseRecord pr, ParseRecord objectPr)
       at System.Runtime.Serialization.Formatters.Soap.SoapHandler.StartChildren()
       at System.Runtime.Serialization.Formatters.Soap.SoapParser.ParseXml()
       at System.Runtime.Serialization.Formatters.Soap.SoapParser.Run()
       at System.Runtime.Serialization.Formatters.Soap.ObjectReader.Deserialize(HeaderHandler handler, ISerParser serParser)
       at System.Runtime.Serialization.Formatters.Soap.SoapFormatter.Deserialize(Stream serializationStream, HeaderHandler handler)
       at Sdl.ProjectApi.Implementation.Util.DeserializeException(String s)
       at Sdl.ProjectApi.Implementation.Xml.ExecutionMessage.get_Exception()
       at Sdl.ProjectApi.Implementation.ExecutionMessage.get_Exception()
       at Sdl.ProjectAutomation.FileBased.Converters.ExecutionMessageConverter.CreateExecutionMessage(IExecutionMessage m)
       at Sdl.ProjectAutomation.FileBased.AutomaticTasksProcessor.<>c__DisplayClass11_0.<ConvertMessages>b__1(IExecutionMessage m)
       at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
       at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection)
       at Sdl.ProjectAutomation.FileBased.AutomaticTasksProcessor.ConvertMessages(IAutomaticTask projectApiAutomaticTask)
       at Sdl.ProjectAutomation.FileBased.AutomaticTasksProcessor.CreateAutomaticTaskObject(IAutomaticTask projectApiAutomaticTask)
       at Sdl.ProjectAutomation.FileBased.AutomaticTasksProcessor.RunAutomaticTask(IEnumerable`1 projectFileIds, String taskTemplateId, EventHandler`1 statusEventHandler, EventHandler`1 messageEventHandler)
       at Sdl.ProjectAutomation.FileBased.FileBasedProject.RunAutomaticTask(Guid[] projectFileIds, String taskTemplateId, EventHandler`1 statusEventHandler, EventHandler`1 messageEventHandler)]]></StackTrace>
            </InnerException>
          </InnerException>
        </InnerException>
      </Exception>
      <Environment>
        <ProductName>Trados Studio</ProductName>
        <ProductVersion>Studio17</ProductVersion>
        <EntryAssemblyFileVersion>17.2.10.19084</EntryAssemblyFileVersion>
        <OperatingSystem>Microsoft Windows 10 Pro</OperatingSystem>
        <ServicePack>NULL</ServicePack>
        <OperatingSystemLanguage>1040</OperatingSystemLanguage>
        <CodePage>1252</CodePage>
        <LoggedOnUser>TECHNOLAB\Utente06</LoggedOnUser>
        <DotNetFrameWork>4.0.30319.42000</DotNetFrameWork>
        <ComputerName>PC105</ComputerName>
        <ConnectedToNetwork>True</ConnectedToNetwork>
        <PhysicalMemory>16545968 MB</PhysicalMemory>
      </Environment>
    </SDLErrorDetails>

    emoji