TypeScript library for converting SDLTM files (Translation Memory databases from Trados Studio) to TMX 1.4b
npm install sdltm
- Node.js 20.11+ (or any release that ships the
node:sqliteexperimental module) - SQLite-compatible
.sdltmfiles created by SDL/Trados Studio
import{TMReader,TMReaderResult}from'sdltm';functionconvertWithPromise(): void{constreader: TMReader=newTMReader({productName: 'My Tool',version: '2.0.0'});reader.convert('Japanese.sdltm','Japanese.tmx').then((result: TMReaderResult)=>{console.log(`Conversion completed with status: ${result.status}, total TUs: ${result.count}`);}).catch((error: unknown)=>{constmessage: string=errorinstanceofError ? error.message : String(error);console.error('Conversion failed:',message);});}convertWithPromise();import{TMReader,TMReaderResult}from'sdltm';asyncfunctionconvertWithAsyncAwait(): Promise<void>{constreader: TMReader=newTMReader({productName: 'My Tool',version: '2.0.0'});try{constresult: TMReaderResult=awaitreader.convert('Japanese.sdltm','Japanese.tmx');console.log(`Conversion completed with status: ${result.status}, total TUs: ${result.count}`);}catch(error: unknown){constmessage: string=errorinstanceofError ? error.message : String(error);console.error('Conversion failed:',message);}}convertWithAsyncAwait();productNameandversioncan be omitted; when they are,TMReaderfalls back to the values declared in the package’s ownpackage.json.convert()returns a promise and automatically closes the SDLTM database connection when the process finishes or fails.- The Node.js
node:sqlitemodule currently logs an experimental warning; this is expected until the API is stabilized upstream.