Is there a way to update/pretranslate only some source or translation lists by macro?

Hi,

in my workflow, I'm using a macro tor updating and leveraging the source string lists, filtering some strings and to update and pretranslate the target string lists afterwards.

Unfortunately, I didn't found a possibility to update and leverage the source lists as a collection - not by updating/leveraging each source list one by one instead of all source lists as a collection.
And I didn't found a possibility to update and pretranslate the target string lists - for a single language - as a collection instead of one by one, too.

Please be so kind to let me know, how updating, leveraging and pretranslating can be run as a single action by a macro instead of updating, laveraging and pretranslating each string list one by one.
If you have any further questions, please don't hesitate to let me know.
Thank you very much in advance for your support.

Kind regards and have a nice day.
Nils

emoji
  • Updating single lists can be done using PslTransList.Update and PslSourceList.Update.

    Updating lists as a collection can be done using PslProject.UpdateTransLists and PslProject.UpdateSourceLists.

    emoji
  • Hello ,

    thanks for your reply.

    Is there a way, to "create" a collection of some source or target string lists?
    For example, I'd like to pre translate only string lists of one target language instead of all target languages. And the same for updating the target string lists.
    At the moment, I'm running the pre translation as well as the update for each string list separately using "PslTransList.Update" and "...autotranslate".

    Wouldn't it be better and/or more efficient/less time consuming to update some string lists as a collection instead of one by one?

    Kind regards
    Nils

    emoji
  • From a COM object model point of view, there is just update all or update single. In your code, you can create your own collections, lists, or arrays and insert Passolo lists into it depending on your conditions and then create methods to update (or pre-translate) them. But there are no pre-defined (empty) collections in the object model that you can simply use for it.

    emoji
  • Hello ,

    o.k., creating our own collections sounds interesting. That's, what I've thought about.
    I'll have to have a deeper look into it, especially in how to create our own collections and how to insert lists into them as I've never done this before.

    Best regards and thank you very much for your great support! :)
    Nils

    emoji
  • Hello,

    can anybody give me a short example, how to create a new collection of string lists and how to add single string lists to this collection in a Passolo macro, please?

    I think, creating is done by 

    Fullscreen
    1
    Dim SourceListCollection As New ???
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    But "As New" what?
    And how do I add single lists to this collection to be able to run an update or leverage afterwards? Thinking


    I'd like to run a "leverage" as well as an update of only the string lists in the colletion. (Instead of leveraging or updating all string lists at once or every string list, one by one.)

    Thank you very much in advance for your support.

    Best regards and have an easy day.
    Nils

    emoji
  • I don't know whether it would make sense to talk about possible approaches to implementing a collection here. If this is really desired, I would probably implement a class (Class PslSourceListCollection), which then gets the methods I need implemented. Examples would be management functions such as RemoveAll, Add, etc. but also Passolo-specific functions such as PreTranslate or Update or Leverage. If such a class were designed and implemented, it could be used in various macros.

    Although I have already implemented a lot of macros, it never occurred to me to implement further classes and objects as macro classes in addition to the Passolo object model. The methods and properties (here Update and Leverage) provided by the Passolo object model have been sufficient for me in most of the use cases.

    In order to implement the required functions, I mostly worked with loops and in my opinion this would also be necessary if there were a collection. My approach would be:

    For Each src In prj.SourceLists
        If Condition Then
            src.Update
        End If
    Next src
    

    With the usage of a collection, it may look like this:

    Dim SrcColl As New PslSourceListCollection
    SrcColl.RemoveAll
    For Each src In prj.SourceLists
        If Condition Then
            SrcColl.Add src
        End If
    Next src
    SrcColl.UpdateAll
    

    My approach can't really be reused very well, but one of the goals was always to deliver a solution as quickly as possible and with as little effort as possible.

    emoji
  • Good morning ,

    thank you very much for your reply and especially for your example coding.

    I've been thinking about creating and using a collection of string lists, because RWS support mentioned during a support case: "The macro you use seems to perform the leverage on files one by one instead of running a single batch of files, this should be changed, if possible, to select all the files and run a single leverage action which should help again with performance."

    If I understand your reply correctly, it should be "enough" (regarding especially the performance), to use the existing classes and objects from the Passolo object model and, for example, to run a

    Fullscreen
    1
    2
    3
    4
    5
    For Each TranslationList In project.TransLists
    If TranslationList.Language.LangID = Language.LangID Then
    TranslationList.Leverage(EnglishProject)
    End If
    Next
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    if we only want to leverage or update some of the string lists. Or would it be better from your point of view, to use new collections in this case?

    Best regards and have an easy day.
    Nils

    emoji
  • PslTransList.Leverage is a method that can be called file by file only. Running Leverage on a batch of translation or source lists is just possible using the UI. So a collection cannot help here, because the Leverage must also be called file by file in the methods of the collection class.

    What might help regarding performance is that fact that each method that runs on complete lists (like Leverage) will automatically save its changes when it ends. When your project is on a shared network drive and unpacked, that might take ages. To prevent this, please use

    prj.SuspendSaving
    For Each TranslationList In Project.TransLists
        If TranslationList.Language.LangID = Language.LangID Then
            TranslationList.Leverage(EnglishProject)
        End If
    Next
    prj.ResumeSaving

    This might already help to boost performance.

    emoji
  • Hello ,

    that's a good hint! Slight smile
    Can unpacking and repacking of a project be done, only using the UI or using a macro, too? Unfortunately, I didn't found a possibility, to do this within a macro, until now.

    Best regards
    Nils

    emoji
  • Packing and Unpacking is a one-off task that is only available in the UI. It will usually be done just once then the project is used in unpacked mode.

    emoji
1 2