XML file to be set in SDL Studio 2014

Hi,

I have a XML file in the following structure:

<GIS_HELLO_WORLD string="Hello World" maxlength="11" g="1" w="1" r="0" />
<GIS_PLEASE_WAIT string="Please wait" g="0" w="0" r="0" a="1" />
<GIS_NOTICE string="Notice" g="0" w="0" r="0" a="1" />

We need to translate only the text after "string=".

Studio can't handle this type of file and I want to know how can I add or edit a XML file type to be able to show only the relevant text for translation.

Thanks

Fouad

Parents
  • Hi Fouad

    Studio has no issues dealing with this type of file - all you need to add is either a rule for the 'string' attribute in the parser rules or an XPath rule to deal with all elements containing the 'string' attribute.  Sample file and filetype attached containing an XPath rule to deal with all instances of the attribute 'string'.  I added <test> as the root element to the sample file.

    I hope this helps.

    Forum.zip

    Thanks
    Fas

     

    Fas Aziz | Desktop Life Cycle Service Manager | SDL | Support Operations, Support Lifecycle

  • Something is still wrong and Studio doesn't recognize the XML type even if I import the settings you sent me to a new XML File type.
    Maybe I did something wrong? Can you please instruct me with detailed steps of how to set/import?

    Best Regards
    Fouad
  • Maybe you can share the file? Might be something else causing the non-recognition. Extracting the attribute for translation is simple enough.

    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

  • This filetype will only work with XML files with the root element <test> - if your root element is not <test> then this filetype will  not work for you.  Open your XML file in a text editor take note of the root element (outermost element) and then add this to the 'Detection' settings under the XML filter I sent you:

    Hope this helps.

    Thanks
    Fas

     

    Fas Aziz | Desktop Life Cycle Service Manager | SDL | Support Operations, Support Lifecycle

  • <?xml version="1.0" encoding="utf-16"?>
    <data version="1.0.1" encrypted="0" dataType="StringData">
      <dictionary language="enu">
        <GIS_HELLO_WORLD string="Hello World" maxlength="11" g="1" w="1" r="0" />
    ====== GI Android Strings ================================ -->
        <GIS_M12A_ENTERPRISE string="M12A Enterprise Holter System" g="0" w="0" r="0" a="1" />
        <GIS_CHOOSE_DEVICE string="Choose device" g="0" w="0" r="0" a="1" />
        <GIS_DONT_SHOW string="Don\'t show this hint again" g="0" w="0" r="0" a="1" />
        <GIS_REQUIRES string="requires at least" g="0" w="0" r="0" a="1" />
        <GIS_IS_REQUIRED string="is required" g="0" w="0" r="0" a="1" />
        <GIS_CHARACTERS string="Characters" g="0" w="0" r="0" a="1" />
        <GIS_ATTENTION string="Attention!" g="0" w="0" r="0" a="1" />
        <GIS_CONNECTION_TIMED_OUT string="Connection timed out" g="0" w="0" r="0" a="1" />
        <GIS_NO_REPORTS string="There are currently no reports associated with this subject" g="0" w="0" r="0" a="1" />
        <GIS_REPORTS string="Reports" g="1" w="1" r="0" a="1" />
     
        <!-- ======================== GI New Strings ================================ -->
        <GIS_SAVING string="Saving" maxlength="10" g="1" w="1" r="0" a="1" />
        <GIS_HR_TREND string="HR Trend" maxlength="10" g="1" w="0" r="0" />
        <GIS_UPDATE_EXPORT string="Enable Update Export" maxlength="25" g="1" w="0" r="0" />
    
      </dictionary>
    </data>
    Here is a sample of the XML file...

  • Fouad - try the attached filetype settings.

    Forum_Update.zip

    Thanks
    Fas

     

    Fas Aziz | Desktop Life Cycle Service Manager | SDL | Support Operations, Support Lifecycle

  • Might be worth you reviewing this article that may help you do this yourself in the future.

    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

  • Yes, I need to investigate more time exploring and learning this :)
    I was wondering if there is any webinar that could demonstrate it LIVE.

    BR
    Fouad
  • Hi Fasil,
    Awesome, this solved the issue...
    Thanks a lot

    It would be great if you can explain to me exactly how did you create this filetype settings so I could understand the logic for next time.
    My email is: fouadh (at) heverlocal (dot) com

    Many Thanks in advance

    BR
    Fouad
  • Hi Yael,

    There two places you should read that will explain what Fas did.

    Why do we need custom xml filetypes

    More Regex? No it's time for something completely different.

    Both these articles will explain this and more. But in a nutshell Fas just used two simple xpath rules as he explained. First this one set as non translatable:

    //*

    This basically means don't translate anything. The star is a wildcard meaning select everything. So all he did was ensure that nothing is added for translation at all.

    Next he added a rule to extract exactly what you wanted:

    //*/@string

    This just means extract the text from all attributes named string. So in Studio you see this:


    The only other thing he did was to ensure the xml file was recognised by adding the root element of data into the detection box.


    Not too tricky!

    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

  • <?xml version="1.0" encoding="utf-16"?>
    <data version="1.0.1" encrypted="0" dataType="StringData">
      <dictionary language="enu">
        <GIS_HELLO_WORLD string="Hello World" maxlength="11" g="1" w="1" r="0" />
     <!-- ======================== GI Android Strings ================================ -->
        <GIS_M12A_ENTERPRISE string="M12A Enterprise Holter System" maxlength="40" g="0" w="0" r="0" a="1" />
        <GIS_CHOOSE_DEVICE string="Choose device" maxlength="15" g="0" w="0" r="0" a="1" />
        <GIS_RA string="RA" maxlength="5" g="1" w="1" r="1" a="1" />
        <GIS_LA string="LA" maxlength="5" g="1" w="1" r="0" a="1" />
        <GIS_LL string="LL" maxlength="5" g="0" w="0" r="0" a="1" />
        <GIS_NO_PAIRED_DEVICES string="There are no devices paired, or bluetooth is disabled. &#xA;	Would you like to pair a new device?" maxlength="150" g="0" w="0" r="0" a="1" />
        <GIS_NO_BLUETOOTH string="Unable to access bluetooth information. Please press OK to restart/enable bluetooth" maxlength="150" g="0" w="0" r="0" a="1" />
        <GIS_PLEASE_WAIT string="Please wait" maxlength="20" g="0" w="0" r="0" a="1" />
        <GIS_NOTICE string="Notice" maxlength="15" g="0" w="0" r="0" a="1" />
        <GIS_PINCH_ZOOM string="Use pinch zoom to zoom in and out of ECG presentation" maxlength="150" g="0" w="0" r="0" a="1" />
        <GIS_DONT_SHOW string="Don\'t show this hint again" maxlength="50" g="0" w="0" r="0" a="1" />
        <GIS_REQUIRES string="requires at least" maxlength="25" g="0" w="0" r="0" a="1" />
        <GIS_IS_REQUIRED string="is required" maxlength="15" g="0" w="0" r="0" a="1" />
        <GIS_CHARACTERS string="Characters" maxlength="15" g="0" w="0" r="0" a="1" />
        <GIS_ATTENTION string="Attention!" maxlength="15" g="0" w="0" r="0" a="1" />
        <GIS_CONFIRM_3_COLON_ string="Confirm 3: " maxlength="10" g="0" w="0" r="1" />
      </dictionary>
    </data>
    Thanks Paul,

    The problem now is that we have an updated file - but the settings do not work...
    It doesn't recognize the file type.

    See a sample attached...
    For me, it looks the same template.
    Can you please take a look at it and maybe you can tell me what to change?

    BR
    Fouad

  • Hello Yael,

    The problem is not the settings file it's your xml file itself.  The file should be encoded UTF16-LE and it should have a BOM (Byte Order Mark). This file you provided has no BOM and whilst the decl;aration says UTF16 a decent text editor will confirm it's actually UTF8.

    Try this one.  You also get a warning when you open the file in Studio that gives you a clue the file has ben corrupted somewhere... not a Studio problem:


     

    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

Reply Children