I'm having a problem programmatically adding server-based termbases to a project.
I have the following code (C#):
TermbaseConfiguration termbaseConfig = project.GetTermbaseConfiguration();
termbaseConfig.TermbaseServerUri = "http://our.server.url/groupshare/";
termbaseConfig.Termbases.AddRange(termbases.Select(t => new ServerTermbase(t.Name, null, true)));
When I open this project in Trados the termbase is greyed-out, the "Enabled" checkbox is unchecked (even though the .sdlproj file contains <Enabled>true</Enabled>) and there is a red circle with a cross next to the termbase name (instead of a green circle with a tick).
So I compared the programmatically-generated .sdlproj file with one created by Trados and referencing the same TM and termbase.
Trados-generated project file:
<Termbases>
<Name>MY_TERMBASE_NAME</Name>
<SettingsXml><?xml version="1.0" encoding="utf-16"?>
<TermbaseSettings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Path>sdltb.http://our.server.url/groupshare/\%\MY_TERMBASE_NAME</Path>
<IsOpen>false</IsOpen>
<Filter>0</Filter>
<FilterHighlight>false</FilterHighlight>
<Layout>0</Layout>
<Local>false</Local>
<IsCustom>false</IsCustom>
</TermbaseSettings></SettingsXml>
<Enabled>true</Enabled>
</Termbases>
And here is the programmatically-generated equivalent:
<Termbases>
<Name>MY_TERMBASE_NAME</Name>
<SettingsXml><?xml version="1.0" encoding="utf-16"?>
<TermbaseSettings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Path>our.server.url\%\MY_TERMBASE_NAME</Path>
<IsOpen>false</IsOpen>
<Filter>0</Filter>
<FilterHighlight>false</FilterHighlight>
<Layout>0</Layout>
<Local>false</Local>
<IsCustom>false</IsCustom>
</TermbaseSettings></SettingsXml>
<Enabled>true</Enabled>
</Termbases>
In case it's not obvious, the difference is the "Path" node in the escaped XML...
Trados-generated:
<Path>sdltb.http://our.server.url/groupshare/\%\MY_TERMBASE_NAME</Path>
programmatically-generated:
<Path>our.server.url\%\MY_TERMBASE_NAME</Path>
The Trados-generated code has the correct URL.
Note that the .sdlproj file also contains the following nodes, which are correct in both the Trados-generated and programmatically-generated versions:
<TermbaseServer>
<ServerConnectionUri>http://our.server.url/groupshare/</ServerConnectionUri>
</TermbaseServer>
I've found that even if I force the TermbaseServerUri property with
termbaseConfig.TermbaseServerUri = "sdltb.http://our.server.url/groupshare/";
the output is still the same. It uses the correct value for the <ServerConnectionUri> node but not inside the <SettingsXml> nodes.
Can anyone explain why my code results in the termbase being declared differently in the project file? And does this explain why the termbase is greyed-out and not enabled when the project is viewed in Trados?