Added version to Language Management, improved framework performance by loading languages into PageState, include all supported cultures and allow Administrator to add any language to a site regardless of translation availability, fix translation upgrade issue
This commit is contained in:
@ -17,6 +17,14 @@ namespace Oqtane.Services
|
||||
/// <returns></returns>
|
||||
Task<List<Language>> GetLanguagesAsync(int siteId);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of all available languages for the given <see cref="Site" /> and client assembly
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="clientAssemblyName"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<Language>> GetLanguagesAsync(int siteId, string clientAssemblyName);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the given language
|
||||
/// </summary>
|
||||
|
@ -17,18 +17,27 @@ namespace Oqtane.Services
|
||||
|
||||
public async Task<List<Language>> GetLanguagesAsync(int siteId)
|
||||
{
|
||||
var languages = await GetJsonAsync<List<Language>>($"{Apiurl}?siteid={siteId}");
|
||||
return await GetLanguagesAsync(siteId, "");
|
||||
}
|
||||
|
||||
return languages?.OrderBy(l => l.Name).ToList() ?? Enumerable.Empty<Language>().ToList();
|
||||
public async Task<List<Language>> GetLanguagesAsync(int siteId, string clientAssemblyName)
|
||||
{
|
||||
return await GetJsonAsync<List<Language>>($"{Apiurl}?siteid={siteId}&clientassemblyname={clientAssemblyName}");
|
||||
}
|
||||
|
||||
public async Task<Language> GetLanguageAsync(int languageId)
|
||||
=> await GetJsonAsync<Language>($"{Apiurl}/{languageId}");
|
||||
{
|
||||
return await GetJsonAsync<Language>($"{Apiurl}/{languageId}");
|
||||
}
|
||||
|
||||
public async Task<Language> AddLanguageAsync(Language language)
|
||||
=> await PostJsonAsync<Language>(Apiurl, language);
|
||||
{
|
||||
return await PostJsonAsync<Language>(Apiurl, language);
|
||||
}
|
||||
|
||||
public async Task DeleteLanguageAsync(int languageId)
|
||||
=> await DeleteAsync($"{Apiurl}/{languageId}");
|
||||
{
|
||||
await DeleteAsync($"{Apiurl}/{languageId}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user