Skip to content

Commit

Permalink
first localisation (#1)
Browse files Browse the repository at this point in the history
Локализации
  • Loading branch information
Vonsant authored Aug 6, 2024
1 parent 215bd41 commit d4f90c9
Show file tree
Hide file tree
Showing 7,388 changed files with 91,004 additions and 17,653 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 1 addition & 1 deletion Content.Client/MainMenu/UI/MainMenuControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public MainMenuControl(IResourceCache resCache, IConfigurationManager configMan)
LayoutContainer.SetMarginTop(VBox, 30);
LayoutContainer.SetGrowHorizontal(VBox, LayoutContainer.GrowDirection.Begin);

var logoTexture = resCache.GetResource<TextureResource>("/Textures/Logo/logo.png");
var logoTexture = resCache.GetResource<TextureResource>("/Textures/Logo/logo-ru.png");
Logo.Texture = logoTexture;

var currentUserName = configMan.GetCVar(CVars.PlayerName);
Expand Down
47 changes: 46 additions & 1 deletion Content.Server/Chat/Managers/ChatSanitizationManager.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Text.RegularExpressions;
using Content.Shared.CCVar;
using Robust.Shared.Configuration;

Expand Down Expand Up @@ -93,10 +94,51 @@ public sealed class ChatSanitizationManager : IChatSanitizationManager
{ "[':", "chatsan-tearfully-smiles" },
{ "('=", "chatsan-tearfully-smiles" },
{ "['=", "chatsan-tearfully-smiles" },
// Corvax-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" },
{ "дрочит", "молится" },
{ "ебет", "молится" },
{ "ебёт", "молится" },
{ "трахает", "молится" },
{ "срёт", "молится" },
{ "срет", "молится" },
{ "ссыт", "молится" },
{ "обоссал", "помолился" },
{ "зигует", "бьёт себя по лицу" },
{ "зиганул", "бьёт себя по лицу" },
{ "кинул плотную", "бьёт себя по лицу" },
{ "кинул потную", "бьёт себя по лицу" },
// Corvax-Localization-End
};

private bool _doSanitize;

// Anti-Goida
private static readonly Regex GoydaRegex = new(@"[ГгGg][ОоOo]+[ЙйYy][ДдDd][АаAa]", RegexOptions.Compiled | RegexOptions.IgnoreCase);

public void Initialize()
{
_configurationManager.OnValueChanged(CCVars.ChatSanitizerEnabled, x => _doSanitize = x, true);
Expand All @@ -113,6 +155,9 @@ public bool TrySanitizeOutSmilies(string input, EntityUid speaker, out string sa

input = input.TrimEnd();

// Apply Anti-Goida filter
input = GoydaRegex.Replace(input, "Я долбоёб");

foreach (var (smiley, replacement) in SmileyToEmote)
{
if (input.EndsWith(smiley, true, CultureInfo.InvariantCulture))
Expand All @@ -127,4 +172,4 @@ public bool TrySanitizeOutSmilies(string input, EntityUid speaker, out string sa
emote = null;
return false;
}
}
}
1 change: 1 addition & 0 deletions Content.Server/Doors/Systems/AirlockSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ private void OnAirlockInit(EntityUid uid, AirlockComponent component, ComponentI
if (TryComp<ApcPowerReceiverComponent>(uid, out var receiverComponent))
{
Appearance.SetData(uid, DoorVisuals.Powered, receiverComponent.Powered);
Appearance.SetData(uid, DoorVisuals.ClosedLights, true); // Corvax-Resprite-Airlocks
}
}

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"
" Гав!", " ГАВ", " вуф-вуф" // Corvax-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" },
//Corvax-Localization-Start
{ "га", "гаф" },
{ "Га", "Гаф" },
{ "угу", "вуф" },
{ "Угу", "Вуф" },
//Corvax-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");
//Corvax-Localization-Start
.Replace("l", "r").Replace("L", "R")
.Replace("л", "р").Replace("Л", "Р");
//Corvax-Localization-End
}

private void OnAccent(EntityUid uid, BarkAccentComponent component, AccentGetEvent args)
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-б-вд-к-лмн-прст]", // Corvax-Localization
RegexOptions.Compiled | RegexOptions.IgnoreCase);

public override void Initialize()
Expand Down
26 changes: 13 additions & 13 deletions Content.Server/_NF/GameRule/NfAdventureRuleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ private void OnStartup(RoundStartingEvent ev)
}))
{
var meta = EnsureComp<MetaDataComponent>(depotUids[0]);
_meta.SetEntityName(depotUids[0], "Cargo Depot A", meta);
_meta.SetEntityName(depotUids[0], "Грузовое Депо A", meta); // Corvax RU
_shuttle.SetIFFColor(depotUids[0], depotColor);
}

Expand All @@ -150,7 +150,7 @@ private void OnStartup(RoundStartingEvent ev)
}))
{
var meta = EnsureComp<MetaDataComponent>(depotUid3s[0]);
_meta.SetEntityName(depotUid3s[0], "Cargo Depot B", meta);
_meta.SetEntityName(depotUid3s[0], "Грузовое Депо Б", meta); // Corvax RU
_shuttle.SetIFFColor(depotUid3s[0], depotColor);
}

Expand All @@ -167,7 +167,7 @@ private void OnStartup(RoundStartingEvent ev)
}

var meta = EnsureComp<MetaDataComponent>(nfsdUids[0]);
_meta.SetEntityName(nfsdUids[0], "NFSD Outpost", meta);
_meta.SetEntityName(nfsdUids[0], "Аванпост ДСБФ", meta); // Corvax RU
_shuttle.SetIFFColor(nfsdUids[0], new Color(1f, 0.2f, 0.2f));
}

Expand All @@ -177,7 +177,7 @@ private void OnStartup(RoundStartingEvent ev)
}))
{
var meta = EnsureComp<MetaDataComponent>(depotUid2s[0]);
_meta.SetEntityName(depotUid2s[0], "Tinnia's Rest", meta);
_meta.SetEntityName(depotUid2s[0], "Ресторан Тринньки", meta); // Corvax RU
_shuttle.SetIFFColor(depotUid2s[0], factionColor);
}

Expand All @@ -187,7 +187,7 @@ private void OnStartup(RoundStartingEvent ev)
}))
{
var meta = EnsureComp<MetaDataComponent>(churchUids[0]);
_meta.SetEntityName(churchUids[0], "Omnichurch Beacon", meta);
_meta.SetEntityName(churchUids[0], "Маяк ВсеЦеркви", meta); // Corvax RU
_shuttle.SetIFFColor(churchUids[0], factionColor);
}

Expand All @@ -202,7 +202,7 @@ private void OnStartup(RoundStartingEvent ev)
}

var meta = EnsureComp<MetaDataComponent>(lpbravoUids[0]);
_meta.SetEntityName(lpbravoUids[0], "Listening Point Bravo", meta);
_meta.SetEntityName(lpbravoUids[0], "Прослушивающий пункт Браво", meta); // Corvax RU
_shuttle.SetIFFColor(lpbravoUids[0], lpbravoColor);
_shuttle.AddIFFFlag(lpbravoUids[0], IFFFlags.HideLabel);
}
Expand All @@ -223,7 +223,7 @@ private void OnStartup(RoundStartingEvent ev)
}))
{
var meta = EnsureComp<MetaDataComponent>(depotUid5s[0]);
_meta.SetEntityName(depotUid5s[0], "The Pit", meta);
_meta.SetEntityName(depotUid5s[0], "Яма", meta); // Corvax RU
_shuttle.SetIFFColor(depotUid5s[0], civilianColor);
}

Expand All @@ -238,7 +238,7 @@ private void OnStartup(RoundStartingEvent ev)
}

var meta = EnsureComp<MetaDataComponent>(depotUid6s[0]);
_meta.SetEntityName(depotUid6s[0], "Pirate's Cove", meta);
_meta.SetEntityName(depotUid6s[0], "Пиратская Бухта", meta); // Corvax RU
_shuttle.SetIFFColor(depotUid6s[0], lpbravoColor);
_shuttle.AddIFFFlag(depotUid6s[0], IFFFlags.HideLabel);
}
Expand All @@ -254,7 +254,7 @@ private void OnStartup(RoundStartingEvent ev)
}

var meta = EnsureComp<MetaDataComponent>(lodgeUids[0]);
_meta.SetEntityName(lodgeUids[0], "Expeditionary Lodge", meta);
_meta.SetEntityName(lodgeUids[0], "Экспедиционная База", meta); // Corvax RU
_shuttle.SetIFFColor(lodgeUids[0], civilianColor);
}

Expand All @@ -264,7 +264,7 @@ private void OnStartup(RoundStartingEvent ev)
}))
{
var meta = EnsureComp<MetaDataComponent>(caseyUids[0]);
_meta.SetEntityName(caseyUids[0], "Crazy Casey's Casino", meta);
_meta.SetEntityName(caseyUids[0], "Казино Чокнутого Джерри", meta); // Corvax RU
_shuttle.SetIFFColor(caseyUids[0], factionColor);
}

Expand All @@ -274,7 +274,7 @@ private void OnStartup(RoundStartingEvent ev)
}))
{
var meta = EnsureComp<MetaDataComponent>(griftyUids[0]);
_meta.SetEntityName(griftyUids[0], "Grifty's Gas and Grub", meta);
_meta.SetEntityName(griftyUids[0], "Заправка Зекинса", meta); // Corvax RU
_shuttle.SetIFFColor(griftyUids[0], factionColor);
}

Expand All @@ -292,7 +292,7 @@ private void OnStartup(RoundStartingEvent ev)
}))
{
var meta = EnsureComp<MetaDataComponent>(labUids[0]);
_meta.SetEntityName(labUids[0], "Anomalous Laboratory", meta);
_meta.SetEntityName(labUids[0], "Ксеноархеологическая Лаборатория", meta); // Corvax RU
_shuttle.SetIFFColor(labUids[0], factionColor);
}

Expand All @@ -306,7 +306,7 @@ private void OnStartup(RoundStartingEvent ev)
_station.InitializeNewStation(stationProto.Stations["Trade"], tradeUids);
}
var meta = EnsureComp<MetaDataComponent>(tradeUids[0]);
_meta.SetEntityName(tradeUids[0], "Trade Outpost", meta);
_meta.SetEntityName(tradeUids[0], "Торговый Аванпост", meta); // Corvax RU
_shuttle.SetIFFColor(tradeUids[0], depotColor);
}

Expand Down
17 changes: 15 additions & 2 deletions Content.Shared/Humanoid/NamingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,22 @@ public string GetFirstName(SpeciesPrototype speciesProto, Gender? gender = null)
}
}

public string GetLastName(SpeciesPrototype speciesProto)
// Corvax-LastnameGender-Start: Added custom gender split logic
public string GetLastName(SpeciesPrototype speciesProto, Gender? gender = null)
{
return _random.Pick(_prototypeManager.Index<DatasetPrototype>(speciesProto.LastNames).Values);
switch (gender)
{
case Gender.Male:
return _random.Pick(_prototypeManager.Index<DatasetPrototype>(speciesProto.MaleLastNames).Values);
case Gender.Female:
return _random.Pick(_prototypeManager.Index<DatasetPrototype>(speciesProto.FemaleLastNames).Values);
default:
if (_random.Prob(0.5f))
return _random.Pick(_prototypeManager.Index<DatasetPrototype>(speciesProto.MaleLastNames).Values);
else
return _random.Pick(_prototypeManager.Index<DatasetPrototype>(speciesProto.FemaleLastNames).Values);
}
}
// Corvax-LastnameGender-End
}
}
7 changes: 6 additions & 1 deletion Content.Shared/Humanoid/Prototypes/SpeciesPrototype.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,13 @@ public sealed partial class SpeciesPrototype : IPrototype
[DataField]
public string FemaleFirstNames { get; private set; } = "names_first_female";

// Corvax-LastnameGender-Start: Split lastname field by gender
[DataField]
public string LastNames { get; private set; } = "names_last";
public string MaleLastNames { get; private set; } = "names_last_male";

[DataField]
public string FemaleLastNames { get; private set; } = "names_last_female";
// Corvax-LastnameGender-End

[DataField]
public SpeciesNaming Naming { get; private set; } = SpeciesNaming.FirstLast;
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"; // Corvax-Localization
private const string FallbackCulture = "en-US"; // Corvax-Localization

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

_loc.LoadCulture(culture);
_loc.LoadCulture(fallbackCulture); // Corvax-Localization
_loc.SetFallbackCluture(fallbackCulture); // Corvax-Localization
_loc.AddFunction(culture, "PRESSURE", FormatPressure);
_loc.AddFunction(culture, "POWERWATTS", FormatPowerWatts);
_loc.AddFunction(culture, "POWERJOULES", FormatPowerJoules);
Expand All @@ -36,6 +40,7 @@ public void Initialize()
_loc.AddFunction(culture, "LOC", FormatLoc);
_loc.AddFunction(culture, "NATURALFIXED", FormatNaturalFixed);
_loc.AddFunction(culture, "NATURALPERCENT", FormatNaturalPercent);
_loc.AddFunction(culture, "MANY", FormatMany); // Corvax-Localization


/*
Expand Down
5 changes: 3 additions & 2 deletions 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("[^а-яА-Яa-zA-Z-'0-9\\ ]"); // Corvax-Localization
private static readonly Regex ICNameCaseRegex = new(@"^(?<word>\w)|\b(?<word>\w)(?=\w*$)");

public const int MaxNameLength = 32;
Expand Down Expand Up @@ -539,7 +539,7 @@ public void EnsureValid(ICommonSession session, IDependencyCollection collection

if (configManager.GetCVar(CCVars.RestrictedNames))
{
name = Regex.Replace(name, @"[^\u0041-\u005A,\u0061-\u007A,\u00C0-\u00D6,\u00D8-\u00F6,\u00F8-\u00FF,\u0100-\u017F, -]", string.Empty);
//name = Regex.Replace(name, @"[^\u0041-\u005A,\u0061-\u007A,\u00C0-\u00D6,\u00D8-\u00F6,\u00F8-\u00FF,\u0100-\u017F, -]", string.Empty);
/*
* 0041-005A Basic Latin: Uppercase Latin Alphabet
* 0061-007A Basic Latin: Lowercase Latin Alphabet
Expand All @@ -548,6 +548,7 @@ public void EnsureValid(ICommonSession session, IDependencyCollection collection
* 00F8-00FF Latin-1 Supplement: Letters III
* 0100-017F Latin Extended A: European Latin
*/
name = RestrictedNameRegex.Replace(name, string.Empty);
}

if (configManager.GetCVar(CCVars.ICNameCase))
Expand Down
2 changes: 1 addition & 1 deletion Resources/Locale/en-US/deltav/traits/traits.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ trait-ultravision-desc = Whether through custom bionic eyes, random mutation,
trait-deuteranopia-name = Deuteranopia
trait-deuteranopia-desc = Whether through custom bionic eyes, random mutation,
or being a Vulpkanin, you have redgreen colour blindness.
or being a Vulpkanin, you have red-green colour blindness.
trait-uncloneable-name = Uncloneable
trait-uncloneable-desc = Cannot be cloned
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
ent-OrganGoblinBrain = brain
.desc = The source of your woes.
.suffix = Goblin
ent-OrganGoblinEyes = eyes
.suffix = Goblin
.desc = { ent-OrganHumanEyes.desc }
ent-OrganGoblinTongue = tongue
.suffix = Goblin
.desc = { ent-OrganHumanTongue.desc }
ent-OrganGoblinAppendix = appendix
.suffix = Goblin
.desc = { ent-OrganHumanAppendix.desc }
ent-OrganGoblinEars = ears
.suffix = Goblin
.desc = { ent-OrganHumanEars.desc }
ent-OrganGoblinLungs = lungs
.desc = They breathe business.
.suffix = Goblin
ent-OrganGoblinHeart = heart
.suffix = Goblin
.desc = { ent-OrganHumanHeart.desc }
ent-OrganGoblinStomach = stomach
.desc = Shrooms go in here.
.suffix = Goblin
ent-OrganGoblinLiver = liver
.suffix = Goblin
.desc = { ent-OrganHumanLiver.desc }
ent-OrganGoblinKidneys = kidneys
.suffix = Goblin
.desc = { ent-OrganHumanKidneys.desc }
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ent-OrganSyntheticHeart = synthetic heart
.desc = Whirrs and pumps blood.
ent-OrganSyntheticLiver = synthetic liver
.desc = Filters toxins from the bloodstream at higher rate than old 'ganic liver.
ent-OrganSyntheticKidneys = synthetic kidneys
.desc = Filters toxins from the bloodstream at higher rate than old 'ganic liver.
Loading

0 comments on commit d4f90c9

Please sign in to comment.