Skip to content

Commit

Permalink
Add Windows 7 warning in Russian (#82)
Browse files Browse the repository at this point in the history
  • Loading branch information
DrSmugleaf authored Feb 4, 2023
1 parent 2fd3d27 commit 49e480e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
13 changes: 11 additions & 2 deletions SS14.Launcher/Program.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Net.Http.Headers;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using Avalonia;
using Avalonia.Controls;
Expand Down Expand Up @@ -131,11 +132,19 @@ private static unsafe void CheckWindows7()
if (!OperatingSystem.IsWindows() || Environment.OSVersion.Version.Build >= 9600)
return;

const string text =
var text =
"You are using an old version of Windows that is no longer supported by Space Station 14.\n\n" +
"If anything breaks, DO NOT ASK FOR HELP OR SUPPORT.";

const string caption = "Unsupported Windows version";
var caption = "Unsupported Windows version";

if (Language.UserHasLanguage("ru"))
{
text = "Вы используете старую версию Windows которая больше не поддерживается Space Station 14.\n\n" +
"При возникновении ошибок НЕ БУДЕТ ОКАЗАНО НИКАКОЙ ПОДДЕРЖКИ.";

caption = "Неподдерживаемая версия Windows";
}

fixed (char* pText = text)
fixed (char* pCaption = caption)
Expand Down
19 changes: 19 additions & 0 deletions SS14.Launcher/Utility/Language.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System.Threading;

namespace SS14.Launcher.Utility;

public static class Language
{
/// <summary>
/// Checks if the user's current culture or UI culture matches the given language.
/// </summary>
/// <param name="language">Two letter ISO language name, for example "ru".</param>
/// <returns>true if either the user's current culture or UI culture match the given language.</returns>
public static bool UserHasLanguage(string language)
{
var thread = Thread.CurrentThread;

return thread.CurrentCulture.TwoLetterISOLanguageName == language ||
thread.CurrentUICulture.TwoLetterISOLanguageName == language;
}
}

0 comments on commit 49e480e

Please sign in to comment.