Skip to content

Commit

Permalink
TMX 3.2.1.0 - SDLCOM-6145: Fixed a bug. Attempting to create the proj…
Browse files Browse the repository at this point in the history
…ect will now mark the TMX files as translatable.
  • Loading branch information
aflorescu579774 committed Dec 9, 2024
1 parent 1ba9491 commit 6d94401
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 24 deletions.
2 changes: 1 addition & 1 deletion TMX/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("3.2.0.0")]
[assembly: AssemblyFileVersion("3.2.0.0")]
[assembly: AssemblyFileVersion("3.2.1.0")]
[assembly: Sdl.Core.PluginFramework.Plugin("Plugin_Name")]
33 changes: 11 additions & 22 deletions TMX/TMXSniffer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,33 +67,22 @@ private bool IsFileSupported(string nativeFilePath)
// from the file header
private void GetFileLanguages(ref SniffInfo info, string nativeFilePath)
{
XmlDocument doc = new XmlDocument();
XmlDocument doc = new XmlDocument();

doc.Load(nativeFilePath);
string tmxSource = doc.SelectSingleNode("tmx/header/@srclang").InnerText;
CultureInfo sourceLanguage;
try // currently LegacySdlxLanguage initialization fails first time
{
sourceLanguage = LegacySdlxLanguage.GetCultureInfoFromIsoCode(tmxSource);
}
catch
{
sourceLanguage = LegacySdlxLanguage.GetCultureInfoFromIsoCode(tmxSource);
}
string tmxSource = doc.SelectSingleNode("tmx/header/@srclang").InnerText;

info.DetectedSourceLanguage =
new Sdl.FileTypeSupport.Framework.Pair<Language, DetectionLevel>(new Language(sourceLanguage), DetectionLevel.Certain);
new Sdl.FileTypeSupport.Framework.Pair<Language, DetectionLevel>(new Language(tmxSource), DetectionLevel.Certain);

if (doc.SelectSingleNode("tmx/body/tu[1]/tuv[2]").Attributes[0] != null &&
doc.SelectSingleNode("tmx/body/tu[1]/tuv[2]").Attributes[0].InnerText.Length==5)
{
string tmxTarget = doc.SelectSingleNode("tmx/body/tu[1]/tuv[2]").Attributes[0].InnerText;
var targetLanguage = LegacySdlxLanguage.GetCultureInfoFromIsoCode(tmxTarget);

info.DetectedTargetLanguage = new Sdl.FileTypeSupport.Framework.Pair<Language, DetectionLevel>(new Language(targetLanguage),
DetectionLevel.Certain);
}
}
if (doc.SelectSingleNode("tmx/body/tu[1]/tuv[2]").Attributes[0] != null &&
doc.SelectSingleNode("tmx/body/tu[1]/tuv[2]").Attributes[0].InnerText.Length == 5)
{
string tmxTarget = doc.SelectSingleNode("tmx/body/tu[1]/tuv[2]").Attributes[0].InnerText;
info.DetectedTargetLanguage = new Sdl.FileTypeSupport.Framework.Pair<Language, DetectionLevel>(new Language(tmxTarget),
DetectionLevel.Certain);
}
}

}
}
2 changes: 1 addition & 1 deletion TMX/pluginpackage.manifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<PluginPackage xmlns="http://www.sdl.com/Plugins/PluginPackage/1.0">
<PlugInName>File type definition for TMX</PlugInName>
<Version>3.2.0.0</Version>
<Version>3.2.1.0</Version>
<Description>Open TMX files as translatable files in Trados Studio.</Description>
<Author>Trados AppStore Team</Author>
<RequiredProduct name="TradosStudio" minversion="17.1" maxversion="17.9" />
Expand Down

0 comments on commit 6d94401

Please sign in to comment.