Exclude strings in a .txt file

Hello,

 

we are currently having problems, excluding strings in a .txt file when we create a new project.

The file looks like this:

   Stellgeraet[3].Bezeichnung_Abs := '2:SG:3';
   Stellgeraet[3].Bezeichnung_Sym := 'Vereinzelung Radschraube 1';
   Stellgeraet[3].Bewegung_links_Abs := 'A100.1';
   Stellgeraet[3].Bewegung_links_Sym := 'zurück';
   Stellgeraet[3].Endlage_links_Abs := 'E4.3';
   Stellgeraet[4].Bezeichnung_Abs := '2:SG:4';
   Stellgeraet[4].Bezeichnung_Sym := 'Blasluftschuß Radschraube 1';
   Stellgeraet[4].Bewegung_links_Abs := 'N A100.5';
   Stellgeraet[4].Bewegung_links_Sym := 'aus';

 

We only need to translate the yellow text. How do we have to set the project settings, to only get this marked text?

We tried it with Document structure to define the start and the end of the text that needs to be translated with :=' for start and '; for end (but it didn't work).

We also tried to set inline tags, which also didn't work.

 

We appreciate every kind of help.

 

If you have further questions, please ask.

 

Best regards,

Marius Dieterle

Parents
  • Hi Marius,

    In addition to the suggestion type definition file sent by Paul, I have copied your text and I have created a plain text file, assuming that the file you are working on is a plain text file (*.txt).

    If your file has a different extension, but if actually it is a text file, just create a copy of your original file and add to it a second extension “.txt” (e.g. TEXT.[your extension].txt) and open/check it in a simple text editor (say Notepad or Notepad++; I suggest to avoid MS Word, when possible).

    As you want to extract just text between starting ' and closing ', ignoring all other text of the pertinent string, before loading the file to create your project, you should define the Project Options “Options > File Type > Text > Document structure” window inserting a ' in “Opening pattern” field and a ' in the “Closing pattern” field, check the “Multiline” if required, and click on “Add” to obtain:

    Now click on the existing default pattern (opening pattern ^ and closing pattern $) to select it and click on “Delete” to discard this rule and maintaining just your ' and ' opening and closing patterns.

    At this point, to preview the result of this setting, click on “Browse” and select the file with double extension (*.[your extension].txt) and then on “Preview” and you should obtain:

    that is what you needed. Am I right?

    Now go on loading your file in SDL Studio as usual and complete the Project routine and start translating your file that should appear as follows in the Editor view:

    When completed the translation, save the target final file as usual (SHIFT + F12), go to the folder containing your translated (double extension) file and delete from it the second added extension (.txt) to obtain a final translated file *.[your extension].

    I hope this may help you.

    Claudio

     

    ADDENDUM: To avoid problems regarding the presence of possible internal presence of ' inside the text to extract/translate, the above opening/closing patterns may be, respectively. =\s' and ';$.

Reply
  • Hi Marius,

    In addition to the suggestion type definition file sent by Paul, I have copied your text and I have created a plain text file, assuming that the file you are working on is a plain text file (*.txt).

    If your file has a different extension, but if actually it is a text file, just create a copy of your original file and add to it a second extension “.txt” (e.g. TEXT.[your extension].txt) and open/check it in a simple text editor (say Notepad or Notepad++; I suggest to avoid MS Word, when possible).

    As you want to extract just text between starting ' and closing ', ignoring all other text of the pertinent string, before loading the file to create your project, you should define the Project Options “Options > File Type > Text > Document structure” window inserting a ' in “Opening pattern” field and a ' in the “Closing pattern” field, check the “Multiline” if required, and click on “Add” to obtain:

    Now click on the existing default pattern (opening pattern ^ and closing pattern $) to select it and click on “Delete” to discard this rule and maintaining just your ' and ' opening and closing patterns.

    At this point, to preview the result of this setting, click on “Browse” and select the file with double extension (*.[your extension].txt) and then on “Preview” and you should obtain:

    that is what you needed. Am I right?

    Now go on loading your file in SDL Studio as usual and complete the Project routine and start translating your file that should appear as follows in the Editor view:

    When completed the translation, save the target final file as usual (SHIFT + F12), go to the folder containing your translated (double extension) file and delete from it the second added extension (.txt) to obtain a final translated file *.[your extension].

    I hope this may help you.

    Claudio

     

    ADDENDUM: To avoid problems regarding the presence of possible internal presence of ' inside the text to extract/translate, the above opening/closing patterns may be, respectively. =\s' and ';$.

Children
  • Hi ,

    That's looking remarkably similar to the original suggestion... but with more pictures ;-)

    I did notice something interesting through and would suggest a changed closing pattern as the last word gets missed for me... but that might be just because of the copy paste to create the file rather than dealing with the actual file itself.

    Opening pattern:
    .*:=\s'

    Closing pattern:
    ';|\s$

    Regards

    Paul

    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

  • Dear Claudio,

    I am so happy to find this answer too.

    But I also have a similar problem. I have a tab delimited (.txt) document and the text is separated by tab, not by (') and (') as the example above. How to process it? Example:

    40    350    1    <korean characters>    This text should be translated1    <another character>

    41    351    1    <korean characters>    This text should be translated2    <another character>

    42    352    1    <korean characters>    This text should be translated3    <another character>

     

    How to translate the yellow parts only? What "character" to be used as the opening and closing pattern? The file was OK on Excel, and I wish it is an Excel file or <.csv> file. But unfortunately, the text is in <.txt> format.

    Thank you.

     

    Sarah

  • Hi  

    Perhaps the easiest solution is to just import the txt into excel then just hide the columns you don't want? If it's tab delimited as you suggest then they should nicely split like this:

    Save the file as excel and then just hide columns A, B, C, D and F.  When you're done translating just save the target file, open in Excel and save as a TXT again.

    Regards

    Paul

    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

  • Hi Paul, thank you for the solution.
    I have just tried to do that. But when I save as the excel file back to txt and open in Notepad++, the Korean characters do not appear properly. They appear as ???? characters instead. Any further solution? Many thanks.

    Sarah
  • Hi ,

    Make sure you use the option to save as "Unicode Text (*.txt)" and then it should be fine. CSV is a problem but Excel can manage to save as unicode in the txt format.

    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