RWS Community
RWS Community
  • Site

Trados Studio

Trados Team

Trados Accelerate

Trados Enterprise

Trados GroupShare

Trados Business Manager

Passolo

MultiTerm

RWS AppStore

Connectors

Beta Groups

Managed Translation

MultiTrans

TMS

Trados Enterprise

WorldServer

Language Weaver

Language Weaver Edge

Language Weaver Connectors

Language Weaver in Trados Studio

 

 

Tridion Docs

Tridion Sites

Contenta

LiveContent

XPP

Trados Studio Ideas

Trados GroupShare Ideas

Trados Team Ideas

Trados Team Terminology Ideas

Trados Enterprise & Accelerate Ideas

Trados Business Manager Ideas

MultiTerm Ideas

Passolo Ideas

RWS Appstore Ideas

Tridion Docs Ideas

Tridion Sites Ideas

Language Weaver Ideas

Language Weaver Edge Ideas

Managed Translation - Enterprise Ideas

TMS Ideas

WorldServer Ideas

Trados Enterprise Ideas

XPP Ideas

GroupShare Developers

Language Cloud Developers

MultiTerm Developers

Passolo Developers

Trados Studio Developers

Managed Translation Developers

TMS Developers

WorldServer Developers

Tridion Docs Developers

XPP Developers

Language Combinations by Language Services

RWS Training & Certification

Style Guides

RWS Campus

Trados Approved Trainers

ETUG (European Trados User Group) Public Information

Nordic Tridion Docs User Group

Tridion West Coast User Group

Community Ops

demospace

RWS Community Internal Group

AURORA

Internal Trados Ideas

Linguistic Validation

Mercury

XPP Cloud

Recognition & Reward System

RWS Community Platform Related Questions

Community Solutions Hub (Trados)

Events

RWS Training & Certification

To RWS Support

  • Search
  • Translate

    Detecting language please wait for.......


    Powered by
  • User
  • Site
  • Search
  • User
  • Developers
  • Trados Portfolio
  • MultiTerm Developers
  • More
  • Cancel
MultiTerm Developers

MultiTerm Developers > MultiTerm API

How to add a concept to a local termbase using the MultiTerm SDK
  • Home
  • Forum
  • MultiTerm API
  • More
  • Cancel
  • New
Show Translation Options

Detecting language please wait for.......


Powered by
MultiTerm Developers requires membership for participation - click to join
  • -MultiTerm API
    • -Knowledgebase
      • How to add a concept to a local termbase using the MultiTerm SDK

How to add a concept to a local termbase using the MultiTerm SDK

In the following tutorial it will be explained how to add a concept to a existing local termbase using MultiTerm SDK.

Sdl.MultiTerm.TMO.Interop vs Sdl.MultiTerm.Client.Api

MultiTerm Client is a newer API which might contain some improvements but this dll is private.

Tthis means it cannot be used in a plugin. When a plugin which uses a nonpublic api is used in Studio a error message appears when Studio is loaded. This client is recomanded to be used for standalone applications.

"Sdl.MultiTerm.Client.Api" is not a full replacement for the "Sdl.MultiTerm.TMO.Interop"

Sdl.MultiTerm.TMO.Interop is a public api, and it can be used in a plugin.

Full sample code can be found on SDL Community GitHub Repository.

How to load a local Termbase and get the Entries using Sdl.MultiTerm.TMO.Interop

First of all you need to add a reference to MultiTerm Interop library.

var multiTermApplication = new Application();
var localRep = multiTermApplication.LocalRepository;
localRep.Connect("", "");

var termbases = localRep.Termbases;
var path = termbasePath;
termbases.Add(path, "", "");
var termbase = termbases[path];
var entries = termbase.Entries;

How to add a new entry to a local Termbase

To add new entries to a termbase, you first need to 'construct' the entry XML content to store in the termbase. Below you see a simplified example of what a MultiTerm XML entry can look like:

<conceptGrp>
  <languageGrp>
   <language type="English" lang="EN"/>
   <termGrp>
    <term>Sdl Community Wiki</term>
   </termGrp>
  </languageGrp>
</conceptGrp>

Example of concept content for 2 languages
<conceptGrp>
<languageGrp>
<language type="English" lang="en-US" />
<termGrp>
<term>Step</term>
</termGrp>
</languageGrp>
<languageGrp>
<language type="French" lang="fr-FR" />
<termGrp>
<term>étape</term>
</termGrp>
</languageGrp>
</conceptGrp>

entries.New(entryContent,true)

What is Termbase Language Index and why do we need to use it

In the above XML example we see the language type is set to "English". Termbase Language index give us the Language Name which correspond to all language flavours. 

For example English (Unites States) and English (Australia) will have the same language Index "English".

In the bellow example we'll use the Display Name of the language to create a entry.

Following error will appear when we try to add the concept:

How to get the Termbase Language index list

From the active project we can take the TermbaseConfiguration for Default Termbase set in project settings.

var projectsController = SdlTradosStudio.Application.GetController<ProjectsController>();
var activeProject = projectsController?.CurrentProject;

var termbaseConfiguration = activeProject?.GetTermbaseConfiguration();

var languageIndexes = termbaseConfiguration.LanguageIndexes;

In order to get the corresponding TermbaseLanguage index for a language we can use following example:

How to get entries number for each language

1. Using Studio context

After getting the Language Index (see  the method "GetTermbaseIndex" from the previews print screen), you should be able to get the entries number for each language using the below code:

var numberOfLanguageEntries = termbase.Information.NumberOfEntriesInIndex["languageIndex"];

2. Using Standalone application

The Code sample can be found on the SDL GitHub public repository, unde the Code samples folder.

On the appstore.sdl.com site, it can be accessed the Multiterm Desktop SDK.

The number of term entries can be accessed similar with the plugin's side, based on the language index:

  • Get the termabase
  • Get the termbase information: var termbaseInformation = termbase.Information;
  • Get the Indexes from termbase.Definition.Indexes (each index corresponds to one language)
  • Use the Language value from each index to retrieve the number of terms entry : termbaseInformation.NumberOfEntriesInIndex(languageIndex.Language)

Tags:

Documentation
MultiTerm SDK Wiki
Tips&Tricks
  • Share
  • History
  • More
  • Cancel
Related
Recommended
  • Our Terms of Use
  • Copyright
  • Privacy
  • Security
  • Anti-slavery Statement
  • Cookie Notice
  • YouTube