Skip to content

Commit

Permalink
[#316] Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
gruenwaldlk committed Aug 12, 2023
1 parent 18a3e0b commit bcd1247
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the MIT license. See LICENSE file in the project root for details.

using System;
using System.Diagnostics.CodeAnalysis;
using PG.StarWarsGame.Components.Localisation.Languages;

namespace PG.StarWarsGame.Components.Localisation.Attributes;
Expand All @@ -10,6 +11,8 @@ namespace PG.StarWarsGame.Components.Localisation.Attributes;
/// <see cref="Attribute" /> that can be used to mark a <see cref="IAlamoLanguageDefinition" /> as the default
/// language.
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, Inherited = false)]
[ExcludeFromCodeCoverage]
public sealed class DefaultLanguageAttribute : Attribute
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace PG.StarWarsGame.Components.Localisation.Attributes;
/// <summary>
/// An <see cref="Attribute" /> that marks a language as officially supported.
/// </summary>
[AttributeUsage(AttributeTargets.Class, Inherited = false)]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, Inherited = false)]
[ExcludeFromCodeCoverage]
public sealed class OfficiallySupportedLanguageAttribute : Attribute
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) Alamo Engine Tools and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for details.

using System;
using System.Globalization;
using FluentValidation;
using FluentValidation.Results;
Expand Down Expand Up @@ -51,10 +52,7 @@ protected virtual bool EqualsInternal(IAlamoLanguageDefinition other)
/// <returns></returns>
protected virtual int GetHashCodeInternal()
{
unchecked
{
return (ConfiguredLanguageIdentifier.GetHashCode() * 397) ^ Culture.GetHashCode();
}
return HashCode.Combine(LanguageIdentifier.ToUpper().GetHashCode(), Culture.GetHashCode());
}

/// <inheritdoc />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,8 @@ internal TranslationItem(string key, string value)
throw new ArgumentNullException(nameof(key));
}

if (string.IsNullOrWhiteSpace(value))
{
throw new ArgumentNullException(nameof(value));
}

Key = key ?? throw new ArgumentNullException(nameof(key));
Value = value ?? throw new ArgumentNullException(nameof(value));
Value = value;
}


Expand Down Expand Up @@ -61,7 +56,7 @@ private class TranslationItemValidator : AbstractValidator<TranslationItem>
internal TranslationItemValidator()
{
RuleFor(i => i.Key).NotNull().NotEmpty();
RuleFor(i => i.Value).NotNull().NotEmpty();
RuleFor(i => i.Value).NotNull();
}
}
}

0 comments on commit bcd1247

Please sign in to comment.