~ruther/NosSmooth

ref: 398f20aea501ab079ea7b8627b4ffe622a65719f NosSmooth/Data/NosSmooth.Data.Abstractions/Language/TranslatableString.cs -rw-r--r-- 1.1 KiB
398f20ae — František Boháček chore: update nosfiles package 3 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
//
//  TranslatableString.cs
//
//  Copyright (c) František Boháček. All rights reserved.
//  Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System.Diagnostics.CodeAnalysis;

namespace NosSmooth.Data.Abstractions.Language;

/// <summary>
/// Represents a string that may be translated.
/// </summary>
/// <param name="Root">The root key of the translations.</param>
/// <param name="Key">The key of the string translation.</param>
[SuppressMessage("StyleCop.CSharp.NamingRules", "SA1313:Parameter names should begin with lower-case letter", Justification = "Standard.")]
public record struct TranslatableString(TranslationRoot Root, string Key)
{
    /// <summary>
    /// Gets the translated string, if available.
    /// If not available, the key will be returned.
    /// </summary>
    public string Translated { get; private set; } = Key;

    /// <summary>
    /// Fill this translatable string with a translation.
    /// </summary>
    /// <param name="translation">The translation to fill.</param>
    public void Fill(string translation)
    {
        Translated = translation;
    }
}
Do not follow this link