How to : create a Server Based TranslationMemory

Hi there,

I'm struggling a bit with the SDKeven though I'm trying to accomplish something quite simple.

I'm trying to create a server based TM, initiliaze it and fill it up with content coming from a TMX.

            // connect to the server
            TmServer = new TranslationProviderServer(new Uri(http://server), false"login""pass");
            TmContainer = TmServer.GetContainers(ContainerProperties.None).First();
            
            // create and initialize new TM 
            ServerBasedTranslationMemory tm = new ServerBasedTranslationMemory(TmServer);
            tm.Container = TmContainer;
            tm.Name = "MyTM"; 

If  I then call the

tm.Save();
 

I'd get an error saying that "at least one TM language direction should be specified". Sounds perfectly logic to me , but the LanguageDirection property is read only (just a getter) so I've been looking though the object model and the forum but could not find any way to assign those values.

Is it feasible to assign LanguageDirection using the SDK ? Or in other words, is the TM creation allowed using the SDK ?

Regards

Greg

Parents
  • Hi Greg,

    please check the API documentation on producthelp.sdl.com/.../2.1

    Working with TM server > Code examples > Creating a server translation memory:

    ...

    #region "LanguageDirection"

               this.CreateLanguageDirections(newTM.LanguageDirections);

               #endregion

    ...

    #region "languages"

           private void CreateLanguageDirections(ServerBasedTranslationMemoryLanguageDirectionCollection directionsCollection)

           {

               ServerBasedTranslationMemoryLanguageDirection direction = new ServerBasedTranslationMemoryLanguageDirection();

               direction.SourceLanguage = CultureInfo.GetCultureInfo("en-US");

               direction.TargetLanguage = CultureInfo.GetCultureInfo("de-DE");

               directionsCollection.Add(direction);

           }

           #endregion

    Rainer

Reply
  • Hi Greg,

    please check the API documentation on producthelp.sdl.com/.../2.1

    Working with TM server > Code examples > Creating a server translation memory:

    ...

    #region "LanguageDirection"

               this.CreateLanguageDirections(newTM.LanguageDirections);

               #endregion

    ...

    #region "languages"

           private void CreateLanguageDirections(ServerBasedTranslationMemoryLanguageDirectionCollection directionsCollection)

           {

               ServerBasedTranslationMemoryLanguageDirection direction = new ServerBasedTranslationMemoryLanguageDirection();

               direction.SourceLanguage = CultureInfo.GetCultureInfo("en-US");

               direction.TargetLanguage = CultureInfo.GetCultureInfo("de-DE");

               directionsCollection.Add(direction);

           }

           #endregion

    Rainer

Children