Search and Replace of terms in new targets in SDLXLIFF

Issue #588 new
David López created an issue

Dear all,

I was looking into the feature Search and Replace with Filter in Rainbow, so that I can add my own terms in a Studio file (.sdlxliff) using a .txt file. It worked fine. However, upon opening the file in Studio, I saw that all the translation units had been automatically accepted!

I would like to know if there is a way, so that all the translation units are preserved in the very same as they used to be, that is, as draft, or in a way they are not automatically accepted, so that I can speed this process up.

Besides, I also noticed that files should be with the source copied into the target, so as to have the terms replaced with the terms coming from the .txt file. Is there a way to avoid copying the source into the target? It would be nice if, when using this feature, the target and the terms would be added at the very same time, ideally, only the segments that have been modified, in other words, that contain terms added by such feature.

I hope you can look into this for me.

I am looking forward to hearing from you.



Comments (14)

  1. YvesS

    It seems the .sdlxliff file you provided is the one after the replacement. Would you be able to provide the file before the replacement. I'm also not quite sure what the goal is. Here is what I think I understand:

    • you have a file not translated yet (with nothing in the target)
    • you want to a) copy the source text into the target and b) replace in the target any source term by its corresponding translated term.

    is that correct?

  2. David López reporter

    Dear Yves,

    Thanks a lot for your swift reply! It's much appreciated.

    You are quite right about my goal. I am sorry I was not able to make things clear:

    1. I have a .sdlxliff file that is not translated (nothing in the target). I am attaching it again

    2. I would need to add terms into the target according to a .txt I was attaching in my initial query

    3. I would like to have these terms included in my Studio file and the source copied into the target using Rainbow (I know there are other tools such as SDLXLIFF Toolkit to speed this process up, but I just want to know if it's possible to use Rainbow for the whole workflow)

      3.1. Besides, it would be great if it's possible to process the files, and Rainbow is able to copy the source into the target only for the files that now include terms

    4 And last but not least, the most import thing for me is the fact that, when you use the feature Search and Replace with Filter, all the status in Studio are changed into Translated. That's not correct as far as I can see, since what's been done so far is only adding a term (or some of them) into the target, but the file is not translated. As I pointed out before, I know it's pretty easy to remove such status using other tools, but I should like to know if it's possible to implement this in Rainbow (or it might already exist), so that the status is changed into Draft when this feature is used

    I do hope everything is clear now. Do not hesitate to contact me in case of queries.

    Kind regards,


  3. YvesS

    I'm afraid there is not much we can do easily for this:

    • Rainbow does not change the state: there is no state for these entries. Studio simply decide what the state is when opening the document: If there is text (even identical to the source) and no state, Studio assumes it is "Translated".

    The solution for this would be to have an option to create a state attribute with the proper value when doing the copy.

    • For the copy source into target only if a term is found: the process uses 2 steps: one to copy the source, the second to replace the terms.

    The solution here would be to re-write a new step that does both at the same time, so the target would populated only when a term is found. Another solution would be to update the "Remove Target" step to allow a new option that would remove only the target when it's the same as the source, and add that modified step to the pipeline after the search and replace.

    Those additional features could be done, so I'll leave this issue open. But I doubt all of them will get implemented anytime soon.

  4. David López reporter

    Dear Yves,

    Thanks again for your answer! This time, I took the time to compare both files, the source and the one coming from Rainbow after having used the Search and Replace of terms feature.

    For this, I opened the file that was processed using Rainbow in Notepad++, and I noticed the following change:

    conf="translated" had been added in the four translation units.

    By default, in Studio, the status is Not translated and this cannot be found in Notepad++. Hence, Rainbow automatically adds the translated status, so that's the reason why Studio displays it as translated, because of this addition. In other words, there is, indeed, status: conf="translated".

    This way, always in my humble opinion, the ideal status would be conf="Draft" for those segments that contain the terms, and Not translated for the translation units that have not been modified. In this case, the source could also appear in the target, since this would not be misleading.

    Thanks again for your time!



  5. YvesS

    Indeed, there is a non-standard attribute conf added (and in some case, added incorrectly it seems: I had for example conf="[@#$SDLSEGCONF$#@]").

    @jhargrave : This is related to the SDL-specific properties it seems.

  6. Chase Tingley

    I believe that value is exposed as a filter parameter called sdlSegConfValue, but it doesn't have a UI equivalent.

    To see it:

    • In rainbow, create a copy of the okf_xliff-sdl filter
    • This will create a file on disk called okf_xliff@copy-of-sdl.fprm (or whatever name you used instead of copy-of-sdl). Open this file.
    • At the bottom, you should see a line like sdlSegConfValue=Translated. Modify that value to the status you want.

    Now if you use your modified filter in Rainbow, it should update the status to the value you want.

    Possible enhancements here: * Expose this in the UI (obviously) * Option to preserve the source conf value and not modify it at all, rather than hardcoding a specific output value

  7. Chase Tingley

    I've written up a proposal for a better way of handling these conf values in general that should also improve quality of life in this scenario; see issue #597.

  8. YvesS

    Hi Jonny,

    The utility uses Java regular expression, so you can use the \b boundaries matcher to search whole words in each of your search entry (And make sure the "Use regular expressions" option). For example \bear\b will match "ear" in "his ear" but not in "this bear".

  9. Jonny Tung

    thanks so much, but how can i replace whole word only in Search and Replace with Filter in Rainbow, when using txt file (file with replacement)

  10. Log in to comment