aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Model/Globalization/ILocalizationManager.cs
blob: f6e65028e424d279eae9040230d03f2108e99570 (plain)
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using MediaBrowser.Model.Entities;

namespace MediaBrowser.Model.Globalization;

/// <summary>
/// Interface ILocalizationManager.
/// </summary>
public interface ILocalizationManager
{
    /// <summary>
    /// Gets the cultures.
    /// </summary>
    /// <returns><see cref="IEnumerable{CultureDto}" />.</returns>
    IEnumerable<CultureDto> GetCultures();

    /// <summary>
    /// Gets the countries.
    /// </summary>
    /// <returns><see cref="IReadOnlyList{CountryInfo}" />.</returns>
    IReadOnlyList<CountryInfo> GetCountries();

    /// <summary>
    /// Gets the parental ratings.
    /// </summary>
    /// <returns><see cref="IReadOnlyList{ParentalRating}" />.</returns>
    IReadOnlyList<ParentalRating> GetParentalRatings();

    /// <summary>
    /// Gets the rating level.
    /// </summary>
    /// <param name="rating">The rating.</param>
    /// <param name="countryCode">The optional two letter ISO language string.</param>
    /// <returns><see cref="ParentalRatingScore" /> or <c>null</c>.</returns>
    ParentalRatingScore? GetRatingScore(string rating, string? countryCode = null);

    /// <summary>
    /// Gets the localized string.
    /// </summary>
    /// <param name="phrase">The phrase.</param>
    /// <param name="culture">The culture.</param>
    /// <returns><see cref="string" />.</returns>
    string GetLocalizedString(string phrase, string culture);

    /// <summary>
    /// Gets the localized string.
    /// </summary>
    /// <param name="phrase">The phrase.</param>
    /// <returns>System.String.</returns>
    string GetLocalizedString(string phrase);

    /// <summary>
    /// Gets the localization options.
    /// </summary>
    /// <returns><see cref="IEnumerable{LocalizationOption}" />.</returns>
    IEnumerable<LocalizationOption> GetLocalizationOptions();

    /// <summary>
    /// Returns the correct <see cref="CultureDto" /> for the given language.
    /// </summary>
    /// <param name="language">The language.</param>
    /// <returns>The correct <see cref="CultureDto" /> for the given language.</returns>
    CultureDto? FindLanguageInfo(string language);

    /// <summary>
    /// Returns the language in ISO 639-2/T when the input is ISO 639-2/B.
    /// </summary>
    /// <param name="isoB">The language in ISO 639-2/B.</param>
    /// <param name="isoT">The language in ISO 639-2/T.</param>
    /// <returns>Whether the language could be converted.</returns>
    public bool TryGetISO6392TFromB(string isoB, [NotNullWhen(true)] out string? isoT);
}