Trying more

This commit is contained in:
Rick Falkvinge
2021-07-01 14:21:43 +02:00
parent caa142a425
commit fbb40a1bb9
+16 -1
View File
@@ -9,6 +9,7 @@
//------------------------------------------------------------------------------
using System.Globalization;
using System.IO;
namespace Resources {
using System;
@@ -54,6 +55,15 @@ namespace Resources {
string infix = string.Empty;
string suffix = ".resources";
string resourceAssemblyPath = "/usr/share/swarmops/frontend/bin/";
if (Path.DirectorySeparatorChar != '/')
{
// If we're not running on Linux, this is a development environment,
// so use the HttpContext for the running folder
resourceAssemblyPath = "~/";
}
CultureInfo currentCulture = CultureInfo.CurrentUICulture;
if (currentCulture != null /* && currentCulture.Name != "neutral" */)
{
@@ -62,7 +72,12 @@ namespace Resources {
infix = "." + cultureName;
prefix = cultureName + "/";
return System.Reflection.Assembly.Load(prefix + baseAssemblyName + infix + suffix);
// If specific culture exists, return it, otherwise return neutral culture
if (File.Exists(resourceAssemblyPath + prefix + baseAssemblyName + infix + suffix))
{
return System.Reflection.Assembly.Load(resourceAssemblyPath + prefix + baseAssemblyName + suffix + ".dll");
}
}
return System.Reflection.Assembly.Load(baseAssemblyName + suffix);