optimize satellite assembly loading based on the new model where all cultures are available
This commit is contained in:
@ -12,6 +12,7 @@ using Oqtane.Shared;
|
||||
using System.Linq;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System;
|
||||
|
||||
namespace Oqtane.Controllers
|
||||
{
|
||||
@ -42,7 +43,7 @@ namespace Oqtane.Controllers
|
||||
packagename = "Oqtane";
|
||||
}
|
||||
var languages = _languages.GetLanguages(SiteId).ToList();
|
||||
foreach (var file in Directory.EnumerateFiles(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), packagename + ".Client.resources.dll", SearchOption.AllDirectories))
|
||||
foreach (var file in Directory.EnumerateFiles(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), $"{packagename}.*{Constants.SatelliteAssemblyExtension}", SearchOption.AllDirectories))
|
||||
{
|
||||
var code = Path.GetFileName(Path.GetDirectoryName(file));
|
||||
if (languages.Any(item => item.Code == code))
|
||||
|
@ -22,11 +22,15 @@ namespace Oqtane.Controllers
|
||||
// GET: api/localization
|
||||
[HttpGet()]
|
||||
public IEnumerable<Culture> Get()
|
||||
=> _localizationManager.GetSupportedCultures().Select(c => new Culture {
|
||||
Name = CultureInfo.GetCultureInfo(c).Name,
|
||||
DisplayName = CultureInfo.GetCultureInfo(c).DisplayName,
|
||||
IsDefault = _localizationManager.GetDefaultCulture()
|
||||
{
|
||||
var cultures = _localizationManager.GetSupportedCultures().Select(c => new Culture
|
||||
{
|
||||
Name = CultureInfo.GetCultureInfo(c).Name,
|
||||
DisplayName = CultureInfo.GetCultureInfo(c).DisplayName,
|
||||
IsDefault = _localizationManager.GetDefaultCulture()
|
||||
.Equals(CultureInfo.GetCultureInfo(c).Name, StringComparison.OrdinalIgnoreCase)
|
||||
});
|
||||
});
|
||||
return cultures.OrderBy(item => item.DisplayName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user