diff --git a/build.cake b/build.cake index 96460be3..40c90c0b 100644 --- a/build.cake +++ b/build.cake @@ -520,10 +520,11 @@ Task("SRGen") .Does(() => { var projects = System.IO.Directory.GetFiles(sourceFolder, "project.json", SearchOption.AllDirectories).ToList(); + var locTemplateDir = System.IO.Path.Combine(sourceFolder, "../localization"); foreach(var project in projects) { var projectDir = System.IO.Path.GetDirectoryName(project); - var localizationDir = System.IO.Path.Combine(projectDir, "Localization"); + var localizationDir = System.IO.Path.Combine(projectDir, "Localization"); var projectName = (new System.IO.DirectoryInfo(projectDir)).Name; var projectNameSpace = projectName + ".Localization"; var projectStrings = System.IO.Path.Combine(localizationDir, "sr.strings"); @@ -566,9 +567,27 @@ Task("SRGen") var xlfDocNames = System.IO.Directory.GetFiles(inputXliff, "*.xlf", SearchOption.AllDirectories).ToList(); foreach(var docName in xlfDocNames) { + // load our language XLIFF var xlfDoc = new XliffParser.XlfDocument(docName); + var xlfFile = xlfDoc.Files.Single(); + + // load a language template + var templateFileLocation = System.IO.Path.Combine(locTemplateDir, System.IO.Path.GetFileName(docName) + ".template"); + var templateDoc = new XliffParser.XlfDocument(templateFileLocation); + var templateFile = templateDoc.Files.Single(); + + // iterate through our tranlation units and prune invalid units + foreach (var unit in xlfFile.TransUnits) + { + // if a unit does not have a target it is invalid + if (unit.Target != null) { + templateFile.AddTransUnit(unit.Id, unit.Source, unit.Target, 0, 0); + } + } + + // export modified template to RESX var newPath = System.IO.Path.Combine(localizationDir, System.IO.Path.GetFileName(docName)); - xlfDoc.SaveAsResX(newPath.Replace("xlf","resx")); + templateDoc.SaveAsResX(newPath.Replace("xlf","resx")); } } }); diff --git a/src/Microsoft.SqlTools.Credentials/Localization/transXliff/sr.es.xlf b/localization/sr.de.xlf.template similarity index 50% rename from src/Microsoft.SqlTools.Credentials/Localization/transXliff/sr.es.xlf rename to localization/sr.de.xlf.template index 3860e1bf..58f10592 100644 --- a/src/Microsoft.SqlTools.Credentials/Localization/transXliff/sr.es.xlf +++ b/localization/sr.de.xlf.template @@ -1,12 +1,7 @@  - + - - ES_LOCALIZATION - ES_LOCALIZATION - - \ No newline at end of file diff --git a/src/Microsoft.SqlTools.Hosting/Localization/transXliff/sr.es.xlf b/localization/sr.es.xlf.template similarity index 50% rename from src/Microsoft.SqlTools.Hosting/Localization/transXliff/sr.es.xlf rename to localization/sr.es.xlf.template index 3860e1bf..ffbca1be 100644 --- a/src/Microsoft.SqlTools.Hosting/Localization/transXliff/sr.es.xlf +++ b/localization/sr.es.xlf.template @@ -1,12 +1,7 @@  - + - - ES_LOCALIZATION - ES_LOCALIZATION - - \ No newline at end of file diff --git a/localization/sr.fr.xlf.template b/localization/sr.fr.xlf.template new file mode 100644 index 00000000..45dec613 --- /dev/null +++ b/localization/sr.fr.xlf.template @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/localization/sr.it.xlf.template b/localization/sr.it.xlf.template new file mode 100644 index 00000000..7a3c7098 --- /dev/null +++ b/localization/sr.it.xlf.template @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/localization/sr.ja.xlf.template b/localization/sr.ja.xlf.template new file mode 100644 index 00000000..3d2657f8 --- /dev/null +++ b/localization/sr.ja.xlf.template @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/localization/sr.ko.xlf.template b/localization/sr.ko.xlf.template new file mode 100644 index 00000000..8c900bd4 --- /dev/null +++ b/localization/sr.ko.xlf.template @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/localization/sr.pt_BR.xlf.template b/localization/sr.pt_BR.xlf.template new file mode 100644 index 00000000..7927ff89 --- /dev/null +++ b/localization/sr.pt_BR.xlf.template @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/localization/sr.ru.xlf.template b/localization/sr.ru.xlf.template new file mode 100644 index 00000000..6d0dca1b --- /dev/null +++ b/localization/sr.ru.xlf.template @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/localization/sr.xlf.template b/localization/sr.xlf.template new file mode 100644 index 00000000..d91c6928 --- /dev/null +++ b/localization/sr.xlf.template @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/localization/sr.zh-Hans.xlf.template b/localization/sr.zh-Hans.xlf.template new file mode 100644 index 00000000..bf7fd2a2 --- /dev/null +++ b/localization/sr.zh-Hans.xlf.template @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/localization/sr.zh-Hant.xlf.template b/localization/sr.zh-Hant.xlf.template new file mode 100644 index 00000000..1c3d373b --- /dev/null +++ b/localization/sr.zh-Hant.xlf.template @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/src/Microsoft.SqlTools.Credentials/Localization/sr.es.resx b/src/Microsoft.SqlTools.Credentials/Localization/sr.es.resx deleted file mode 100644 index 00b8aacd..00000000 --- a/src/Microsoft.SqlTools.Credentials/Localization/sr.es.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ES_LOCALIZATION - - \ No newline at end of file diff --git a/src/Microsoft.SqlTools.Hosting/Localization/sr.es.resx b/src/Microsoft.SqlTools.Hosting/Localization/sr.es.resx deleted file mode 100644 index 00b8aacd..00000000 --- a/src/Microsoft.SqlTools.Hosting/Localization/sr.es.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ES_LOCALIZATION - - \ No newline at end of file