You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Sonarr/src/Sonarr.Api.V3/Localization/LocalizationController.cs

43 lines
1.1 KiB

using Microsoft.AspNetCore.Mvc;
using NzbDrone.Core.Localization;
using Sonarr.Http;
using Sonarr.Http.REST;
namespace Sonarr.Api.V3.Localization
{
[V3ApiController]
public class LocalizationController : RestController<LocalizationResource>
{
private readonly ILocalizationService _localizationService;
public LocalizationController(ILocalizationService localizationService)
{
_localizationService = localizationService;
}
protected override LocalizationResource GetResourceById(int id)
{
return GetLocalization();
}
[HttpGet]
[Produces("application/json")]
public LocalizationResource GetLocalization()
{
return _localizationService.GetLocalizationDictionary().ToResource();
}
[HttpGet("language")]
[Produces("application/json")]
public LanguageResource GetLanguage()
{
var identifier = _localizationService.GetLanguageIdentifier();
return new LanguageResource
{
Identifier = identifier
};
}
}
}