From fbb40a1bb9b791596070d164de98a429ca155e8d Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Thu, 1 Jul 2021 14:21:43 +0200 Subject: [PATCH] Trying more --- Site/App_GlobalResources/Menu5.designer.cs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/Site/App_GlobalResources/Menu5.designer.cs b/Site/App_GlobalResources/Menu5.designer.cs index 8f84fd26..67d2fce8 100644 --- a/Site/App_GlobalResources/Menu5.designer.cs +++ b/Site/App_GlobalResources/Menu5.designer.cs @@ -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);