From 6e49d10bbc841a6d42fd12954c4e89fdb4754aeb Mon Sep 17 00:00:00 2001 From: Livar <licavalc@microsoft.com> Date: Tue, 18 Jul 2017 15:48:52 -0700 Subject: [PATCH 1/8] Update NuGet to 4.3.0-rtm-4294 --- build/Microsoft.DotNet.Cli.DependencyVersions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/Microsoft.DotNet.Cli.DependencyVersions.props b/build/Microsoft.DotNet.Cli.DependencyVersions.props index 0197010ef..1bd7963f4 100644 --- a/build/Microsoft.DotNet.Cli.DependencyVersions.props +++ b/build/Microsoft.DotNet.Cli.DependencyVersions.props @@ -6,7 +6,7 @@ <CLI_Roslyn_Version>2.3.0-beta4-61830-03</CLI_Roslyn_Version> <CLI_FSharp_Version>4.2.0-rc-170630-0</CLI_FSharp_Version> <CLI_NETSDK_Version>1.1.0-alpha-20170713-1</CLI_NETSDK_Version> - <CLI_NuGet_Version>4.3.0-preview4-4273</CLI_NuGet_Version> + <CLI_NuGet_Version>4.3.0-rtm-4294</CLI_NuGet_Version> <CLI_WEBSDK_Version>1.0.0-alpha-20170516-2-509</CLI_WEBSDK_Version> <CLI_TestPlatform_Version>15.0.0</CLI_TestPlatform_Version> <TemplateEngineVersion>1.0.0-beta2-20170629-269</TemplateEngineVersion> From 60e26371436a595f71e574d4814027cef7f7590e Mon Sep 17 00:00:00 2001 From: Nick Guerrera <nicholg@microsoft.com> Date: Wed, 28 Jun 2017 18:09:12 -0700 Subject: [PATCH 2/8] Allow CLI UI language to be overridden by an environment variable --- src/dotnet/Program.cs | 3 ++ src/dotnet/UILanguageOverride.cs | 76 ++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+) create mode 100644 src/dotnet/UILanguageOverride.cs diff --git a/src/dotnet/Program.cs b/src/dotnet/Program.cs index 51704ece6..08a711f93 100644 --- a/src/dotnet/Program.cs +++ b/src/dotnet/Program.cs @@ -198,6 +198,9 @@ namespace Microsoft.DotNet.Cli // by default, .NET Core doesn't have all code pages needed for Console apps. // see the .NET Core Notes in https://msdn.microsoft.com/en-us/library/system.diagnostics.process(v=vs.110).aspx Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); + + // Honor UI language customization + UILanguageOverride.Setup(); } internal static bool TryGetBuiltInCommand(string commandName, out BuiltInCommandMetadata builtInCommand) diff --git a/src/dotnet/UILanguageOverride.cs b/src/dotnet/UILanguageOverride.cs new file mode 100644 index 000000000..00282389b --- /dev/null +++ b/src/dotnet/UILanguageOverride.cs @@ -0,0 +1,76 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Globalization; + +namespace Microsoft.DotNet.Cli +{ + internal static class UILanguageOverride + { + private const string DOTNET_CLI_UI_LANGUAGE = nameof(DOTNET_CLI_UI_LANGUAGE); + private const string VSLANG = nameof(VSLANG); + private const string PreferredUILang = nameof(PreferredUILang); + + public static void Setup() + { + CultureInfo language = GetOverriddenUILanguage(); + if (language == null) + { + return; + } + + // Make the current process respect the override. + CultureInfo.DefaultThreadCurrentUICulture = language; + + // Pass down the override to other processes that we start via appropriate environment variables + // Do not override any environment variables that are already set as we do not want to clobber a more granular setting with our global setting. + SetIfNotAlreadySet(DOTNET_CLI_UI_LANGUAGE, language.Name); + SetIfNotAlreadySet(VSLANG, language.LCID); // for tools following VS guidelines to just work in CLI + SetIfNotAlreadySet(PreferredUILang, language.Name); // for C#/VB targets that pass $(PreferredUILang) to compiler + } + + private static CultureInfo GetOverriddenUILanguage() + { + // DOTNET_CLI_UI_LANGUAGE=<culture name> is the main way for users to customize the CLI's UI language. + string dotnetCliLanguage = Environment.GetEnvironmentVariable(DOTNET_CLI_UI_LANGUAGE); + if (dotnetCliLanguage != null) + { + try + { + return new CultureInfo(dotnetCliLanguage); + } + catch (CultureNotFoundException) { } + } + + // VSLANG=<lcid> is set by VS and we respect that as well so that we will respect the VS + // language preference if we're invoked by VS. + string vsLang = Environment.GetEnvironmentVariable(VSLANG); + if (vsLang != null && int.TryParse(VSLANG, out int vsLcid)) + { + try + { + return new CultureInfo(vsLcid); + } + catch (ArgumentOutOfRangeException) { } + catch (CultureNotFoundException) { } + } + + return null; + } + + private static void SetIfNotAlreadySet(string environmentVariableName, string value) + { + string currentValue = Environment.GetEnvironmentVariable(environmentVariableName); + if (currentValue == null) + { + Environment.SetEnvironmentVariable(environmentVariableName, value); + } + } + + private static void SetIfNotAlreadySet(string environmentVariableName, int value) + { + SetIfNotAlreadySet(environmentVariableName, value.ToString()); + } + } +} From a1c423c0f64c49cf5b1050bc34a31a49baaa63ee Mon Sep 17 00:00:00 2001 From: Nick Guerrera <nicholg@microsoft.com> Date: Tue, 18 Jul 2017 08:34:08 -0700 Subject: [PATCH 3/8] Honor UI language override in test runs Also fix some incorrect unlocalized test expectations that slipped in. --- .../dotnet-cli-build/EnvironmentVariableFilter.cs | 1 + src/Microsoft.DotNet.Cli.Utils/Product.cs | 2 +- .../TestBase.cs | 10 ++++++++++ test/dotnet-new.Tests/NewCommandTests.cs | 12 +++++++++--- test/dotnet-run.Tests/GivenDotnetRunRunsCsProj.cs | 12 +++++++----- .../ParserTests/ValdidationMessageTests.cs | 2 -- 6 files changed, 28 insertions(+), 11 deletions(-) diff --git a/build_projects/dotnet-cli-build/EnvironmentVariableFilter.cs b/build_projects/dotnet-cli-build/EnvironmentVariableFilter.cs index 432f30386..6071d0765 100644 --- a/build_projects/dotnet-cli-build/EnvironmentVariableFilter.cs +++ b/build_projects/dotnet-cli-build/EnvironmentVariableFilter.cs @@ -28,6 +28,7 @@ namespace Microsoft.DotNet.Cli.Build private IEnumerable<string> _environmentVariablesToKeep = new string [] { "DOTNET_CLI_TELEMETRY_SESSIONID", + "DOTNET_CLI_UI_LANGUAGE", "DOTNET_MULTILEVEL_LOOKUP", "DOTNET_RUNTIME_ID", "DOTNET_SKIP_FIRST_TIME_EXPERIENCE", diff --git a/src/Microsoft.DotNet.Cli.Utils/Product.cs b/src/Microsoft.DotNet.Cli.Utils/Product.cs index 023004ce4..8811847b3 100644 --- a/src/Microsoft.DotNet.Cli.Utils/Product.cs +++ b/src/Microsoft.DotNet.Cli.Utils/Product.cs @@ -7,7 +7,7 @@ namespace Microsoft.DotNet.Cli.Utils { public class Product { - public static readonly string LongName = LocalizableStrings.DotNetCommandLineTools; + public static string LongName => LocalizableStrings.DotNetCommandLineTools; public static readonly string Version = GetProductVersion(); private static string GetProductVersion() diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/TestBase.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/TestBase.cs index e2e1269a6..b377b4331 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/TestBase.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/TestBase.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.IO; using System.Linq; using System.Threading.Tasks; @@ -23,6 +24,15 @@ namespace Microsoft.DotNet.Tools.Test.Utilities private TempRoot _temp; private static TestAssets s_testAssets; + static TestBase() + { + // set culture of test process to match CLI sub-processes when the UI language is overriden. + string overriddenUILanguage = Environment.GetEnvironmentVariable("DOTNET_CLI_UI_LANGUAGE"); + if (overriddenUILanguage != null) + { + CultureInfo.DefaultThreadCurrentUICulture = new CultureInfo(overriddenUILanguage); + } + } protected static string RepoRoot { diff --git a/test/dotnet-new.Tests/NewCommandTests.cs b/test/dotnet-new.Tests/NewCommandTests.cs index 45eccf5c7..e22cb821c 100644 --- a/test/dotnet-new.Tests/NewCommandTests.cs +++ b/test/dotnet-new.Tests/NewCommandTests.cs @@ -7,7 +7,7 @@ using Xunit; namespace Microsoft.DotNet.New.Tests { - public class NewCommandTests + public class NewCommandTests : TestBase { [Fact] public void WhenSwitchIsSkippedThenItPrintsError() @@ -16,7 +16,10 @@ namespace Microsoft.DotNet.New.Tests cmd.ExitCode.Should().NotBe(0); - cmd.StdErr.Should().StartWith("No templates matched the input template name: Web1.1."); + if (!DotnetUnderTest.IsLocalized()) + { + cmd.StdErr.Should().StartWith("No templates matched the input template name: Web1.1."); + } } [Fact] @@ -26,7 +29,10 @@ namespace Microsoft.DotNet.New.Tests cmd.ExitCode.Should().NotBe(0); - cmd.StdErr.Should().StartWith("Unable to determine the desired template from the input template name: c."); + if (!DotnetUnderTest.IsLocalized()) + { + cmd.StdErr.Should().StartWith("Unable to determine the desired template from the input template name: c."); + } } } } diff --git a/test/dotnet-run.Tests/GivenDotnetRunRunsCsProj.cs b/test/dotnet-run.Tests/GivenDotnetRunRunsCsProj.cs index 36a0d3fde..5fa67328e 100644 --- a/test/dotnet-run.Tests/GivenDotnetRunRunsCsProj.cs +++ b/test/dotnet-run.Tests/GivenDotnetRunRunsCsProj.cs @@ -7,6 +7,8 @@ using Microsoft.DotNet.TestFramework; using Microsoft.DotNet.Tools.Test.Utilities; using Xunit; +using LocalizableStrings = Microsoft.DotNet.Tools.Run.LocalizableStrings; + namespace Microsoft.DotNet.Cli.Run.Tests { public class GivenDotnetRunBuildsCsproj : TestBase @@ -280,7 +282,7 @@ namespace Microsoft.DotNet.Cli.Run.Tests .ExecuteWithCapturedOutput("--launch-profile test") .Should().Pass() .And.HaveStdOutContaining("Hello World!") - .And.HaveStdErrContaining("The specified launch profile could not be located."); + .And.HaveStdErrContaining(LocalizableStrings.RunCommandExceptionCouldNotLocateALaunchSettingsFile); } [Fact] @@ -368,7 +370,7 @@ namespace Microsoft.DotNet.Cli.Run.Tests .ExecuteWithCapturedOutput("--launch-profile Third") .Should().Pass() .And.HaveStdOutContaining("(NO MESSAGE)") - .And.HaveStdErrContaining("The launch profile \"Third\" could not be applied."); + .And.HaveStdErrContaining(string.Format(LocalizableStrings.RunCommandExceptionCouldNotApplyLaunchSettings, "Third", "").Trim()); } [Fact] @@ -396,7 +398,7 @@ namespace Microsoft.DotNet.Cli.Run.Tests .ExecuteWithCapturedOutput("--launch-profile \"IIS Express\"") .Should().Pass() .And.HaveStdOutContaining("(NO MESSAGE)") - .And.HaveStdErrContaining("The launch profile \"IIS Express\" could not be applied."); + .And.HaveStdErrContaining(string.Format(LocalizableStrings.RunCommandExceptionCouldNotApplyLaunchSettings, "IIS Express", "").Trim()); } [Fact] @@ -485,7 +487,7 @@ namespace Microsoft.DotNet.Cli.Run.Tests cmd.Should().Pass() .And.HaveStdOutContaining("(NO MESSAGE)") - .And.HaveStdErrContaining("The launch profile \"(Default)\" could not be applied."); + .And.HaveStdErrContaining(string.Format(LocalizableStrings.RunCommandExceptionCouldNotApplyLaunchSettings, LocalizableStrings.DefaultLaunchProfileDisplayName, "").Trim()); } [Fact] @@ -514,7 +516,7 @@ namespace Microsoft.DotNet.Cli.Run.Tests cmd.Should().Pass() .And.HaveStdOutContaining("(NO MESSAGE)") - .And.HaveStdErrContaining("The launch profile \"(Default)\" could not be applied."); + .And.HaveStdErrContaining(string.Format(LocalizableStrings.RunCommandExceptionCouldNotApplyLaunchSettings, LocalizableStrings.DefaultLaunchProfileDisplayName, "").Trim()); } } } diff --git a/test/dotnet.Tests/ParserTests/ValdidationMessageTests.cs b/test/dotnet.Tests/ParserTests/ValdidationMessageTests.cs index 60b65fb29..41d184d6a 100644 --- a/test/dotnet.Tests/ParserTests/ValdidationMessageTests.cs +++ b/test/dotnet.Tests/ParserTests/ValdidationMessageTests.cs @@ -11,8 +11,6 @@ namespace Microsoft.DotNet.Tests.ParserTests { public class ValidationMessageTests { - private readonly ITestOutputHelper output; - [Fact] public void ValidationMessagesFormatCorrectly() { From aed35f482d524a3d26242615029bc5871333715b Mon Sep 17 00:00:00 2001 From: Steve Sanderson <SteveSandersonMS@users.noreply.github.com> Date: Wed, 19 Jul 2017 14:40:15 +0100 Subject: [PATCH 4/8] Update SPA templates to 1.0.0-preview-000409 --- build/DependencyVersions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index c12b02d35..400da8023 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -30,7 +30,7 @@ <CliCommandLineParserVersion>0.1.1-alpha-167</CliCommandLineParserVersion> <CliMigrateVersion>1.2.1-alpha-002133</CliMigrateVersion> <MicroBuildVersion>0.2.0</MicroBuildVersion> - <SpaTemplateVersion>1.0.0-preview-000403</SpaTemplateVersion> + <SpaTemplateVersion>1.0.0-preview-000409</SpaTemplateVersion> <XliffTasksVersion>0.2.0-beta-000042</XliffTasksVersion> <!-- This should either be timestamped or notimestamp as appropriate --> From 8fe8095970b132d6b8d4d9df87afe25ea3d5654b Mon Sep 17 00:00:00 2001 From: Mike Lorbetske <mike.lorbetske@n3-p.com> Date: Wed, 19 Jul 2017 10:37:19 -0700 Subject: [PATCH 5/8] Update to Coherence 26380 --- build/DependencyVersions.props | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index c12b02d35..e5e639bf5 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -22,9 +22,9 @@ <SharedFrameworkVersion>$(CLI_SharedFrameworkVersion)</SharedFrameworkVersion> <SharedHostVersion>$(CLI_SharedFrameworkVersion)</SharedHostVersion> <HostFxrVersion>$(CLI_SharedFrameworkVersion)</HostFxrVersion> - <TemplateEngineVersion>1.0.0-beta2-20170714-287</TemplateEngineVersion> - <TemplateEngineTemplateVersion>1.0.0-beta2-20170717-288</TemplateEngineTemplateVersion> - <TemplateEngineTemplate2_0Version>1.0.0-beta2-20170717-288</TemplateEngineTemplate2_0Version> + <TemplateEngineVersion>1.0.0-beta2-20170719-291</TemplateEngineVersion> + <TemplateEngineTemplateVersion>1.0.0-beta2-20170719-291</TemplateEngineTemplateVersion> + <TemplateEngineTemplate2_0Version>1.0.0-beta2-20170719-291</TemplateEngineTemplate2_0Version> <PlatformAbstractionsVersion>2.0.0-preview3-25518-01</PlatformAbstractionsVersion> <DependencyModelVersion>2.0.0-preview3-25518-01</DependencyModelVersion> <CliCommandLineParserVersion>0.1.1-alpha-167</CliCommandLineParserVersion> @@ -39,7 +39,7 @@ <AspNetCoreBranchName>2.0.0</AspNetCoreBranchName> <AspNetCoreRelease>rtm</AspNetCoreRelease> <AspNetCoreVersion>2.0.0</AspNetCoreVersion> - <AspNetCoreRuntimePackageTimestamp>26343</AspNetCoreRuntimePackageTimestamp> + <AspNetCoreRuntimePackageTimestamp>26380</AspNetCoreRuntimePackageTimestamp> <AspNetCoreRuntimePackageBrandName>aspnetcore-store</AspNetCoreRuntimePackageBrandName> <AspNetCoreVersionAndRelease>$(AspNetCoreVersion)-$(AspNetCoreRelease)</AspNetCoreVersionAndRelease> From 85573db000f82a3510010f8ced945083e74b5606 Mon Sep 17 00:00:00 2001 From: Nick Guerrera <nicholg@microsoft.com> Date: Wed, 19 Jul 2017 10:25:45 -0700 Subject: [PATCH 6/8] Respond to PR feedback: use method names not comments --- src/dotnet/Program.cs | 1 - src/dotnet/UILanguageOverride.cs | 13 +++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/dotnet/Program.cs b/src/dotnet/Program.cs index 08a711f93..4611ec7b7 100644 --- a/src/dotnet/Program.cs +++ b/src/dotnet/Program.cs @@ -199,7 +199,6 @@ namespace Microsoft.DotNet.Cli // see the .NET Core Notes in https://msdn.microsoft.com/en-us/library/system.diagnostics.process(v=vs.110).aspx Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); - // Honor UI language customization UILanguageOverride.Setup(); } diff --git a/src/dotnet/UILanguageOverride.cs b/src/dotnet/UILanguageOverride.cs index 00282389b..b93547b74 100644 --- a/src/dotnet/UILanguageOverride.cs +++ b/src/dotnet/UILanguageOverride.cs @@ -15,15 +15,20 @@ namespace Microsoft.DotNet.Cli public static void Setup() { CultureInfo language = GetOverriddenUILanguage(); - if (language == null) + if (language != null) { - return; + ApplyOverrideToCurrentProcess(language); + FlowOverrideToChildProcesses(language); } + } - // Make the current process respect the override. + private static void ApplyOverrideToCurrentProcess(CultureInfo language) + { CultureInfo.DefaultThreadCurrentUICulture = language; + } - // Pass down the override to other processes that we start via appropriate environment variables + private static void FlowOverrideToChildProcesses(CultureInfo language) + { // Do not override any environment variables that are already set as we do not want to clobber a more granular setting with our global setting. SetIfNotAlreadySet(DOTNET_CLI_UI_LANGUAGE, language.Name); SetIfNotAlreadySet(VSLANG, language.LCID); // for tools following VS guidelines to just work in CLI From 368531715e2b1a8bf7abac3e9bc5047a8bd709f4 Mon Sep 17 00:00:00 2001 From: Nick Guerrera <nicholg@microsoft.com> Date: Wed, 19 Jul 2017 11:51:38 -0700 Subject: [PATCH 7/8] Fix VSLANG handling typo --- src/dotnet/UILanguageOverride.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dotnet/UILanguageOverride.cs b/src/dotnet/UILanguageOverride.cs index b93547b74..5e44e56cc 100644 --- a/src/dotnet/UILanguageOverride.cs +++ b/src/dotnet/UILanguageOverride.cs @@ -51,7 +51,7 @@ namespace Microsoft.DotNet.Cli // VSLANG=<lcid> is set by VS and we respect that as well so that we will respect the VS // language preference if we're invoked by VS. string vsLang = Environment.GetEnvironmentVariable(VSLANG); - if (vsLang != null && int.TryParse(VSLANG, out int vsLcid)) + if (vsLang != null && int.TryParse(vsLang, out int vsLcid)) { try { From 28c51d2eaaa408a04019a6d6adab6affe7ade661 Mon Sep 17 00:00:00 2001 From: Nick Guerrera <nicholg@microsoft.com> Date: Wed, 19 Jul 2017 13:58:06 -0700 Subject: [PATCH 8/8] Localize first-run "Expanding" and "Decompressing" --- .../CompressionUtility.cs | 2 +- .../IndexedArchive.cs | 2 +- .../LocalizableStrings.resx | 126 ++++++++++++++++++ .../Microsoft.DotNet.Archive.csproj | 5 + .../xlf/LocalizableStrings.cs.xlf | 17 +++ .../xlf/LocalizableStrings.de.xlf | 17 +++ .../xlf/LocalizableStrings.es.xlf | 17 +++ .../xlf/LocalizableStrings.fr.xlf | 17 +++ .../xlf/LocalizableStrings.it.xlf | 17 +++ .../xlf/LocalizableStrings.ja.xlf | 17 +++ .../xlf/LocalizableStrings.ko.xlf | 17 +++ .../xlf/LocalizableStrings.pl.xlf | 17 +++ .../xlf/LocalizableStrings.pt-BR.xlf | 17 +++ .../xlf/LocalizableStrings.ru.xlf | 17 +++ .../xlf/LocalizableStrings.tr.xlf | 17 +++ .../xlf/LocalizableStrings.zh-Hans.xlf | 17 +++ .../xlf/LocalizableStrings.zh-Hant.xlf | 17 +++ 17 files changed, 354 insertions(+), 2 deletions(-) create mode 100644 src/Microsoft.DotNet.Archive/LocalizableStrings.resx create mode 100644 src/Microsoft.DotNet.Archive/xlf/LocalizableStrings.cs.xlf create mode 100644 src/Microsoft.DotNet.Archive/xlf/LocalizableStrings.de.xlf create mode 100644 src/Microsoft.DotNet.Archive/xlf/LocalizableStrings.es.xlf create mode 100644 src/Microsoft.DotNet.Archive/xlf/LocalizableStrings.fr.xlf create mode 100644 src/Microsoft.DotNet.Archive/xlf/LocalizableStrings.it.xlf create mode 100644 src/Microsoft.DotNet.Archive/xlf/LocalizableStrings.ja.xlf create mode 100644 src/Microsoft.DotNet.Archive/xlf/LocalizableStrings.ko.xlf create mode 100644 src/Microsoft.DotNet.Archive/xlf/LocalizableStrings.pl.xlf create mode 100644 src/Microsoft.DotNet.Archive/xlf/LocalizableStrings.pt-BR.xlf create mode 100644 src/Microsoft.DotNet.Archive/xlf/LocalizableStrings.ru.xlf create mode 100644 src/Microsoft.DotNet.Archive/xlf/LocalizableStrings.tr.xlf create mode 100644 src/Microsoft.DotNet.Archive/xlf/LocalizableStrings.zh-Hans.xlf create mode 100644 src/Microsoft.DotNet.Archive/xlf/LocalizableStrings.zh-Hant.xlf diff --git a/src/Microsoft.DotNet.Archive/CompressionUtility.cs b/src/Microsoft.DotNet.Archive/CompressionUtility.cs index 0b4e937dc..285799116 100644 --- a/src/Microsoft.DotNet.Archive/CompressionUtility.cs +++ b/src/Microsoft.DotNet.Archive/CompressionUtility.cs @@ -98,7 +98,7 @@ namespace Microsoft.DotNet.Archive } long compressedSize = inStream.Length - inStream.Position; - var lzmaProgress = new LzmaProgress(progress, "Decompressing", outSize, MeasureBy.Output); + var lzmaProgress = new LzmaProgress(progress, LocalizableStrings.Decompressing, outSize, MeasureBy.Output); lzmaProgress.SetProgress(0, 0); decoder.Code(inStream, outStream, compressedSize, outSize, lzmaProgress); lzmaProgress.SetProgress(inStream.Length, outSize); diff --git a/src/Microsoft.DotNet.Archive/IndexedArchive.cs b/src/Microsoft.DotNet.Archive/IndexedArchive.cs index bb4c9bbd1..fb0ef22f6 100644 --- a/src/Microsoft.DotNet.Archive/IndexedArchive.cs +++ b/src/Microsoft.DotNet.Archive/IndexedArchive.cs @@ -380,7 +380,7 @@ namespace Microsoft.DotNet.Archive extractOperations.AsParallel().ForAll(extractOperation => { extractOperation.DoOperation(); - progress.Report("Expanding", Interlocked.Increment(ref opsExecuted), extractOperations.Count); + progress.Report(LocalizableStrings.Expanding, Interlocked.Increment(ref opsExecuted), extractOperations.Count); }); } } diff --git a/src/Microsoft.DotNet.Archive/LocalizableStrings.resx b/src/Microsoft.DotNet.Archive/LocalizableStrings.resx new file mode 100644 index 000000000..9f9b5a9e7 --- /dev/null +++ b/src/Microsoft.DotNet.Archive/LocalizableStrings.resx @@ -0,0 +1,126 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <data name="Expanding" xml:space="preserve"> + <value>Expanding</value> + </data> + <data name="Decompressing" xml:space="preserve"> + <value>Decompressing</value> + </data> +</root> \ No newline at end of file diff --git a/src/Microsoft.DotNet.Archive/Microsoft.DotNet.Archive.csproj b/src/Microsoft.DotNet.Archive/Microsoft.DotNet.Archive.csproj index 9a2cd2cdf..04b8f25be 100644 --- a/src/Microsoft.DotNet.Archive/Microsoft.DotNet.Archive.csproj +++ b/src/Microsoft.DotNet.Archive/Microsoft.DotNet.Archive.csproj @@ -10,8 +10,13 @@ <PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign> </PropertyGroup> + <ItemGroup> + <EmbeddedResource Update="**\*.resx" GenerateSource="true" /> + </ItemGroup> + <ItemGroup> <PackageReference Include="NETStandard.Library" Version="1.6.0" /> <PackageReference Include="System.Linq.Parallel" Version="4.0.1" /> + <PackageReference Include="XliffTasks" Version="$(XliffTasksVersion)" PrivateAssets="All" /> </ItemGroup> </Project> \ No newline at end of file diff --git a/src/Microsoft.DotNet.Archive/xlf/LocalizableStrings.cs.xlf b/src/Microsoft.DotNet.Archive/xlf/LocalizableStrings.cs.xlf new file mode 100644 index 000000000..c73270522 --- /dev/null +++ b/src/Microsoft.DotNet.Archive/xlf/LocalizableStrings.cs.xlf @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd"> + <file datatype="xml" source-language="en" target-language="cs" original="../LocalizableStrings.resx"> + <body> + <trans-unit id="Expanding"> + <source>Expanding</source> + <target state="new">Expanding</target> + <note /> + </trans-unit> + <trans-unit id="Decompressing"> + <source>Decompressing</source> + <target state="new">Decompressing</target> + <note /> + </trans-unit> + </body> + </file> +</xliff> \ No newline at end of file diff --git a/src/Microsoft.DotNet.Archive/xlf/LocalizableStrings.de.xlf b/src/Microsoft.DotNet.Archive/xlf/LocalizableStrings.de.xlf new file mode 100644 index 000000000..96d5d68ca --- /dev/null +++ b/src/Microsoft.DotNet.Archive/xlf/LocalizableStrings.de.xlf @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd"> + <file datatype="xml" source-language="en" target-language="de" original="../LocalizableStrings.resx"> + <body> + <trans-unit id="Expanding"> + <source>Expanding</source> + <target state="new">Expanding</target> + <note /> + </trans-unit> + <trans-unit id="Decompressing"> + <source>Decompressing</source> + <target state="new">Decompressing</target> + <note /> + </trans-unit> + </body> + </file> +</xliff> \ No newline at end of file diff --git a/src/Microsoft.DotNet.Archive/xlf/LocalizableStrings.es.xlf b/src/Microsoft.DotNet.Archive/xlf/LocalizableStrings.es.xlf new file mode 100644 index 000000000..926da184e --- /dev/null +++ b/src/Microsoft.DotNet.Archive/xlf/LocalizableStrings.es.xlf @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd"> + <file datatype="xml" source-language="en" target-language="es" original="../LocalizableStrings.resx"> + <body> + <trans-unit id="Expanding"> + <source>Expanding</source> + <target state="new">Expanding</target> + <note /> + </trans-unit> + <trans-unit id="Decompressing"> + <source>Decompressing</source> + <target state="new">Decompressing</target> + <note /> + </trans-unit> + </body> + </file> +</xliff> \ No newline at end of file diff --git a/src/Microsoft.DotNet.Archive/xlf/LocalizableStrings.fr.xlf b/src/Microsoft.DotNet.Archive/xlf/LocalizableStrings.fr.xlf new file mode 100644 index 000000000..5524d9821 --- /dev/null +++ b/src/Microsoft.DotNet.Archive/xlf/LocalizableStrings.fr.xlf @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd"> + <file datatype="xml" source-language="en" target-language="fr" original="../LocalizableStrings.resx"> + <body> + <trans-unit id="Expanding"> + <source>Expanding</source> + <target state="new">Expanding</target> + <note /> + </trans-unit> + <trans-unit id="Decompressing"> + <source>Decompressing</source> + <target state="new">Decompressing</target> + <note /> + </trans-unit> + </body> + </file> +</xliff> \ No newline at end of file diff --git a/src/Microsoft.DotNet.Archive/xlf/LocalizableStrings.it.xlf b/src/Microsoft.DotNet.Archive/xlf/LocalizableStrings.it.xlf new file mode 100644 index 000000000..6c1c15533 --- /dev/null +++ b/src/Microsoft.DotNet.Archive/xlf/LocalizableStrings.it.xlf @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd"> + <file datatype="xml" source-language="en" target-language="it" original="../LocalizableStrings.resx"> + <body> + <trans-unit id="Expanding"> + <source>Expanding</source> + <target state="new">Expanding</target> + <note /> + </trans-unit> + <trans-unit id="Decompressing"> + <source>Decompressing</source> + <target state="new">Decompressing</target> + <note /> + </trans-unit> + </body> + </file> +</xliff> \ No newline at end of file diff --git a/src/Microsoft.DotNet.Archive/xlf/LocalizableStrings.ja.xlf b/src/Microsoft.DotNet.Archive/xlf/LocalizableStrings.ja.xlf new file mode 100644 index 000000000..e00b949fb --- /dev/null +++ b/src/Microsoft.DotNet.Archive/xlf/LocalizableStrings.ja.xlf @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd"> + <file datatype="xml" source-language="en" target-language="ja" original="../LocalizableStrings.resx"> + <body> + <trans-unit id="Expanding"> + <source>Expanding</source> + <target state="new">Expanding</target> + <note /> + </trans-unit> + <trans-unit id="Decompressing"> + <source>Decompressing</source> + <target state="new">Decompressing</target> + <note /> + </trans-unit> + </body> + </file> +</xliff> \ No newline at end of file diff --git a/src/Microsoft.DotNet.Archive/xlf/LocalizableStrings.ko.xlf b/src/Microsoft.DotNet.Archive/xlf/LocalizableStrings.ko.xlf new file mode 100644 index 000000000..fb515905d --- /dev/null +++ b/src/Microsoft.DotNet.Archive/xlf/LocalizableStrings.ko.xlf @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd"> + <file datatype="xml" source-language="en" target-language="ko" original="../LocalizableStrings.resx"> + <body> + <trans-unit id="Expanding"> + <source>Expanding</source> + <target state="new">Expanding</target> + <note /> + </trans-unit> + <trans-unit id="Decompressing"> + <source>Decompressing</source> + <target state="new">Decompressing</target> + <note /> + </trans-unit> + </body> + </file> +</xliff> \ No newline at end of file diff --git a/src/Microsoft.DotNet.Archive/xlf/LocalizableStrings.pl.xlf b/src/Microsoft.DotNet.Archive/xlf/LocalizableStrings.pl.xlf new file mode 100644 index 000000000..bfe8b9a35 --- /dev/null +++ b/src/Microsoft.DotNet.Archive/xlf/LocalizableStrings.pl.xlf @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd"> + <file datatype="xml" source-language="en" target-language="pl" original="../LocalizableStrings.resx"> + <body> + <trans-unit id="Expanding"> + <source>Expanding</source> + <target state="new">Expanding</target> + <note /> + </trans-unit> + <trans-unit id="Decompressing"> + <source>Decompressing</source> + <target state="new">Decompressing</target> + <note /> + </trans-unit> + </body> + </file> +</xliff> \ No newline at end of file diff --git a/src/Microsoft.DotNet.Archive/xlf/LocalizableStrings.pt-BR.xlf b/src/Microsoft.DotNet.Archive/xlf/LocalizableStrings.pt-BR.xlf new file mode 100644 index 000000000..9e6cb642c --- /dev/null +++ b/src/Microsoft.DotNet.Archive/xlf/LocalizableStrings.pt-BR.xlf @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd"> + <file datatype="xml" source-language="en" target-language="pt-BR" original="../LocalizableStrings.resx"> + <body> + <trans-unit id="Expanding"> + <source>Expanding</source> + <target state="new">Expanding</target> + <note /> + </trans-unit> + <trans-unit id="Decompressing"> + <source>Decompressing</source> + <target state="new">Decompressing</target> + <note /> + </trans-unit> + </body> + </file> +</xliff> \ No newline at end of file diff --git a/src/Microsoft.DotNet.Archive/xlf/LocalizableStrings.ru.xlf b/src/Microsoft.DotNet.Archive/xlf/LocalizableStrings.ru.xlf new file mode 100644 index 000000000..c09a74f61 --- /dev/null +++ b/src/Microsoft.DotNet.Archive/xlf/LocalizableStrings.ru.xlf @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd"> + <file datatype="xml" source-language="en" target-language="ru" original="../LocalizableStrings.resx"> + <body> + <trans-unit id="Expanding"> + <source>Expanding</source> + <target state="new">Expanding</target> + <note /> + </trans-unit> + <trans-unit id="Decompressing"> + <source>Decompressing</source> + <target state="new">Decompressing</target> + <note /> + </trans-unit> + </body> + </file> +</xliff> \ No newline at end of file diff --git a/src/Microsoft.DotNet.Archive/xlf/LocalizableStrings.tr.xlf b/src/Microsoft.DotNet.Archive/xlf/LocalizableStrings.tr.xlf new file mode 100644 index 000000000..8be3dbe6a --- /dev/null +++ b/src/Microsoft.DotNet.Archive/xlf/LocalizableStrings.tr.xlf @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd"> + <file datatype="xml" source-language="en" target-language="tr" original="../LocalizableStrings.resx"> + <body> + <trans-unit id="Expanding"> + <source>Expanding</source> + <target state="new">Expanding</target> + <note /> + </trans-unit> + <trans-unit id="Decompressing"> + <source>Decompressing</source> + <target state="new">Decompressing</target> + <note /> + </trans-unit> + </body> + </file> +</xliff> \ No newline at end of file diff --git a/src/Microsoft.DotNet.Archive/xlf/LocalizableStrings.zh-Hans.xlf b/src/Microsoft.DotNet.Archive/xlf/LocalizableStrings.zh-Hans.xlf new file mode 100644 index 000000000..aab479ac3 --- /dev/null +++ b/src/Microsoft.DotNet.Archive/xlf/LocalizableStrings.zh-Hans.xlf @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd"> + <file datatype="xml" source-language="en" target-language="zh-Hans" original="../LocalizableStrings.resx"> + <body> + <trans-unit id="Expanding"> + <source>Expanding</source> + <target state="new">Expanding</target> + <note /> + </trans-unit> + <trans-unit id="Decompressing"> + <source>Decompressing</source> + <target state="new">Decompressing</target> + <note /> + </trans-unit> + </body> + </file> +</xliff> \ No newline at end of file diff --git a/src/Microsoft.DotNet.Archive/xlf/LocalizableStrings.zh-Hant.xlf b/src/Microsoft.DotNet.Archive/xlf/LocalizableStrings.zh-Hant.xlf new file mode 100644 index 000000000..a333565e1 --- /dev/null +++ b/src/Microsoft.DotNet.Archive/xlf/LocalizableStrings.zh-Hant.xlf @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd"> + <file datatype="xml" source-language="en" target-language="zh-Hant" original="../LocalizableStrings.resx"> + <body> + <trans-unit id="Expanding"> + <source>Expanding</source> + <target state="new">Expanding</target> + <note /> + </trans-unit> + <trans-unit id="Decompressing"> + <source>Decompressing</source> + <target state="new">Decompressing</target> + <note /> + </trans-unit> + </body> + </file> +</xliff> \ No newline at end of file