Let's see if this localizes the menu, then

This commit is contained in:
Rick Falkvinge
2021-07-04 20:45:59 +02:00
parent 1c1272385f
commit ceb28f80a3
2 changed files with 19 additions and 2 deletions
+17 -1
View File
@@ -6,7 +6,23 @@ using System.Threading.Tasks;
namespace Swarmops.Localization
{
class LocStrings
public static class LocStrings
{
public static string GetString(LocDomain domain, string stringResource)
{
switch (domain)
{
case LocDomain.Menu5:
return Menu5.ResourceManager.GetString(stringResource);
default:
throw new NotImplementedException("Unimplemented localization domain: " + domain.ToString());
}
}
}
public enum LocString
{
Unknown = 0
};
}
+2 -1
View File
@@ -6,6 +6,7 @@ using System.Web.UI;
using System.Xml.Serialization;
using Swarmops.Frontend;
using Swarmops.Interface.Objects;
using Swarmops.Localization;
using Swarmops.Logic.Support;
using Swarmops.Logic.Swarm;
@@ -104,7 +105,7 @@ namespace Swarmops.Controls.Base
if (!String.IsNullOrEmpty (menuItem.ResourceKey))
{
object resourceObject = Resources.Menu5.ResourceManager.GetString("Menu5_" + menuItem.ResourceKey);
object resourceObject = LocStrings.GetString(LocDomain.Menu5, "Menu5_" + menuItem.ResourceKey);
if (resourceObject != null)
{
localizedText = resourceObject.ToString();