Skip to content

A Swiss Army knife for developers.

Fixed Settings page internationalization and improved version number display (#15)

Etienne Baudouxaf53b2b67fca
diff --git a/THIRD-PARTY-NOTICES.md b/THIRD-PARTY-NOTICES.md
index fe824418f..4cb755c76 100644
--- a/THIRD-PARTY-NOTICES.md
+++ b/THIRD-PARTY-NOTICES.md
@@ -5,8 +5,9 @@ This project incorporates components from the projects listed below. The origina
1. Newtonsoft.Json (https://github.com/JamesNK/Newtonsoft.Json)
2. ColorCode-Universal (https://github.com/CommunityToolkit/ColorCode-Universal)
3. DiffPlex (https://github.com/mmanela/diffplex)
-4. Windows Community Toolkit (https://github.com/CommunityToolkit/WindowsCommunityToolkit)
-5. Notepads App (https://github.com/JasonStein/Notepads)
+4. GitInfo (https://github.com/devlooped/GitInfo)
+5. Windows Community Toolkit (https://github.com/CommunityToolkit/WindowsCommunityToolkit)
+6. Notepads App (https://github.com/JasonStein/Notepads)
Newtonsoft.Json NOTICES AND INFORMATION BEGIN HERE
=========================================
@@ -135,6 +136,30 @@ While redistributing the Work or Derivative Works thereof, You may choose to off
END OF TERMS AND CONDITIONS
+GitInfo NOTICES AND INFORMATION BEGIN HERE
+=========================================
+The MIT License (MIT)
+
+Copyright (c) Daniel Cazzulino and Contributors
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
Windows Community Toolkit NOTICES AND INFORMATION BEGIN HERE
=========================================
# Windows Community Toolkit
diff --git a/src/Directory.Build.props b/src/Directory.Build.props
index 18fe27065..32f71782b 100644
--- a/src/Directory.Build.props
+++ b/src/Directory.Build.props
@@ -23,6 +23,7 @@
<PropertyGroup>
<Nuget_ColorCodeUwp>2.0.6</Nuget_ColorCodeUwp>
<Nuget_DiffPlex>1.7.0</Nuget_DiffPlex>
+ <Nuget_GitInfo>2.2.0</Nuget_GitInfo>
<NuGet_MicrosoftNETCoreUniversalWindowsPlatform>6.2.12</NuGet_MicrosoftNETCoreUniversalWindowsPlatform>
<NuGet_MicrosoftToolkitMvvm>7.0.2</NuGet_MicrosoftToolkitMvvm>
<Nuget_MicrosoftToolkitUwpUIBehaviors>7.0.2</Nuget_MicrosoftToolkitUwpUIBehaviors>
diff --git a/src/dev/impl/DevToys/DevToys.csproj b/src/dev/impl/DevToys/DevToys.csproj
index 35870cfd8..d1bd7eb78 100644
--- a/src/dev/impl/DevToys/DevToys.csproj
+++ b/src/dev/impl/DevToys/DevToys.csproj
@@ -408,6 +408,7 @@
<PackageReference Include="ColorCode.Core" Version="$(Nuget_ColorCodeUwp)" />
<PackageReference Include="ColorCode.UWP" Version="$(Nuget_ColorCodeUwp)" />
<PackageReference Include="DiffPlex" Version="$(Nuget_DiffPlex)" />
+ <PackageReference Include="GitInfo" Version="$(Nuget_GitInfo)" />
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform" Version="$(NuGet_MicrosoftNETCoreUniversalWindowsPlatform)" />
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="$(NuGet_MicrosoftToolkitMvvm)" />
<PackageReference Include="Microsoft.Toolkit.Uwp.UI.Behaviors" Version="$(Nuget_MicrosoftToolkitUwpUIBehaviors)" />
diff --git a/src/dev/impl/DevToys/LanguageManager.cs b/src/dev/impl/DevToys/LanguageManager.cs
index b9dbf4e30..9cf47293d 100644
--- a/src/dev/impl/DevToys/LanguageManager.cs
+++ b/src/dev/impl/DevToys/LanguageManager.cs
@@ -485,6 +485,11 @@ namespace DevToys
/// </summary>
public string Close => _resources.GetString("Close");
+ /// <summary>
+ /// Gets the resource Copy.
+ /// </summary>
+ public string Copy => _resources.GetString("Copy");
+
/// <summary>
/// Gets the resource Dark.
/// </summary>
@@ -560,6 +565,11 @@ namespace DevToys
/// </summary>
public string RateAndReview => _resources.GetString("RateAndReview");
+ /// <summary>
+ /// Gets the resource ReportProblem.
+ /// </summary>
+ public string ReportProblem => _resources.GetString("ReportProblem");
+
/// <summary>
/// Gets the resource SmartDetection.
/// </summary>
@@ -570,6 +580,11 @@ namespace DevToys
/// </summary>
public string SmartDetectionDescription => _resources.GetString("SmartDetectionDescription");
+ /// <summary>
+ /// Gets the resource SourceCode.
+ /// </summary>
+ public string SourceCode => _resources.GetString("SourceCode");
+
/// <summary>
/// Gets the resource TextEditor.
/// </summary>
diff --git a/src/dev/impl/DevToys/Strings/en/Settings.resw b/src/dev/impl/DevToys/Strings/en/Settings.resw
index aed013e12..d2a84c94e 100644
--- a/src/dev/impl/DevToys/Strings/en/Settings.resw
+++ b/src/dev/impl/DevToys/Strings/en/Settings.resw
@@ -135,6 +135,9 @@
<data name="Close" xml:space="preserve">
<value>Close</value>
</data>
+ <data name="Copy" xml:space="preserve">
+ <value>Copy</value>
+ </data>
<data name="Dark" xml:space="preserve">
<value>Dark</value>
</data>
@@ -180,12 +183,18 @@
<data name="RateAndReview" xml:space="preserve">
<value>Rate and review on Microsoft Store</value>
</data>
+ <data name="ReportProblem" xml:space="preserve">
+ <value>Report a problem</value>
+ </data>
<data name="SmartDetection" xml:space="preserve">
<value>Smart detection</value>
</data>
<data name="SmartDetectionDescription" xml:space="preserve">
<value>Automatically detect the best tool based on the clipboard content</value>
</data>
+ <data name="SourceCode" xml:space="preserve">
+ <value>Source code</value>
+ </data>
<data name="TextEditor" xml:space="preserve">
<value>Text editor</value>
</data>
diff --git a/src/dev/impl/DevToys/Strings/fr/Settings.resw b/src/dev/impl/DevToys/Strings/fr/Settings.resw
index c6dd0bb07..6e3b620a5 100644
--- a/src/dev/impl/DevToys/Strings/fr/Settings.resw
+++ b/src/dev/impl/DevToys/Strings/fr/Settings.resw
@@ -135,6 +135,9 @@
<data name="Close" xml:space="preserve">
<value>Fermer</value>
</data>
+ <data name="Copy" xml:space="preserve">
+ <value>Copier</value>
+ </data>
<data name="Dark" xml:space="preserve">
<value>Sombre</value>
</data>
@@ -180,12 +183,18 @@
<data name="RateAndReview" xml:space="preserve">
<value>Évaluez et commentez sur Microsoft Store</value>
</data>
+ <data name="ReportProblem" xml:space="preserve">
+ <value>Signaler un problème</value>
+ </data>
<data name="SmartDetection" xml:space="preserve">
<value>Détection intelligente</value>
</data>
<data name="SmartDetectionDescription" xml:space="preserve">
<value>Détecter automatiquement le meilleur outil en fonction du contenu du presse-papiers</value>
</data>
+ <data name="SourceCode" xml:space="preserve">
+ <value>Code source</value>
+ </data>
<data name="TextEditor" xml:space="preserve">
<value>Éditeur de texte</value>
</data>
diff --git a/src/dev/impl/DevToys/ViewModels/Tools/Settings/SettingsToolViewModel.cs b/src/dev/impl/DevToys/ViewModels/Tools/Settings/SettingsToolViewModel.cs
index cac2828ef..67aadb191 100644
--- a/src/dev/impl/DevToys/ViewModels/Tools/Settings/SettingsToolViewModel.cs
+++ b/src/dev/impl/DevToys/ViewModels/Tools/Settings/SettingsToolViewModel.cs
@@ -15,7 +15,10 @@ using System.Collections.Generic;
using System.Composition;
using System.Reflection;
using System.Threading.Tasks;
+using Windows.ApplicationModel;
+using Windows.ApplicationModel.DataTransfer;
using Windows.Services.Store;
+using Clipboard = Windows.ApplicationModel.DataTransfer.Clipboard;
namespace DevToys.ViewModels.Settings
{
@@ -76,7 +79,25 @@ namespace DevToys.ViewModels.Settings
/// <summary>
/// Gets the version of the application.
/// </summary>
- internal string Version => Strings.GetFormattedVersion(typeof(SettingsToolViewModel).GetTypeInfo().Assembly.GetName().Version.ToString());
+ internal string Version
+ {
+ get
+ {
+ string version = Strings.GetFormattedVersion(typeof(SettingsToolViewModel).GetTypeInfo().Assembly.GetName().Version.ToString());
+
+ string architecture = Package.Current.Id.Architecture.ToString();
+#if DEBUG
+ string buildConfiguration = "DEBUG";
+#else
+ string buildConfiguration = "RELEASE";
+#endif
+
+ string gitBranch = ThisAssembly.Git.Branch;
+ string gitCommit = ThisAssembly.Git.Commit;
+
+ return $"{version} | {architecture} | {buildConfiguration} | {gitBranch} | {gitCommit}";
+ }
+ }
[ImportingConstructor]
public SettingsToolViewModel(
@@ -86,6 +107,7 @@ namespace DevToys.ViewModels.Settings
_windowManager = windowManager;
_settingsProvider = settingsProvider;
+ CopyVersionCommand = new RelayCommand(ExecuteCopyVersionCommand);
PrivacyPolicyCommand = new AsyncRelayCommand(ExecutePrivacyPolicyCommandAsync);
ThirdPartyNoticesCommand = new AsyncRelayCommand(ExecuteThirdPartyNoticesCommandAsync);
LicenseCommand = new AsyncRelayCommand(ExecuteLicenseCommandAsync);
@@ -93,6 +115,23 @@ namespace DevToys.ViewModels.Settings
OpenLogsCommand = new AsyncRelayCommand(ExecuteOpenLogsCommandAsync);
}
+ #region CopyVersionCommand
+
+ internal IRelayCommand CopyVersionCommand { get; }
+
+ private void ExecuteCopyVersionCommand()
+ {
+ var data = new DataPackage
+ {
+ RequestedOperation = DataPackageOperation.Copy
+ };
+ data.SetText(Version);
+
+ Clipboard.SetContent(data);
+ }
+
+ #endregion
+
#region PrivacyPolicyCommand
internal IAsyncRelayCommand PrivacyPolicyCommand { get; }
diff --git a/src/dev/impl/DevToys/Views/Tools/Settings/SettingsToolPage.xaml b/src/dev/impl/DevToys/Views/Tools/Settings/SettingsToolPage.xaml
index ccaf3f6cd..d9a416d5e 100644
--- a/src/dev/impl/DevToys/Views/Tools/Settings/SettingsToolPage.xaml
+++ b/src/dev/impl/DevToys/Views/Tools/Settings/SettingsToolPage.xaml
@@ -116,6 +116,11 @@
<controls:ExpandableSettingControl.Icon>
<muxc:ImageIcon Source="/Assets/Logo/Square44x44Logo.altform-lightunplated_targetsize-16.png" Height="16" />
</controls:ExpandableSettingControl.Icon>
+ <Button
+ ToolTipService.ToolTip="{x:Bind ViewModel.Strings.Copy}"
+ Command="{x:Bind ViewModel.CopyVersionCommand}">
+ <FontIcon Glyph="&#xF32B;"/>
+ </Button>
</controls:ExpandableSettingControl>
<controls:ExpandableSettingControl
@@ -124,21 +129,20 @@
<FontIcon Glyph="&#xF4E4;" />
</controls:ExpandableSettingControl.Icon>
<controls:ExpandableSettingControl.ExpandableContent>
- <!-- TODO -->
<Grid Margin="42,0,6,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0">
- <HyperlinkButton Content="Source code" NavigateUri="https://github.com/veler/DevToys" />
+ <HyperlinkButton Content="{x:Bind ViewModel.Strings.SourceCode}" NavigateUri="https://github.com/veler/DevToys" />
<HyperlinkButton Content="{x:Bind ViewModel.Strings.PrivacyPolicy}" Command="{x:Bind ViewModel.PrivacyPolicyCommand}" />
<HyperlinkButton Content="{x:Bind ViewModel.Strings.RateAndReview}" Command="{x:Bind ViewModel.RateAndReviewCommand}" />
</StackPanel>
<StackPanel Grid.Column="1">
<HyperlinkButton Content="{x:Bind ViewModel.Strings.License}" Command="{x:Bind ViewModel.LicenseCommand}" />
<HyperlinkButton Content="{x:Bind ViewModel.Strings.ThirdPartyNotices}" Command="{x:Bind ViewModel.ThirdPartyNoticesCommand}" />
- <HyperlinkButton Content="Report a problem" NavigateUri="https://github.com/veler/DevToys/issues/new/choose" />
+ <HyperlinkButton Content="{x:Bind ViewModel.Strings.ReportProblem}" NavigateUri="https://github.com/veler/DevToys/issues/new/choose" />
</StackPanel>
</Grid>
</controls:ExpandableSettingControl.ExpandableContent>