示例#1
0
        private static void ConvertXlfToXaml(string xlfDirectory, string xamlFilePath)
        {
            var xamlFile = new XamlFile(xamlFilePath);

            foreach (var xlfFile in EnumerateAllFiles(xlfDirectory, $"{Path.GetFileName(xamlFilePath)}.*.xlf"))
            {
                var language               = Path.GetExtension(Path.GetFileNameWithoutExtension(xlfFile)).TrimStart('.');
                var translatedDirectory    = Path.Combine(Path.GetDirectoryName(xlfDirectory), language);
                var translatedXamlFilePath = Path.Combine(translatedDirectory, Path.GetFileName(xamlFilePath));

                Directory.CreateDirectory(translatedDirectory);
                xamlFile.SaveAsTranslated(translatedXamlFilePath, XlfFile.GetTranslations(xlfFile));
            }
        }
示例#2
0
        private static void ConvertXlfToVsct(string xlfDirectory, string vsctFilePath)
        {
            var vsctFile = new VsctFile(vsctFilePath);

            foreach (var xlfFile in EnumerateAllFiles(xlfDirectory, $"{Path.GetFileName(vsctFilePath)}.*.xlf"))
            {
                var language = Path.GetExtension(Path.GetFileNameWithoutExtension(xlfFile)).TrimStart('.');

                var translatedVsctFilePath =
                    Path.ChangeExtension(
                        Path.Combine(
                            Path.GetDirectoryName(xlfDirectory),
                            Path.GetFileNameWithoutExtension(Path.GetFileNameWithoutExtension(xlfFile))),
                        $"{language}.vsct");

                vsctFile.SaveAsTranslated(translatedVsctFilePath, XlfFile.GetTranslations(xlfFile));
            }
        }