Skip to content
397 changes: 241 additions & 156 deletions ProjectApparatus/Hacks.cs

Large diffs are not rendered by default.

2,205 changes: 2,205 additions & 0 deletions ProjectApparatus/Lang/en_US.Designer.cs

Large diffs are not rendered by default.

834 changes: 834 additions & 0 deletions ProjectApparatus/Lang/en_US.resx

Large diffs are not rendered by default.

2,205 changes: 2,205 additions & 0 deletions ProjectApparatus/Lang/ru_RU.Designer.cs

Large diffs are not rendered by default.

834 changes: 834 additions & 0 deletions ProjectApparatus/Lang/ru_RU.resx

Large diffs are not rendered by default.

56 changes: 56 additions & 0 deletions ProjectApparatus/LocalizationManager.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
using ProjectApparatus.Lang;
using ProjectApparatus.Properties;
using System;
using System.Resources;

//
//How to add new language:
//1. Create new resource file in Lang folder, like en_US.resx
//2. Add new language to LocalizationManager.cs
//3. Add new language to Hacks.cs in dictionary
//


public class LocalizationManager
{
private static ResourceManager resourceManager;
// for default language use English
public static string currentLanguage = "en_US";

static LocalizationManager()
{
SetLanguage(currentLanguage);
}

public static void SetLanguage(string language)
{
switch (language)
{
case "en_US":
resourceManager = new ResourceManager(typeof(en_US));
break;
case "ru_RU":
resourceManager = new ResourceManager(typeof(ru_RU));
break;
// add next language here, for example:
//case "ts_TS":
// resourceManager = new ResourceManager(typeof(ts_TS));
// break;
default:
throw new ArgumentException("Unsupported language: " + language);
}
currentLanguage = language;
}

public static string GetString(string key)
{
try
{
return resourceManager.GetString(key);
}
catch (Exception)
{
return "Missing translation for key: " + key;
}
}
}
21 changes: 21 additions & 0 deletions ProjectApparatus/ProjectApparatus.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,18 @@
<Compile Include="Features.cs" />
<Compile Include="GameObjectManager.cs" />
<Compile Include="Hacks.cs" />
<Compile Include="Lang\ru_RU.Designer.cs">
<DependentUpon>ru_RU.resx</DependentUpon>
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
</Compile>
<Compile Include="Lang\en_US.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>en_US.resx</DependentUpon>
</Compile>
<Compile Include="Loader.cs" />
<Compile Include="LocalizationManager.cs" />
<Compile Include="Patches.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Resources.cs" />
Expand All @@ -72,6 +83,16 @@
<Compile Include="Utils.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Lang\ru_RU.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>ru_RU.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Lang\en_US.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>en_US.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resources" />
<EmbeddedResource Include="Resource1.resx">
<Generator>ResXFileCodeGenerator</Generator>
Expand Down
6 changes: 3 additions & 3 deletions ProjectApparatus/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ public class SettingsData
public bool b_AnonChatSpam;
public float fl_NoclipSpeed = 7f;
public float fl_ThirdpersonDistance = 2f;
public string str_TerminalSignal = "Hello World!";
public string str_ChatMessage = "Hello World!";
public string str_TerminalSignal = LocalizationManager.GetString("hello_world");
public string str_ChatMessage = LocalizationManager.GetString("hello_world");
public string str_MoneyToGive = "0";
public string str_QuotaFulfilled = "0", str_Quota = "130";

Expand Down Expand Up @@ -154,7 +154,7 @@ public static void ReadCredits()
public Dictionary<PlayerControllerB, bool> b_SpamObjects = new Dictionary<PlayerControllerB, bool>();
public Dictionary<PlayerControllerB, bool> b_SpamChat = new Dictionary<PlayerControllerB, bool>();
public bool b_HideObjects = false;
public string str_DamageToGive = "1", str_HealthToHeal = "1", str_ChatAsPlayer = "Hello World!";
public string str_DamageToGive = "1", str_HealthToHeal = "1", str_ChatAsPlayer = LocalizationManager.GetString("hello_world");

/* SettingsData */
public SettingsData settingsData = new SettingsData();
Expand Down
3 changes: 2 additions & 1 deletion ProjectApparatus/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ public enum Tabs
Players,
Graphics,
Upgrades,
Settings
Settings,
Language
}

public static Tabs nTab = 0;
Expand Down