ILocalizationManager.cs 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. using System.Collections.Generic;
  2. using System.Diagnostics.CodeAnalysis;
  3. using MediaBrowser.Model.Entities;
  4. namespace MediaBrowser.Model.Globalization;
  5. /// <summary>
  6. /// Interface ILocalizationManager.
  7. /// </summary>
  8. public interface ILocalizationManager
  9. {
  10. /// <summary>
  11. /// Gets the cultures.
  12. /// </summary>
  13. /// <returns><see cref="IEnumerable{CultureDto}" />.</returns>
  14. IEnumerable<CultureDto> GetCultures();
  15. /// <summary>
  16. /// Gets the countries.
  17. /// </summary>
  18. /// <returns><see cref="IReadOnlyList{CountryInfo}" />.</returns>
  19. IReadOnlyList<CountryInfo> GetCountries();
  20. /// <summary>
  21. /// Gets the parental ratings.
  22. /// </summary>
  23. /// <returns><see cref="IReadOnlyList{ParentalRating}" />.</returns>
  24. IReadOnlyList<ParentalRating> GetParentalRatings();
  25. /// <summary>
  26. /// Gets the rating level.
  27. /// </summary>
  28. /// <param name="rating">The rating.</param>
  29. /// <param name="countryCode">The optional two letter ISO language string.</param>
  30. /// <returns><see cref="ParentalRatingScore" /> or <c>null</c>.</returns>
  31. ParentalRatingScore? GetRatingScore(string rating, string? countryCode = null);
  32. /// <summary>
  33. /// Gets the localized string.
  34. /// </summary>
  35. /// <param name="phrase">The phrase.</param>
  36. /// <param name="culture">The culture.</param>
  37. /// <returns><see cref="string" />.</returns>
  38. string GetLocalizedString(string phrase, string culture);
  39. /// <summary>
  40. /// Gets the localized string.
  41. /// </summary>
  42. /// <param name="phrase">The phrase.</param>
  43. /// <returns>System.String.</returns>
  44. string GetLocalizedString(string phrase);
  45. /// <summary>
  46. /// Gets the localization options.
  47. /// </summary>
  48. /// <returns><see cref="IEnumerable{LocalizationOption}" />.</returns>
  49. IEnumerable<LocalizationOption> GetLocalizationOptions();
  50. /// <summary>
  51. /// Returns the correct <see cref="CultureDto" /> for the given language.
  52. /// </summary>
  53. /// <param name="language">The language.</param>
  54. /// <returns>The correct <see cref="CultureDto" /> for the given language.</returns>
  55. CultureDto? FindLanguageInfo(string language);
  56. /// <summary>
  57. /// Returns the language in ISO 639-2/T when the input is ISO 639-2/B.
  58. /// </summary>
  59. /// <param name="isoB">The language in ISO 639-2/B.</param>
  60. /// <param name="isoT">The language in ISO 639-2/T.</param>
  61. /// <returns>Whether the language could be converted.</returns>
  62. public bool TryGetISO6392TFromB(string isoB, [NotNullWhen(true)] out string? isoT);
  63. }