Skip to content

Commit

Permalink
(maint) Fixed warnings in the code
Browse files Browse the repository at this point in the history
  • Loading branch information
AdmiringWorm committed Jan 21, 2022
1 parent 07c89f2 commit f34a1f9
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
using System.Globalization;
// --------------------------------------------------------------------------------------------------------------------
// <copyright company="Chocolatey" file="LocalizationConverter.cs">
// Copyright 2017 - Present Chocolatey Software, LLC
// Copyright 2014 - 2017 Rob Reynolds, the maintainers of Chocolatey, and RealDimensions Software, LLC
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

using System.Globalization;
using System.Windows.Data;
using ChocolateyGui.Common.Utilities;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright company="Chocolatey" file="LocalizeExtension.cs">
// Copyright 2014 - Present Rob Reynolds, the maintainers of Chocolatey, and RealDimensions Software, LLC
// Copyright 2017 - Present Chocolatey Software, LLC
// Copyright 2014 - 2017 Rob Reynolds, the maintainers of Chocolatey, and RealDimensions Software, LLC
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ public CultureInfo UseLanguage

public ObservableCollection<CultureInfo> AllLanguages { get; private set; } =
new ObservableCollection<CultureInfo>();

public bool CanSave => SelectedSource != null;

public bool CanRemove => SelectedSource != null && !_isNewItem && SelectedSource.Id != ChocolateyLicensedSourceId;
Expand Down Expand Up @@ -665,7 +666,7 @@ private async void OnActivated(object sender, ActivationEventArgs activationEven
#if DEBUG
var descriptionKey = string.Empty;
#else
var descriptionKey = "ChocolateyGUI_" + chocolateyGuiFeature.Key + "Description";
var descriptionKey = "ChocolateyGUI_" + chocolateyGuiSetting.Key + "Description";
#endif

var newDescription = _translationSource[descriptionKey];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
using Caliburn.Micro;
// --------------------------------------------------------------------------------------------------------------------
// <copyright company="Chocolatey" file="ViewModelScreen.cs">
// Copyright 2017 - Present Chocolatey Software, LLC
// Copyright 2014 - 2017 Rob Reynolds, the maintainers of Chocolatey, and RealDimensions Software, LLC
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

using Caliburn.Micro;
using ChocolateyGui.Common.Utilities;

namespace ChocolateyGui.Common.Windows.ViewModels
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ namespace ChocolateyGui.Common.Attributes
{
public class LocalizedCommandForAttribute : CommandForAttribute
{
public string Key { get; set; }

public LocalizedCommandForAttribute(string commandName, string key)
: base(commandName, Localize(key))
{
}

public string Key { get; set; }

private static string Localize(string key)
{
return TranslationSource.Instance[key];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ namespace ChocolateyGui.Common.Attributes
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
public sealed class LocalizedDescriptionAttribute : DescriptionAttribute
{
public string Key { get; set; }

public LocalizedDescriptionAttribute(string key)
: base(Localize(key))
{
Key = key;
}

public string Key { get; set; }

private static string Localize(string key)
{
return TranslationSource.Instance[key];
Expand Down
1 change: 1 addition & 0 deletions Source/ChocolateyGui.Common/Models/ChocolateyGuiFeature.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public string DisplayTitle
{
return _displayTitle ?? Title;
}

set
{
_displayTitle = value;
Expand Down
4 changes: 3 additions & 1 deletion Source/ChocolateyGui.Common/Utilities/TranslationSource.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright company="Chocolatey" file="TranslationSource.cs">
// Copyright 2014 - Present Rob Reynolds, the maintainers of Chocolatey, and RealDimensions Software, LLC
// Copyright 2017 - Present Chocolatey Software, LLC
// Copyright 2014 - 2017 Rob Reynolds, the maintainers of Chocolatey, and RealDimensions Software, LLC
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

Expand All @@ -18,6 +19,7 @@ public sealed class TranslationSource : INotifyPropertyChanged
{
private static readonly Lazy<TranslationSource> _instance =
new Lazy<TranslationSource>(() => new TranslationSource());

private readonly ResourceManager _resourceManager = Resources.ResourceManager;
private CultureInfo _currentCulture;

Expand Down
8 changes: 1 addition & 7 deletions Source/ChocolateyGui/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ protected override void OnStartup(StartupEventArgs e)
var configService = Bootstrapper.Container.Resolve<IConfigService>();
var effectiveConfiguration = configService.GetEffectiveConfiguration();


ThemeMode themeMode;
if (effectiveConfiguration.DefaultToDarkMode == null)
{
Expand Down Expand Up @@ -161,14 +160,9 @@ protected override void OnStartup(StartupEventArgs e)
ThemeAssist.BundledTheme.SyncTheme(themeMode);
}

protected static string L(string key)
private static string L(string key)
{
return _translationSource[key];
}

protected string L(string key, params object[] parameters)
{
return _translationSource[key, parameters];
}
}
}

0 comments on commit f34a1f9

Please sign in to comment.