Project creation is automated, but need to use server memories and sever termbase instead.

Hi everyone

I followed the example and I managed to create a windows application that allows me to drag files and create a Studio project, however instead of using a file-based memory, I need to use several memories located on a server, same thing for the termbase.

Apparently I need to use the class "TranslatioProviderServer" to initialize an object, then use its method GetTranslationMemories to retrieve a collection of memories from this server, however I can't make this to work.

Has anyone done anything similar? would you be kind to give me some examples?

 

Thanks
Marcelo

 

 

 

 

  

 

 

 

Parents
  • I'm also unable to get server-based memories working, though I'm stuck at the very first step of connecting to the server. The sample code given in the automation SDK docs is below; I have the uri and tmname available but what should be used for server path? Were you able to access the list of server memories using this or any other method?

    TranslationProviderConfiguration tmConfig = project.GetTranslationProviderConfiguration();
    tmConfig.Entries.Add
    (
    new TranslationProviderCascadeEntry
    (
    new TranslationProviderReference(new Uri(String.Format("{0}{1}/{2}", uri, path, tmname))), true, true, true, 0
    )
    );

     

     

  • Hi all,

    SDL are investigating and will get back to you with further info.

    Regards, Ian

    Ian Davies  |  Senior Product Manager | SDL | Language Technologies Division

    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,

    Please check this post AnalyzeFiles and PreTranslateFilesTasks inProject Automation API Ignore Server TMs.

    What you need it seems to be the section for Configuring the TMs.  Try the code sited by SDL in the above post ....

     

    "

        // 2. configure the TM:

        var tmProviderConfig = project.GetTranslationProviderConfiguration();

        var tmServer = new TranslationProviderServer(new Uri("http://shdevgs2011:80"), false, "sa", "sa");

        var serverTm = tmServer.GetTranslationMemory("/SDL Trados Studio/TestServerTM", TranslationMemoryProperties.All);

        var tmProviderRef = new TranslationProviderReference(serverTm.Uri, serverTm.SerializeState(), true);

        var providerEntry = new TranslationProviderCascadeEntry(tmProviderRef, true, true, true);

               

        tmProviderConfig.Entries.Add(providerEntry);

        project.AddMasterTM(tmProviderConfig, "de-DE");

    "

    It solved my problem.

     

    Hope it helps in the mean while.

     

    Best regards,

    Costas

     

  • The server TM can be configured as Costas described. For detail please check the thread he refered. For server termbase, I tested with the following steps and it works fine for  me:

    1. Test a server termbase in Studio: create a project with server termbase (my termbase server is : shdevgs2011, and the termbase name is 1234). This is to ensure my temrbase server works well and my connection is fine. This also caches my server connection crendential.

    2. Run a test app with the following code:

    static FileBasedProject PrepareProject()

    {

        var infoProjectToCreate = new ProjectInfo()

            {

                Name = "Test package re-import",

                Description = "",

                DueDate = new DateTime(2013, 6, 6),

                SourceLanguage = new Language("en-US"),

                TargetLanguages = new Language[] {new Language("de-DE")},

                LocalProjectFolder = Path.Combine(WorkFolder, "Projects")

            };

     

        var project = new FileBasedProject(infoProjectToCreate);

        var termbaseConfig = project.GetTermbaseConfiguration();

        termbaseConfig.TermbaseServerUri = new Uri("http://shdevgs2011/");

        var termbase = new ServerTermbase("1234", null, true);

        termbaseConfig.Termbases.Add(termbase);

        termbaseConfig.LanguageIndexes.Add(new TermbaseLanguageIndex(new Language("en-us"), "English"));

        termbaseConfig.LanguageIndexes.Add(new TermbaseLanguageIndex(new Language("de-de"), "German"));

        project.UpdateTermbaseConfiguration(termbaseConfig);

     

        var sourceFile = Path.Combine(WorkFolder, "Data\\TryPerfectMatch.doc");

        project.AddFiles(new string[] { sourceFile });

     

        project.Save();

     

        var projectSourceFiles = project.GetSourceLanguageFiles();

        var automaticTask = project.RunAutomaticTasks(projectSourceFiles.GetIds(),

                new string[]

                    {

                        AutomaticTaskTemplateIds.Scan,

                        AutomaticTaskTemplateIds.ConvertToTranslatableFormat,

                        AutomaticTaskTemplateIds.CopyToTargetLanguages,

                        AutomaticTaskTemplateIds.AnalyzeFiles

                    });

     

        project.Save();

        return project;

    }

    3. Go to Studio to open the project just created and check the termbase from project settings. Termbase is there ready for use. I then open the file for translation, the terms are also recognized.

     

    Hopefully this steps could help you solve your issue.

    Regards,

    Xingzeng

  • Costas, how did you get this path  "/SDL Trados Studio/TestServerTM"

    in the code

    var serverTm = tmServer.GetTranslationMemory("/SDL Trados Studio/TestServerTM", TranslationMemoryProperties.All);

  • Hi gd,

    I use multiple TMs in an array that holds the names so I use in a for loop the following code :

                   ServerBasedTranslationMemory serverTm = tmServer.GetTranslationMemory("/" +

                   StrProjTMIdea, TranslationMemoryProperties.All);

    the StrProjTMs array contains the Server TMs to be used and each entry has either the server tm name (if it is is just under the Root Organization) or the parent resource group name / the tm name, derived from the following code.

                  if (ServerTM.ParentResourceGroupName == "Root Organization") TMServerListLine = ServerTM.Name;

                  else TMServerListLine = ServerTM.ParentResourceGroupName + "/" + ServerTM.Name;

    so each TM name to be used is either /TmName (just under the Root Organisation) or /ParentResource/TmName.

    The "/SDL Trados Studio/TestServerTM", is an example name.

    I hope it helps.

    Best regards,

    Costas

  • Hi Costas,

    Thank you so very much for your response. I finally was able to identify the TMs' path on the server. It all works great, but :)

    When I run my API with local TMs, it uses the template, runs pretranslation and analysis. When I run the same code with server tms, it does not do any pretranslation and analysis. Do you have any suggestions on how make the template work with server TMs wihtout 'manually' adding a code for those TMs? If I AddTms, then the API ignores TMs identified in the template. Hope my question make sense. Thank you so much!

    gd

  • Hi gd,

    Sorry.  I have not used Templates with Server TMs on my application.

    However,  I would think that as long as your application runs fine with local TMs in the template it should not make any difference if the template has Server TMs.

    What happens if you put both local and Server TMs in the template?

    Best regards,

    Costas

Reply Children