Add LocalizationService APIs
This commit is contained in:
11
Oqtane.Client/Services/Interfaces/ILocalizationService.cs
Normal file
11
Oqtane.Client/Services/Interfaces/ILocalizationService.cs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Oqtane.Services
|
||||||
|
{
|
||||||
|
public interface ILocalizationService
|
||||||
|
{
|
||||||
|
Task<string> GetDefaultCulture();
|
||||||
|
|
||||||
|
Task<string[]> GetSupportedCultures();
|
||||||
|
}
|
||||||
|
}
|
22
Oqtane.Client/Services/LocalizationService.cs
Normal file
22
Oqtane.Client/Services/LocalizationService.cs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
using System.Net.Http;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Oqtane.Shared;
|
||||||
|
|
||||||
|
namespace Oqtane.Services
|
||||||
|
{
|
||||||
|
public class LocalizationService : ServiceBase, ILocalizationService
|
||||||
|
{
|
||||||
|
private readonly SiteState _siteState;
|
||||||
|
|
||||||
|
public LocalizationService(HttpClient http, SiteState siteState) : base(http)
|
||||||
|
{
|
||||||
|
_siteState = siteState;
|
||||||
|
}
|
||||||
|
|
||||||
|
private string Apiurl => CreateApiUrl(_siteState.Alias, "Localization");
|
||||||
|
|
||||||
|
public async Task<string> GetDefaultCulture() => await GetJsonAsync<string>($"{Apiurl}/getDefaultCulture");
|
||||||
|
|
||||||
|
public async Task<string[]> GetSupportedCultures() => await GetJsonAsync<string[]>($"{Apiurl}/getSupportedCultures");
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user