~ruther/NosSmooth

ref: 398f20aea501ab079ea7b8627b4ffe622a65719f NosSmooth/Data/NosSmooth.Data.Abstractions/Language/ILanguageService.cs -rw-r--r-- 1.7 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
34
35
36
37
38
39
//
//  ILanguageService.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 Remora.Results;

namespace NosSmooth.Data.Abstractions.Language;

/// <summary>
/// Service for translating NosTale strings.
/// </summary>
public interface ILanguageService
{
    /// <summary>
    /// Gets or sets the current language.
    /// </summary>
    public Language CurrentLanguage { get; set; }

    /// <summary>
    /// Gets the translation of the given key.
    /// </summary>
    /// <param name="root">The root type of the key.</param>
    /// <param name="key">The key to translate.</param>
    /// <param name="language">The language, <see cref="CurrentLanguage"/> will be used if null.</param>
    /// <param name="ct">The cancellation token for cancelling the operation.</param>
    /// <returns>The translated string or an error.</returns>
    public Task<Result<string>> GetTranslationAsync(TranslationRoot root, string key, Language? language = default, CancellationToken ct = default);

    /// <summary>
    /// Gets the translation of the given key.
    /// </summary>
    /// <param name="translatableString">The translatable string containing .</param>
    /// <param name="language">The language, <see cref="CurrentLanguage"/> will be used if null.</param>
    /// <param name="ct">The cancellation token for cancelling the operation.</param>
    /// <returns>The translated string or an error.</returns>
    public Task<Result<string>> GetTranslationAsync(TranslatableString translatableString, Language? language = default, CancellationToken ct = default);
}
Do not follow this link