diff --git a/MetadataTranslator/MTCmd/App.config b/MetadataTranslator/MTCmd/App.config new file mode 100644 index 0000000..56efbc7 --- /dev/null +++ b/MetadataTranslator/MTCmd/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/MetadataTranslator/MTCmd/MTCmd.csproj b/MetadataTranslator/MTCmd/MTCmd.csproj new file mode 100644 index 0000000..b032f39 --- /dev/null +++ b/MetadataTranslator/MTCmd/MTCmd.csproj @@ -0,0 +1,94 @@ + + + + + Debug + AnyCPU + {0B0EA3E1-79CC-4674-A763-9C40925DEE31} + Exe + MTCmd + MTCmd + v4.7.2 + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + icon.ico + + + + + ..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll + + + ..\packages\System.CommandLine.2.0.0-beta1.20574.7\lib\netstandard2.0\System.CommandLine.dll + + + + ..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll + + + + ..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll + + + ..\packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll + + + + + + + + + + + + + + True + True + Strings.resx + + + + + + + + + {cb7d493c-b67e-4438-b304-efe5d418addf} + Metadata Translator + + + + + ResXFileCodeGenerator + Strings.Designer.cs + + + + + + + \ No newline at end of file diff --git a/MetadataTranslator/MTCmd/Program.cs b/MetadataTranslator/MTCmd/Program.cs new file mode 100644 index 0000000..ecf69b2 --- /dev/null +++ b/MetadataTranslator/MTCmd/Program.cs @@ -0,0 +1,114 @@ +using System; +using System.CommandLine; +using System.CommandLine.Invocation; +using System.IO; +using System.Linq; +using Metadata_Translator; + +namespace MTCmd +{ + public enum Mode + { + Export, + Import, + Overwrite + } + + class Program + { + static int Main(string[] args) + { + /// + /// Create a root command with the required options. + /// + var rootCommand = new RootCommand(Strings.rootCmdDescription) + { + new Option( + new string[]{ "--connection-string", "-cs" }, Strings.csDescription){ IsRequired = true }, + new Option( + new string[]{ "--mode", "-m" }, + getDefaultValue: () => Mode.Export, + description: Strings.modeDescription), + new Option( + new string[]{ "--export-folder", "-ef" }, Strings.efDescription).ExistingOnly(), + new Option( + new string[]{ "--import-file", "-if" }, Strings.ifDescription).ExistingOnly() + }; + + + // Note that the parameters of the handler method are matched according to the names of the options + rootCommand.Handler = CommandHandler.Create((connectionString, mode, exportFolder, importFile) => + { + try + { + DataModel model = DataModel.Connect(connectionString); + model.InitializeLanguages(); + + switch (mode) + { + case Mode.Export: + Export(model, exportFolder); + break; + case Mode.Import: + Import(model, importFile, false); + break; + case Mode.Overwrite: + Import(model, importFile, true); + break; + default: + break; + } + } + catch(Exception ex) + { + Console.WriteLine($"{ex}"); + } + }); + + // Parse the incoming args and invoke the handler + return rootCommand.InvokeAsync(args).Result; + } + + static void Import(DataModel model, FileInfo importFile, bool overwriteMode) + { + if (importFile != null) + { + string lcid = Path.GetFileNameWithoutExtension(importFile.Name); + if (model.SetLanguageFlags(lcid, true)) + { + model.ImportFromCsv(importFile.FullName, lcid, overwriteMode); + model.Update(); + Console.WriteLine(Strings.importSuccess, importFile); + } + else + { + Console.WriteLine(Strings.invalidLocale); + } + } + else + { + Console.WriteLine(Strings.noImportFileSpecified); + } + } + + static void Export(DataModel model, DirectoryInfo exportFolder) + { + if (exportFolder != null) + { + if (model.HasTargetLanguages) + { + model.ExportToCsv(exportFolder.FullName); + Console.WriteLine(Strings.exportSuccess, exportFolder); + } + else + { + Console.WriteLine(Strings.noExportableTranslations); + } + } + else + { + Console.WriteLine(Strings.noExportFolderSpecified); + } + } + } +} diff --git a/MetadataTranslator/MTCmd/Properties/AssemblyInfo.cs b/MetadataTranslator/MTCmd/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..09eb94f --- /dev/null +++ b/MetadataTranslator/MTCmd/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("MTCmd")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("MTCmd")] +[assembly: AssemblyCopyright("Copyright © 2021")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("0b0ea3e1-79cc-4674-a763-9c40925dee31")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.2.0.0")] +[assembly: AssemblyFileVersion("1.2.0.0")] diff --git a/MetadataTranslator/MTCmd/Strings.Designer.cs b/MetadataTranslator/MTCmd/Strings.Designer.cs new file mode 100644 index 0000000..59c55a1 --- /dev/null +++ b/MetadataTranslator/MTCmd/Strings.Designer.cs @@ -0,0 +1,162 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace MTCmd { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Strings { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Strings() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MTCmd.Strings", typeof(Strings).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to The connection string to connect to the Azure Analysis Services (Azure AS) or SQL Server Analysis Services (SSAS) data model, or Power BI Premium dataset. + /// + internal static string csDescription { + get { + return ResourceManager.GetString("csDescription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The full path to the export folder.. + /// + internal static string efDescription { + get { + return ResourceManager.GetString("efDescription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Existing translations exported to: {0}. + /// + internal static string exportSuccess { + get { + return ResourceManager.GetString("exportSuccess", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The full path and name of the comma-separated values (csv) translation file to import.. + /// + internal static string ifDescription { + get { + return ResourceManager.GetString("ifDescription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Translation file {0} imported successfully.. + /// + internal static string importSuccess { + get { + return ResourceManager.GetString("importSuccess", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Either the imported language matches the default locale, or the file name does not correspond to a supported locale identifier. The file name convention is <lcid>.csv.. + /// + internal static string invalidLocale { + get { + return ResourceManager.GetString("invalidLocale", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The mode of the command-line operation. + /// + internal static string modeDescription { + get { + return ResourceManager.GetString("modeDescription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to This dataset has no translations.. + /// + internal static string noExportableTranslations { + get { + return ResourceManager.GetString("noExportableTranslations", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Use the --export-folder option to specify an export folder for this operation.. + /// + internal static string noExportFolderSpecified { + get { + return ResourceManager.GetString("noExportFolderSpecified", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Use the --import-file option to specify an import file for this operation.. + /// + internal static string noImportFileSpecified { + get { + return ResourceManager.GetString("noImportFileSpecified", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Machine Translator command-line app. + /// + internal static string rootCmdDescription { + get { + return ResourceManager.GetString("rootCmdDescription", resourceCulture); + } + } + } +} diff --git a/MetadataTranslator/MTCmd/Strings.resx b/MetadataTranslator/MTCmd/Strings.resx new file mode 100644 index 0000000..1ce367e --- /dev/null +++ b/MetadataTranslator/MTCmd/Strings.resx @@ -0,0 +1,153 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + The connection string to connect to the Azure Analysis Services (Azure AS) or SQL Server Analysis Services (SSAS) data model, or Power BI Premium dataset + + + The full path to the export folder. + + + Existing translations exported to: {0} + + + The full path and name of the comma-separated values (csv) translation file to import. + + + Translation file {0} imported successfully. + + + Either the imported language matches the default locale, or the file name does not correspond to a supported locale identifier. The file name convention is <lcid>.csv. + + + The mode of the command-line operation + + + This dataset has no translations. + + + Use the --export-folder option to specify an export folder for this operation. + + + Use the --import-file option to specify an import file for this operation. + + + Machine Translator command-line app + + \ No newline at end of file diff --git a/MetadataTranslator/MTCmd/icon.ico b/MetadataTranslator/MTCmd/icon.ico new file mode 100644 index 0000000..e4317ce Binary files /dev/null and b/MetadataTranslator/MTCmd/icon.ico differ diff --git a/MetadataTranslator/MTCmd/packages.config b/MetadataTranslator/MTCmd/packages.config new file mode 100644 index 0000000..c558207 --- /dev/null +++ b/MetadataTranslator/MTCmd/packages.config @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/MetadataTranslator/Metadata Translator Setup/Metadata Translator Setup.vdproj b/MetadataTranslator/Metadata Translator Setup/Metadata Translator Setup.vdproj index a38cce5..e196446 100644 --- a/MetadataTranslator/Metadata Translator Setup/Metadata Translator Setup.vdproj +++ b/MetadataTranslator/Metadata Translator Setup/Metadata Translator Setup.vdproj @@ -22,6 +22,12 @@ "Entry" { "MsmKey" = "8:_0635D5A6F23DB1379A0FD91FF1B01507" + "OwnerKey" = "8:_2CE91AB829584CF99B8C35A6E138B5FF" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_0635D5A6F23DB1379A0FD91FF1B01507" "OwnerKey" = "8:_5EE4AF833E364CBAB977AFCB8CD5E99D" "MsmSig" = "8:_UNDEFINED" } @@ -33,6 +39,30 @@ } "Entry" { + "MsmKey" = "8:_19CCDCF64DCD42A423A21A106271862F" + "OwnerKey" = "8:_4A5BE4840FB638200664527C5EDB50B1" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_19CCDCF64DCD42A423A21A106271862F" + "OwnerKey" = "8:_2CE91AB829584CF99B8C35A6E138B5FF" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_1EF590E9755E072BDC7697262C8261FD" + "OwnerKey" = "8:_2CE91AB829584CF99B8C35A6E138B5FF" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_2CE91AB829584CF99B8C35A6E138B5FF" + "OwnerKey" = "8:_UNDEFINED" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { "MsmKey" = "8:_2F1DB028FE734DBD9E77D9DCA191FAD1" "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" @@ -45,18 +75,66 @@ } "Entry" { + "MsmKey" = "8:_441D4DFF8EBA539070D14AA52B77A767" + "OwnerKey" = "8:_1EF590E9755E072BDC7697262C8261FD" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_441D4DFF8EBA539070D14AA52B77A767" + "OwnerKey" = "8:_2CE91AB829584CF99B8C35A6E138B5FF" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_4A5BE4840FB638200664527C5EDB50B1" + "OwnerKey" = "8:_2CE91AB829584CF99B8C35A6E138B5FF" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { "MsmKey" = "8:_4DD4143C26C54926A2B59FBC551F160A" "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" } "Entry" { + "MsmKey" = "8:_569CA11E5F0BB01E824CD0E8609DC800" + "OwnerKey" = "8:_19CCDCF64DCD42A423A21A106271862F" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_569CA11E5F0BB01E824CD0E8609DC800" + "OwnerKey" = "8:_2CE91AB829584CF99B8C35A6E138B5FF" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_579B668A1BF613B39A613E3676204554" + "OwnerKey" = "8:_2CE91AB829584CF99B8C35A6E138B5FF" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_579B668A1BF613B39A613E3676204554" + "OwnerKey" = "8:_19CCDCF64DCD42A423A21A106271862F" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { "MsmKey" = "8:_5EE4AF833E364CBAB977AFCB8CD5E99D" "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" } "Entry" { + "MsmKey" = "8:_64EA80D7EB179AD7DF6F334604D63D4C" + "OwnerKey" = "8:_B92FE44943D4DEC27E1C3FA927231844" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { "MsmKey" = "8:_7C7487CE661C4E1E5239FB4306E0749B" "OwnerKey" = "8:_C48ECEE77D85A17550522737B8522D2B" "MsmSig" = "8:_UNDEFINED" @@ -64,6 +142,18 @@ "Entry" { "MsmKey" = "8:_7C7487CE661C4E1E5239FB4306E0749B" + "OwnerKey" = "8:_2CE91AB829584CF99B8C35A6E138B5FF" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_7C7487CE661C4E1E5239FB4306E0749B" + "OwnerKey" = "8:_1EF590E9755E072BDC7697262C8261FD" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_7C7487CE661C4E1E5239FB4306E0749B" "OwnerKey" = "8:_5EE4AF833E364CBAB977AFCB8CD5E99D" "MsmSig" = "8:_UNDEFINED" } @@ -76,6 +166,18 @@ "Entry" { "MsmKey" = "8:_905A4AA564BAC6CC36A45AEE36EFE2FD" + "OwnerKey" = "8:_2CE91AB829584CF99B8C35A6E138B5FF" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_905A4AA564BAC6CC36A45AEE36EFE2FD" + "OwnerKey" = "8:_1EF590E9755E072BDC7697262C8261FD" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_905A4AA564BAC6CC36A45AEE36EFE2FD" "OwnerKey" = "8:_7C7487CE661C4E1E5239FB4306E0749B" "MsmSig" = "8:_UNDEFINED" } @@ -87,6 +189,12 @@ } "Entry" { + "MsmKey" = "8:_9069E279B1FD50CD11B425DE3C9211AC" + "OwnerKey" = "8:_B92FE44943D4DEC27E1C3FA927231844" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { "MsmKey" = "8:_A00C4C4DA66740A385AE811FF37BAA77" "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" @@ -100,6 +208,12 @@ "Entry" { "MsmKey" = "8:_A1F0AFE5FCA14283B33A21CAC42178E4" + "OwnerKey" = "8:_2CE91AB829584CF99B8C35A6E138B5FF" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_A1F0AFE5FCA14283B33A21CAC42178E4" "OwnerKey" = "8:_5EE4AF833E364CBAB977AFCB8CD5E99D" "MsmSig" = "8:_UNDEFINED" } @@ -111,6 +225,18 @@ } "Entry" { + "MsmKey" = "8:_B92FE44943D4DEC27E1C3FA927231844" + "OwnerKey" = "8:_2CE91AB829584CF99B8C35A6E138B5FF" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_B92FE44943D4DEC27E1C3FA927231844" + "OwnerKey" = "8:_4A5BE4840FB638200664527C5EDB50B1" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { "MsmKey" = "8:_C0C5DE7473DD8B2395E58F2E339A1AF1" "OwnerKey" = "8:_5EE4AF833E364CBAB977AFCB8CD5E99D" "MsmSig" = "8:_UNDEFINED" @@ -123,8 +249,32 @@ } "Entry" { - "MsmKey" = "8:_UNDEFINED" - "OwnerKey" = "8:_441D4DFF8EBA539070D14AA52B77A767" + "MsmKey" = "8:_C4ACAD76FA650ADD691588B6D2AA3BB2" + "OwnerKey" = "8:_B92FE44943D4DEC27E1C3FA927231844" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_C67DA394422F5927664B4F5D40B66A64" + "OwnerKey" = "8:_19CCDCF64DCD42A423A21A106271862F" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_C67DA394422F5927664B4F5D40B66A64" + "OwnerKey" = "8:_2CE91AB829584CF99B8C35A6E138B5FF" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_DE34EA7F69E9468ED2359C26A753AE38" + "OwnerKey" = "8:_C4ACAD76FA650ADD691588B6D2AA3BB2" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_DE34EA7F69E9468ED2359C26A753AE38" + "OwnerKey" = "8:_B92FE44943D4DEC27E1C3FA927231844" "MsmSig" = "8:_UNDEFINED" } "Entry" @@ -136,6 +286,78 @@ "Entry" { "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_2CE91AB829584CF99B8C35A6E138B5FF" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_4A5BE4840FB638200664527C5EDB50B1" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_19CCDCF64DCD42A423A21A106271862F" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_569CA11E5F0BB01E824CD0E8609DC800" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_C67DA394422F5927664B4F5D40B66A64" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_579B668A1BF613B39A613E3676204554" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_1EF590E9755E072BDC7697262C8261FD" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_B92FE44943D4DEC27E1C3FA927231844" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_64EA80D7EB179AD7DF6F334604D63D4C" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_C4ACAD76FA650ADD691588B6D2AA3BB2" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_DE34EA7F69E9468ED2359C26A753AE38" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_9069E279B1FD50CD11B425DE3C9211AC" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" "OwnerKey" = "8:_C48ECEE77D85A17550522737B8522D2B" "MsmSig" = "8:_UNDEFINED" } @@ -169,6 +391,12 @@ "OwnerKey" = "8:_A1F0AFE5FCA14283B33A21CAC42178E4" "MsmSig" = "8:_UNDEFINED" } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_441D4DFF8EBA539070D14AA52B77A767" + "MsmSig" = "8:_UNDEFINED" + } } "Configurations" { @@ -187,6 +415,22 @@ "PrivateKeyFile" = "8:" "TimeStampServer" = "8:" "InstallerBootstrapper" = "3:2" + "BootstrapperCfg:{63ACBE69-63AA-4F98-B2B6-99F9E24495F2}" + { + "Enabled" = "11:TRUE" + "PromptEnabled" = "11:TRUE" + "PrerequisitesLocation" = "2:1" + "Url" = "8:" + "ComponentsUrl" = "8:" + "Items" + { + "{EDC2488A-8267-493A-A98E-7D9C3B36CDF3}:.NETFramework,Version=v4.7.2" + { + "Name" = "8:Microsoft .NET Framework 4.7.2 (x86 and x64)" + "ProductCode" = "8:.NETFramework,Version=v4.7.2" + } + } + } } "Release" { @@ -203,6 +447,14 @@ "PrivateKeyFile" = "8:" "TimeStampServer" = "8:" "InstallerBootstrapper" = "3:2" + "BootstrapperCfg:{63ACBE69-63AA-4F98-B2B6-99F9E24495F2}" + { + "Enabled" = "11:TRUE" + "PromptEnabled" = "11:TRUE" + "PrerequisitesLocation" = "2:1" + "Url" = "8:" + "ComponentsUrl" = "8:" + } } } "Deployable" @@ -291,6 +543,68 @@ "IsDependency" = "11:TRUE" "IsolateTo" = "8:" } + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_19CCDCF64DCD42A423A21A106271862F" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:FALSE" + "AssemblyAsmDisplayName" = "8:System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL" + "ScatterAssemblies" + { + "_19CCDCF64DCD42A423A21A106271862F" + { + "Name" = "8:System.Memory.dll" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:System.Memory.dll" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_E31DB11D2BA64930BBAB95E69D1A099C" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_1EF590E9755E072BDC7697262C8261FD" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:FALSE" + "AssemblyAsmDisplayName" = "8:Metadata Translator, Version=1.2.0.0, Culture=neutral, PublicKeyToken=0e7f9fd02ef157fe, processorArchitecture=MSIL" + "ScatterAssemblies" + { + "_1EF590E9755E072BDC7697262C8261FD" + { + "Name" = "8:Metadata Translator.exe" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:Metadata Translator.exe" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_E31DB11D2BA64930BBAB95E69D1A099C" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_2F1DB028FE734DBD9E77D9DCA191FAD1" { "SourcePath" = "8:..\\Metadata Translator\\metadata-translator.pbitool.json" @@ -342,6 +656,37 @@ "IsDependency" = "11:TRUE" "IsolateTo" = "8:" } + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_4A5BE4840FB638200664527C5EDB50B1" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:FALSE" + "AssemblyAsmDisplayName" = "8:System.CommandLine, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" + "ScatterAssemblies" + { + "_4A5BE4840FB638200664527C5EDB50B1" + { + "Name" = "8:System.CommandLine.dll" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:System.CommandLine.dll" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_E31DB11D2BA64930BBAB95E69D1A099C" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_4DD4143C26C54926A2B59FBC551F160A" { "SourcePath" = "8:..\\Metadata Translator\\Resources\\supportedlanguages.json" @@ -362,6 +707,99 @@ "IsDependency" = "11:FALSE" "IsolateTo" = "8:" } + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_569CA11E5F0BB01E824CD0E8609DC800" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:FALSE" + "AssemblyAsmDisplayName" = "8:System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" + "ScatterAssemblies" + { + "_569CA11E5F0BB01E824CD0E8609DC800" + { + "Name" = "8:System.Runtime.CompilerServices.Unsafe.dll" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:System.Runtime.CompilerServices.Unsafe.dll" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_E31DB11D2BA64930BBAB95E69D1A099C" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_579B668A1BF613B39A613E3676204554" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:FALSE" + "AssemblyAsmDisplayName" = "8:System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL" + "ScatterAssemblies" + { + "_579B668A1BF613B39A613E3676204554" + { + "Name" = "8:System.Buffers.dll" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:System.Buffers.dll" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_E31DB11D2BA64930BBAB95E69D1A099C" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_64EA80D7EB179AD7DF6F334604D63D4C" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:TRUE" + "AssemblyAsmDisplayName" = "8:System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" + "ScatterAssemblies" + { + "_64EA80D7EB179AD7DF6F334604D63D4C" + { + "Name" = "8:System.Net.Http.dll" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:System.Net.Http.dll" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_E31DB11D2BA64930BBAB95E69D1A099C" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_7C7487CE661C4E1E5239FB4306E0749B" { "AssemblyRegister" = "3:1" @@ -424,6 +862,37 @@ "IsDependency" = "11:TRUE" "IsolateTo" = "8:" } + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_9069E279B1FD50CD11B425DE3C9211AC" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:TRUE" + "AssemblyAsmDisplayName" = "8:System.Diagnostics.Tracing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" + "ScatterAssemblies" + { + "_9069E279B1FD50CD11B425DE3C9211AC" + { + "Name" = "8:System.Diagnostics.Tracing.dll" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:System.Diagnostics.Tracing.dll" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_E31DB11D2BA64930BBAB95E69D1A099C" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_A00C4C4DA66740A385AE811FF37BAA77" { "SourcePath" = "8:..\\Metadata Translator\\icon.ico" @@ -475,6 +944,37 @@ "IsDependency" = "11:TRUE" "IsolateTo" = "8:" } + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_B92FE44943D4DEC27E1C3FA927231844" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:FALSE" + "AssemblyAsmDisplayName" = "8:netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" + "ScatterAssemblies" + { + "_B92FE44943D4DEC27E1C3FA927231844" + { + "Name" = "8:netstandard.dll" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:netstandard.dll" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_E31DB11D2BA64930BBAB95E69D1A099C" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_C0C5DE7473DD8B2395E58F2E339A1AF1" { "AssemblyRegister" = "3:1" @@ -537,6 +1037,99 @@ "IsDependency" = "11:TRUE" "IsolateTo" = "8:" } + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_C4ACAD76FA650ADD691588B6D2AA3BB2" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:TRUE" + "AssemblyAsmDisplayName" = "8:System.IO.Compression.FileSystem, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL" + "ScatterAssemblies" + { + "_C4ACAD76FA650ADD691588B6D2AA3BB2" + { + "Name" = "8:System.IO.Compression.FileSystem.dll" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:System.IO.Compression.FileSystem.dll" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_E31DB11D2BA64930BBAB95E69D1A099C" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_C67DA394422F5927664B4F5D40B66A64" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:FALSE" + "AssemblyAsmDisplayName" = "8:System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" + "ScatterAssemblies" + { + "_C67DA394422F5927664B4F5D40B66A64" + { + "Name" = "8:System.Numerics.Vectors.dll" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:System.Numerics.Vectors.dll" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_E31DB11D2BA64930BBAB95E69D1A099C" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_DE34EA7F69E9468ED2359C26A753AE38" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:TRUE" + "AssemblyAsmDisplayName" = "8:System.IO.Compression, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL" + "ScatterAssemblies" + { + "_DE34EA7F69E9468ED2359C26A753AE38" + { + "Name" = "8:System.IO.Compression.dll" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:System.IO.Compression.dll" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_E31DB11D2BA64930BBAB95E69D1A099C" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } } "FileType" { @@ -604,15 +1197,15 @@ { "Name" = "8:Microsoft Visual Studio" "ProductName" = "8:Metadata Translator" - "ProductCode" = "8:{01D7B887-BCC7-4729-9C57-BAE151B6CCC5}" - "PackageCode" = "8:{9915492B-B895-4603-BD96-A379AFDD7089}" + "ProductCode" = "8:{B6113405-F39B-4074-ACFE-79AB32CC2CFA}" + "PackageCode" = "8:{FB893543-9B0F-4DD8-8470-D4FEF396FAE2}" "UpgradeCode" = "8:{67E5697C-787F-4F4D-A7B8-C0C2CB4392DD}" "AspNetVersion" = "8:4.0.30319.0" "RestartWWWService" = "11:FALSE" "RemovePreviousVersions" = "11:FALSE" "DetectNewerInstalledVersion" = "11:TRUE" "InstallAllUsers" = "11:TRUE" - "ProductVersion" = "8:1.0.0" + "ProductVersion" = "8:1.2.0" "Manufacturer" = "8:Analysis Services Samples" "ARPHELPTELEPHONE" = "8:" "ARPHELPLINK" = "8:" @@ -1124,9 +1717,37 @@ } "ProjectOutput" { + "{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_2CE91AB829584CF99B8C35A6E138B5FF" + { + "SourcePath" = "8:..\\MTCmd\\obj\\Debug\\MTCmd.exe" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_E31DB11D2BA64930BBAB95E69D1A099C" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:FALSE" + "IsolateTo" = "8:" + "ProjectOutputGroupRegister" = "3:1" + "OutputConfiguration" = "8:" + "OutputGroupCanonicalName" = "8:Built" + "OutputProjectGuid" = "8:{0B0EA3E1-79CC-4674-A763-9C40925DEE31}" + "ShowKeyOutput" = "11:TRUE" + "ExcludeFilters" + { + } + } "{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_5EE4AF833E364CBAB977AFCB8CD5E99D" { - "SourcePath" = "8:..\\Metadata Translator\\obj\\Release\\Metadata Translator.exe" + "SourcePath" = "8:..\\Metadata Translator\\obj\\Debug\\Metadata Translator.exe" "TargetName" = "8:" "Tag" = "8:" "Folder" = "8:_E31DB11D2BA64930BBAB95E69D1A099C" diff --git a/MetadataTranslator/Metadata Translator.sln b/MetadataTranslator/Metadata Translator.sln index 7d467cf..cbd52ea 100644 --- a/MetadataTranslator/Metadata Translator.sln +++ b/MetadataTranslator/Metadata Translator.sln @@ -12,6 +12,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution README.md = README.md EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MTCmd", "MTCmd\MTCmd.csproj", "{0B0EA3E1-79CC-4674-A763-9C40925DEE31}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -24,6 +26,10 @@ Global {CB7D493C-B67E-4438-B304-EFE5D418ADDF}.Release|Any CPU.Build.0 = Release|Any CPU {FC353DA7-B669-4EDF-B465-CB9827C7F035}.Debug|Any CPU.ActiveCfg = Debug {FC353DA7-B669-4EDF-B465-CB9827C7F035}.Release|Any CPU.ActiveCfg = Release + {0B0EA3E1-79CC-4674-A763-9C40925DEE31}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0B0EA3E1-79CC-4674-A763-9C40925DEE31}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0B0EA3E1-79CC-4674-A763-9C40925DEE31}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0B0EA3E1-79CC-4674-A763-9C40925DEE31}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/MetadataTranslator/Metadata Translator/Data/DataModel.cs b/MetadataTranslator/Metadata Translator/Data/DataModel.cs index 48df831..c4ce4cd 100644 --- a/MetadataTranslator/Metadata Translator/Data/DataModel.cs +++ b/MetadataTranslator/Metadata Translator/Data/DataModel.cs @@ -200,6 +200,62 @@ namespace Metadata_Translator } } + /// + /// Marks the languages in the list of supported lanuages as selected and model default. + /// + public void InitializeLanguages() + { + if (this.CultureNames?.Count > 0) + { + /// First the model culture. + /// + SetLanguageFlags(this.CultureNames[0], true, true); + + /// Then all others + /// + for (int i = 1; i < this.CultureNames.Count; i++) + { + SetLanguageFlags(this.CultureNames[i], true, false); + } + } + } + + /// + /// Marks a language specified by lcid as selected and as model default. + /// + /// + /// + /// + public bool SetLanguageFlags(string lcid, bool isSelected, bool isModelDefault = false) + { + if (lcid.Equals(DefaultCulture, StringComparison.InvariantCultureIgnoreCase) && isModelDefault == false) + { + return false; + } + + Language language = this.SupportedLanguages.Where(x => x.LanguageTag.Equals(lcid)).FirstOrDefault(); + if (language != null) + { + language.IsSelected = isSelected; + language.IsModelDefault = isModelDefault; + return true; + } + else + { + return false; + } + } + + /// + /// Gets the Language object based on the lcid (i.e. LanguageTag). + /// + /// + /// + public Language GetLanguageByLcid(string lcid) + { + return this.SupportedLanguages.Where(x => x.LanguageTag.Equals(lcid)).FirstOrDefault(); + } + /// /// Creates a new ExpandoObject for a source string (displayString). /// diff --git a/MetadataTranslator/Metadata Translator/Documentation/Images/MT command-line app.png b/MetadataTranslator/Metadata Translator/Documentation/Images/MT command-line app.png new file mode 100644 index 0000000..6160b19 Binary files /dev/null and b/MetadataTranslator/Metadata Translator/Documentation/Images/MT command-line app.png differ diff --git a/MetadataTranslator/Metadata Translator/Documentation/README.md b/MetadataTranslator/Metadata Translator/Documentation/README.md index f34b4c3..82ef4e0 100644 --- a/MetadataTranslator/Metadata Translator/Documentation/README.md +++ b/MetadataTranslator/Metadata Translator/Documentation/README.md @@ -80,9 +80,7 @@ If you import a .csv file for a culture that you haven’t added to the dataset > > During the import operation, Metadata Translators first expects a full match of the default strings including their ordering. If the ordering is different, Metadata Translators switches to case-sensitive string matching. Any strings that don’t have an exact match are ignored and the corresponding cells remain empty in the translation grid. - - -## Applying translations to a dataset +## Applying translations to a dataset Metadata Translator detects the default language and all translations in the dataset and reads corresponding the captions, descriptions, and display folder names on startup. As you work with the translation grid, add or remove cultures, perform machine translations, or import translated strings, the changes only affect the data in Metadata Translator. To apply the changes to the dataset, click on the Apply button in the toolbar, and then save the .pbix file in Power BI Desktop to persist the changes. @@ -98,10 +96,40 @@ Metadata Translator can also connect to data models hosted in SQL Server Analysi > You must provide the full connection string. This is especially important to keep in mind when connecting to a dataset in the Power BI service. The connection string that Power BI displays on the dataset settings page does not include the Data Source property name. It is an incomplete connection string, such as *powerbi://api.powerbi.com/v1.0/myorg/AdventureWorksSource;initial catalog=AdventureWorks*. Make sure to add "Data Source=" in front of it. The screenshot above shows the full connection string: *data source=powerbi://api.powerbi.com/v1.0/myorg/AdventureWorksSource;initial catalog=AdventureWorks*. -# Additional features +## Command-line operations -Metadata Translator v1.1 does not support editing the default language strings because the external tools integration feature of Power BI Desktop does not support these operations yet. +Metadata Translator supports command-line operations through a thin console application called MTCmd.exe so that you can import and export translations in an automated way. You can find MTCmd.exe in the Metadata Translator installation folder. Run MTCmd /? to display available command-line options and operations, as in the following screenshot. -It is planned to add support for command-line import and export operations so that translations can be automated. +![Metadata Translator command-line app](https://github.com/microsoft/Analysis-Services/blob/master/MetadataTranslator/Metadata%20Translator/Documentation/Images/MT%20command-line%20app.png) + +### Connecting to a dataset + +In order to connect to a dataset hosted in SQL Server Analysis Services, Azure Analysis Services, or the Power BI service, you must specify the full connection string by using the --connection-string parameter (or -cs). See also the previous "*Connecting to an online dataset*" section. The --connection-string parameter is mandatory for all export and import operations. + +### Exporting translations + +To export existing translations from a dataset, you must specify full path to an export folder by using the --export-folder (-ef) parameter. For example, the following command exports all translations from an AdventureWorks dataset hosted in Power BI into a folder called ExportedTranslations: + +`MTCmd -cs "powerbi://api.powerbi.com/v1.0/myorg/AdventureWorksSource;initial catalog=AdventureWorks" -ef C:\ExportedTranslations` + +> Note +> +> The specified export folder must exist prior to running the command-line app. MTCmd.exe does not create the export folder. However, if any files exist in the export folder, MTCmd.exe might overwrite them without warning. MTCmd.exe exports each culture into a separate .csv file based on the locale identifier (LCID). + +### Importing translations + +To import translations from a .csv file, you must specify full path to the import file by using the --import-file (-if) parameter. The file name must correspond to the locale identifier (LCID) of the target language. You must also specify the --mode (-m) parameter. Valid options are Import or Overwrite. Import applies translations for strings that have not been translated yet in the dataset. Overwrite, as the name implies, overwrites any existing translations in the dataset. Both, Import and Overwrite create new translations if you import a locale that does not yet exist in the dataset. + +The following command imports German translations from a .csv file called de-DE.csv into an AdventureWorks dataset hosted in Power BI, overwriting any existing German strings in the dataset: + +`MTCmd -cs "powerbi://api.powerbi.com/v1.0/myorg/AdventureWorksSource;initial catalog=AdventureWorks" -if C:\Translations\de-DE.csv -m Overwrite` + +> Note +> +> MTCmd.exe only imports one translation file at a time. To import multiple languages, run MTCmd.exe in a loop. + +## Additional features + +Metadata Translator v1.2 does not support editing the default language strings because the external tools integration feature of Power BI Desktop does not support these operations yet. For additional feature requests, create a new item under [Issues](https://github.com/microsoft/Analysis-Services/issues). diff --git a/MetadataTranslator/Metadata Translator/Properties/AssemblyInfo.cs b/MetadataTranslator/Metadata Translator/Properties/AssemblyInfo.cs index 982401d..a261f9d 100644 --- a/MetadataTranslator/Metadata Translator/Properties/AssemblyInfo.cs +++ b/MetadataTranslator/Metadata Translator/Properties/AssemblyInfo.cs @@ -51,5 +51,5 @@ using System.Windows; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.1.0.0")] -[assembly: AssemblyFileVersion("1.1.0.0")] +[assembly: AssemblyVersion("1.2.0.0")] +[assembly: AssemblyFileVersion("1.2.0.0")] diff --git a/MetadataTranslator/Metadata Translator/UI/MainWindow.xaml.cs b/MetadataTranslator/Metadata Translator/UI/MainWindow.xaml.cs index 716acd3..3bbcaa1 100644 --- a/MetadataTranslator/Metadata Translator/UI/MainWindow.xaml.cs +++ b/MetadataTranslator/Metadata Translator/UI/MainWindow.xaml.cs @@ -58,7 +58,7 @@ namespace Metadata_Translator public void AddColumn(string lcid) { - Language language = GetLanguageByLcid(lcid); + Language language = DataModel.GetLanguageByLcid(lcid); if (language != null) { dataGrid.Columns.Add(new DataGridTextColumn @@ -201,7 +201,7 @@ namespace Metadata_Translator objectHeaderStyle.Setters.Add(new Setter(ToolTipService.ToolTipProperty, FindResource("DefaultCultureColumnHeaderToolTip").ToString())); - Language defaultLang = GetLanguageByLcid(cultures[0]); + Language defaultLang = DataModel.GetLanguageByLcid(cultures[0]); dataGrid.Columns.Add(new DataGridTextColumn { Header = $"{defaultLang.DisplayName}*", @@ -210,7 +210,7 @@ namespace Metadata_Translator IsReadOnly = true, CellStyle = defaultLangColumnStyle }); - SetLanguageFlags(cultures[0], true, true); + DataModel.SetLanguageFlags(cultures[0], true, true); /// Add the remaining languages that already exist in the data model @@ -225,32 +225,6 @@ namespace Metadata_Translator dataGrid.ItemsSource = DataModel.Captions; } - /// - /// Marks a language specified by lcid as selected and as model default. - /// - /// - /// - /// - private void SetLanguageFlags(string lcid, bool isSelected, bool isModelDefault = false) - { - Language language = Languages.Where(x => x.LanguageTag.Equals(lcid)).FirstOrDefault(); - if (language != null) - { - language.IsSelected = isSelected; - language.IsModelDefault = isModelDefault; - } - } - - /// - /// Gets the Language object based on the lcid (i.e. LanguageTag). - /// - /// - /// - private Language GetLanguageByLcid(string lcid) - { - return Languages.Where(x => x.LanguageTag.Equals(lcid)).FirstOrDefault(); - } - /// /// Get a handle to the main window object so that other user controls can /// access the public properties of the main window object directly.