Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Перенос локализации с Корвакса #4

Merged
merged 11 commits into from
Dec 27, 2024
2 changes: 1 addition & 1 deletion Content.Client/Research/UI/ResearchConsoleMenu.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
xmlns:customControls="clr-namespace:Content.Client.Administration.UI.CustomControls"
Title="{Loc 'research-console-menu-title'}"
MinSize="625 400"
SetSize="700 550">
SetSize="760 550"> <!-- RU-Localization -->
<BoxContainer Orientation="Vertical"
HorizontalExpand="True"
VerticalExpand="True">
Expand Down
26 changes: 26 additions & 0 deletions Content.Server/Chat/Managers/ChatSanitizationManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,32 @@ public sealed class ChatSanitizationManager : IChatSanitizationManager
{
private static readonly Dictionary<string, string> ShorthandToEmote = new()
{
// RU-Localization-Start
{ "хд", "chatsan-laughs" },
{ "о-о", "chatsan-wide-eyed" }, // cyrillic о
{ "о.о", "chatsan-wide-eyed" }, // cyrillic о
{ "0_о", "chatsan-wide-eyed" }, // cyrillic о
{ "о/", "chatsan-waves" }, // cyrillic о
{ "о7", "chatsan-salutes" }, // cyrillic о
{ "0_o", "chatsan-wide-eyed" },
{ "лмао", "chatsan-laughs" },
{ "рофл", "chatsan-laughs" },
{ "яхз", "chatsan-shrugs" },
{ ":0", "chatsan-surprised" },
{ ":р", "chatsan-stick-out-tongue" }, // cyrillic р
{ "кек", "chatsan-laughs" },
{ "T_T", "chatsan-cries" },
{ "Т_Т", "chatsan-cries" }, // cyrillic T
{ "=_(", "chatsan-cries" },
{ "!с", "chatsan-laughs" },
{ "!в", "chatsan-sighs" },
{ "!х", "chatsan-claps" },
{ "!щ", "chatsan-snaps" },
{ "))", "chatsan-smiles-widely" },
{ ")", "chatsan-smiles" },
{ "((", "chatsan-frowns-deeply" },
{ "(", "chatsan-frowns" },
// RU-Localization-End
{ ":)", "chatsan-smiles" },
{ ":]", "chatsan-smiles" },
{ "=)", "chatsan-smiles" },
Expand Down
13 changes: 11 additions & 2 deletions Content.Server/Speech/EntitySystems/BarkAccentSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public sealed class BarkAccentSystem : EntitySystem
[Dependency] private readonly IRobustRandom _random = default!;

private static readonly IReadOnlyList<string> Barks = new List<string>{
" Woof!", " WOOF", " wof-wof"
" Гав!", " ГАВ", " вуф-вуф" // RU-Localization
}.AsReadOnly();

private static readonly IReadOnlyDictionary<string, string> SpecialWords = new Dictionary<string, string>()
Expand All @@ -17,6 +17,12 @@ public sealed class BarkAccentSystem : EntitySystem
{ "Ah", "Arf" },
{ "oh", "oof" },
{ "Oh", "Oof" },
// RU-Localization-Start
{ "га", "гаф" },
{ "Га", "Гаф" },
{ "угу", "вуф" },
{ "Угу", "Вуф" },
// RU-Localization-End
};

public override void Initialize()
Expand All @@ -32,7 +38,10 @@ public string Accentuate(string message)
}

return message.Replace("!", _random.Pick(Barks))
.Replace("l", "r").Replace("L", "R");
// RU-Localization-Start
.Replace("l", "r").Replace("L", "R")
.Replace("л", "р").Replace("Л", "Р");
// RU-Localization-End
}

private void OnAccent(EntityUid uid, BarkAccentComponent component, AccentGetEvent args)
Expand Down
21 changes: 21 additions & 0 deletions Content.Server/Speech/EntitySystems/FrontalLispSystem.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Text.RegularExpressions;
using Content.Server.Speech.Components;
using Robust.Shared.Random; // RU-Localization

namespace Content.Server.Speech.EntitySystems;

Expand All @@ -12,6 +13,8 @@ public sealed class FrontalLispSystem : EntitySystem
private static readonly Regex RegexLowerEcks = new(@"[e]+[x]+[c]*|[x]+");
// @formatter:on

[Dependency] private readonly IRobustRandom _random = default!; // RU-Localization

public override void Initialize()
{
base.Initialize();
Expand All @@ -29,6 +32,24 @@ private void OnAccent(EntityUid uid, FrontalLispComponent component, AccentGetEv
message = RegexUpperEcks.Replace(message, "EKTH");
message = RegexLowerEcks.Replace(message, "ekth");

// RU-Localization Start
// с - ш
message = Regex.Replace(message, @"с", _random.Prob(0.90f) ? "ш" : "с");
message = Regex.Replace(message, @"С", _random.Prob(0.90f) ? "Ш" : "С");
// ч - ш
message = Regex.Replace(message, @"ч", _random.Prob(0.90f) ? "ш" : "ч");
message = Regex.Replace(message, @"Ч", _random.Prob(0.90f) ? "Ш" : "Ч");
// ц - ч
message = Regex.Replace(message, @"ц", _random.Prob(0.90f) ? "ч" : "ц");
message = Regex.Replace(message, @"Ц", _random.Prob(0.90f) ? "Ч" : "Ц");
// т - ч
message = Regex.Replace(message, @"\B[т](?![АЕЁИОУЫЭЮЯаеёиоуыэюя])", _random.Prob(0.90f) ? "ч" : "т");
message = Regex.Replace(message, @"\B[Т](?![АЕЁИОУЫЭЮЯаеёиоуыэюя])", _random.Prob(0.90f) ? "Ч" : "Т");
// з - ж
message = Regex.Replace(message, @"з", _random.Prob(0.90f) ? "ж" : "з");
message = Regex.Replace(message, @"З", _random.Prob(0.90f) ? "Ж" : "З");
// RU-Localization End

args.Message = message;
}
}
53 changes: 53 additions & 0 deletions Content.Server/Speech/EntitySystems/LizardAccentSystem.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Text.RegularExpressions;
using Content.Server.Speech.Components;
using Robust.Shared.Random; // RU-Localization

namespace Content.Server.Speech.EntitySystems;

Expand All @@ -11,6 +12,8 @@ public sealed class LizardAccentSystem : EntitySystem
private static readonly Regex RegexLowerEndX = new(@"\bx([\-|r|R]|\b)");
private static readonly Regex RegexUpperEndX = new(@"\bX([\-|r|R]|\b)");

[Dependency] private readonly IRobustRandom _random = default!; // RU-Localization

public override void Initialize()
{
base.Initialize();
Expand All @@ -32,6 +35,56 @@ private void OnAccent(EntityUid uid, LizardAccentComponent component, AccentGetE
// eckS
message = RegexUpperEndX.Replace(message, "ECKS$1");

// RU-Localization-Start
// c => ссс
message = Regex.Replace(
message,
"с+",
_random.Pick(new List<string>() { "сс", "ссс" })
);
// С => CCC
message = Regex.Replace(
message,
"С+",
_random.Pick(new List<string>() { "СС", "ССС" })
);
// з => ссс
message = Regex.Replace(
message,
"з+",
_random.Pick(new List<string>() { "сс", "ссс" })
);
// З => CCC
message = Regex.Replace(
message,
"З+",
_random.Pick(new List<string>() { "СС", "ССС" })
);
// ш => шшш
message = Regex.Replace(
message,
"ш+",
_random.Pick(new List<string>() { "шш", "шшш" })
);
// Ш => ШШШ
message = Regex.Replace(
message,
"Ш+",
_random.Pick(new List<string>() { "ШШ", "ШШШ" })
);
// ч => щщщ
message = Regex.Replace(
message,
"ч+",
_random.Pick(new List<string>() { "щщ", "щщщ" })
);
// Ч => ЩЩЩ
message = Regex.Replace(
message,
"Ч+",
_random.Pick(new List<string>() { "ЩЩ", "ЩЩЩ" })
);
// RU-Localization-End
args.Message = message;
}
}
10 changes: 5 additions & 5 deletions Content.Server/Speech/EntitySystems/MonkeyAccentSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,23 @@ public string Accentuate(string message)
{
foreach (var _ in word)
{
accentedMessage.Append('O');
accentedMessage.Append('У'); // RU-Localization
}

if (_random.NextDouble() >= 0.3)
accentedMessage.Append('K');
accentedMessage.Append('К'); // RU-Localization
}
else
accentedMessage.Append('O');
accentedMessage.Append('У'); // RU-Localization
}
else
{
foreach (var _ in word)
{
if (_random.NextDouble() >= 0.8)
accentedMessage.Append('H');
accentedMessage.Append('Г'); // RU-Localization
else
accentedMessage.Append('A');
accentedMessage.Append('А'); // RU-Localization
}

}
Expand Down
30 changes: 30 additions & 0 deletions Content.Server/Speech/EntitySystems/MothAccentSystem.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
using System.Text.RegularExpressions;
using Content.Server.Speech.Components;
using Robust.Shared.Random; // RU-Localization

namespace Content.Server.Speech.EntitySystems;

public sealed class MothAccentSystem : EntitySystem
{
[Dependency] private readonly IRobustRandom _random = default!; // RU-Localization

private static readonly Regex RegexLowerBuzz = new Regex("z{1,3}");
private static readonly Regex RegexUpperBuzz = new Regex("Z{1,3}");

Expand All @@ -23,6 +26,33 @@ private void OnAccent(EntityUid uid, MothAccentComponent component, AccentGetEve
// buZZZ
message = RegexUpperBuzz.Replace(message, "ZZZ");

// RU-Localization-Start
// ж => жжж
message = Regex.Replace(
message,
"ж+",
_random.Pick(new List<string>() { "жж", "жжж" })
);
// Ж => ЖЖЖ
message = Regex.Replace(
message,
"Ж+",
_random.Pick(new List<string>() { "ЖЖ", "ЖЖЖ" })
);
// з => ссс
message = Regex.Replace(
message,
"з+",
_random.Pick(new List<string>() { "зз", "ззз" })
);
// З => CCC
message = Regex.Replace(
message,
"З+",
_random.Pick(new List<string>() { "ЗЗ", "ЗЗЗ" })
);
// RU-Localization-End

args.Message = message;
}
}
5 changes: 5 additions & 0 deletions Content.Server/Speech/EntitySystems/OwOAccentSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public sealed class OwOAccentSystem : EntitySystem
private static readonly IReadOnlyDictionary<string, string> SpecialWords = new Dictionary<string, string>()
{
{ "you", "wu" },
{ "ты", "ти" }, // RU-Localization
};

public override void Initialize()
Expand All @@ -29,6 +30,10 @@ public string Accentuate(string message)
}

return message.Replace("!", _random.Pick(Faces))
// RU-Localization-Start
.Replace("р", "в").Replace("Р", "В")
.Replace("л", "в").Replace("Л", "В")
// RU-Localization-End
.Replace("r", "w").Replace("R", "W")
.Replace("l", "w").Replace("L", "W");
}
Expand Down
6 changes: 6 additions & 0 deletions Content.Server/Speech/EntitySystems/SlurredSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ private string Accentuate(string message, float scale)
'a' => "ah",
'u' => "oo",
'c' => "k",
// RU-Localization Start
'о' => "а",
'к' => "кх",
'щ' => "шч",
'ц' => "тс",
// RU-Localization End
_ => $"{character}",
};

Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Speech/EntitySystems/StutteringSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public sealed class StutteringSystem : SharedStutteringSystem
[Dependency] private readonly IRobustRandom _random = default!;

// Regex of characters to stutter.
private static readonly Regex Stutter = new(@"[b-df-hj-np-tv-wxyz]",
private static readonly Regex Stutter = new(@"[b-df-hj-np-tv-wxyz-б-джзй-кмн-прт-фхцчшщ]", // RU-Localization
RegexOptions.Compiled | RegexOptions.IgnoreCase);

public override void Initialize()
Expand Down
6 changes: 3 additions & 3 deletions Content.Shared/Chat/SharedChatSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ public abstract class SharedChatSystem : EntitySystem
public const char LocalPrefix = '>';
public const char ConsolePrefix = '/';
public const char DeadPrefix = '\\';
public const char LOOCPrefix = '(';
public const char LOOCPrefix = '_'; // RU-Localization
public const char OOCPrefix = '[';
public const char EmotesPrefix = '@';
public const char EmotesPrefix = '%'; // RU-Localization
public const char EmotesAltPrefix = '*';
public const char AdminPrefix = ']';
public const char WhisperPrefix = ',';
public const char DefaultChannelKey = 'h';
public const char DefaultChannelKey = 'р'; // RU-Localization

[ValidatePrototypeId<RadioChannelPrototype>]
public const string CommonChannel = "Common";
Expand Down
7 changes: 6 additions & 1 deletion Content.Shared/Localizations/ContentLocalizationManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ public sealed class ContentLocalizationManager
[Dependency] private readonly ILocalizationManager _loc = default!;

// If you want to change your codebase's language, do it here.
private const string Culture = "en-US";
private const string Culture = "ru-RU"; // RU-Localization
private const string FallbackCulture = "en-US"; // RU-Localization

/// <summary>
/// Custom format strings used for parsing and displaying minutes:seconds timespans.
Expand All @@ -26,8 +27,12 @@ public sealed class ContentLocalizationManager
public void Initialize()
{
var culture = new CultureInfo(Culture);
var fallbackCulture = new CultureInfo(FallbackCulture); // RU-Localization

_loc.LoadCulture(culture);
_loc.LoadCulture(fallbackCulture); // RU-Localization
_loc.SetFallbackCluture(fallbackCulture); // RU-Localization
_loc.AddFunction(culture, "MANY", FormatMany); // RU-Localization: To prevent problems in auto-generated locale files
_loc.AddFunction(culture, "PRESSURE", FormatPressure);
_loc.AddFunction(culture, "POWERWATTS", FormatPowerWatts);
_loc.AddFunction(culture, "POWERJOULES", FormatPowerJoules);
Expand Down
2 changes: 1 addition & 1 deletion Content.Shared/Preferences/HumanoidCharacterProfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace Content.Shared.Preferences
[Serializable, NetSerializable]
public sealed partial class HumanoidCharacterProfile : ICharacterProfile
{
private static readonly Regex RestrictedNameRegex = new("[^A-Z,a-z,0-9, ,\\-,']");
private static readonly Regex RestrictedNameRegex = new("[^А-Яа-яёЁ0-9' -]"); // RU-Localization
private static readonly Regex ICNameCaseRegex = new(@"^(?<word>\w)|\b(?<word>\w)(?=\w*$)");

public const int MaxNameLength = 32;
Expand Down
Loading
Loading