MT Cache on a separate SQL Server

For specific scenarios, project-based or separated SQL storage can be used for MT cache. MT Cache is consisted of three table objects in database:

  • LTGearMTCacheData

  • LTGearMTCacheHit

  • LTGearMTCacheOrigin

You can create all those necessary objects with following script:

Please ask Service-desk to create a new database, dedicated for your project’s MT Cache purposes, set appropriate access rights (db owner) and run the script on it. Following structure is created on the SQL server:

SQL Database structure of MT Cache

Hash code in LTGearMTCacheData table

LTGearMTCacheData table contains a column with a ‘hash code’, computed from source string. This is necessary to fill the hash code while inserting new records to the database. To be consisted with MT Companion, your developers should use following routine for hash code computation:

static public class Hash
{
    static public string GetHashAsNumber(string text)
    {
        var bytes = Encoding.UTF8.GetBytes(text);
        int res = 0;
        for (int i = 0; i < text.Length; i++)
        {
            res = res + (i * bytes[i]) % int.MaxValue;
        }
        return res.ToString();
    }
}

Encoding In-line tags

In case you will need to insert records to MT Cache that contains in-line tags (e.g. ‘This is <b>awesome</b>’), you need to encode them into internal XLIFF format, used in MT Companion (XLIFF 2.1) like in row 3 of following data:

In-line tags encoding example

MT Companion developers can provide guidance and a DLL library with helpers which will do the in-lines conversion.