From 4e6f008c54c190b926c9a8725e6f03bbdfcab092 Mon Sep 17 00:00:00 2001 From: Ruslan Baysuakov Date: Tue, 10 Dec 2024 18:59:39 +0300 Subject: [PATCH 1/2] return LocalizableDisplay and mark it obsolete to reduce risk of runtime errors --- .../LocalizableDisplayAttribute.cs | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Mindbox.I18n.Abstractions/LocalizableDisplayAttribute.cs diff --git a/Mindbox.I18n.Abstractions/LocalizableDisplayAttribute.cs b/Mindbox.I18n.Abstractions/LocalizableDisplayAttribute.cs new file mode 100644 index 0000000..3e26c84 --- /dev/null +++ b/Mindbox.I18n.Abstractions/LocalizableDisplayAttribute.cs @@ -0,0 +1,35 @@ +// Copyright 2022 Mindbox Ltd +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +namespace Mindbox.I18n.Abstractions; + +[AttributeUsage(AttributeTargets.Field)] +[Obsolete("Use Mindbox.I18n.Abstractions.LocalizableEnumMember instead")] +public sealed class LocalizableDisplayAttribute : Attribute +{ +#pragma warning disable CA1019 + public LocalizableDisplayAttribute([LocalizationKey] string name) + { + LocalizableName = LocalizableString.ForKey(name); + } + + public LocalizableDisplayAttribute([LocalizationKey] string name, [LocalizationKey] string description) + { + LocalizableName = LocalizableString.ForKey(name); + LocalizableDescription = LocalizableString.ForKey(description); + } +#pragma warning restore CA1019 + public LocalizableString LocalizableName { get; } + public LocalizableString? LocalizableDescription { get; } +} \ No newline at end of file From 707841b369c4e93ba9c449bd26f5f110747823cf Mon Sep 17 00:00:00 2001 From: Ruslan Baysuakov Date: Tue, 10 Dec 2024 19:00:23 +0300 Subject: [PATCH 2/2] bump minor version --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index e06991b..a2c2202 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -15,7 +15,7 @@ 14 - 0 + 1 $(BuildNumber) 0 $(VersionMajor).$(VersionMinor).$(BuildNumber)$(VersionTag)