-
Notifications
You must be signed in to change notification settings - Fork 523
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
Languages update #671
Closed
Mnemotechnician
wants to merge
109
commits into
new-frontiers-14:master
from
Mnemotechnician:feat/languages
Closed
Languages update #671
Changes from all commits
Commits
Show all changes
109 commits
Select commit
Hold shift + click to select a range
3975678
Fix erase verb not removing chat messages in some cases (#21355)
DrSmugleaf 2285037
Removing vulp speak as a temp fix
dvir001 4693f3c
Update HeadsetSystem.cs
dvir001 d06fe5a
Update RadioSystem.cs
dvir001 4ee3c4e
Update ListeningSystem.cs
dvir001 e66adbc
Feat/languages: Initial commit (something works now)
Mnemotechnician 7503978
Rework everything, adding support for spoken/understood langs, as wel…
Mnemotechnician 0a61515
Minor fixes
Mnemotechnician 60632e2
Fix language checks in ChatSystem not accounting for language overrides
Mnemotechnician 57ffd0d
Outdated comments
Mnemotechnician 547a149
Oops. Missed a semicolon before pushing...
Mnemotechnician 648ae24
Remove obsolete API
Mnemotechnician eefa226
Split langsys into common and server systems
Mnemotechnician 9625489
Move stuff over to Content.Server.Language instead of Speech
Mnemotechnician 4832df8
Added commands related to languages
Mnemotechnician 98c8c34
Implement translators
Mnemotechnician f65f7e4
Remove entity system dependencies from commands, and do not listen on…
Mnemotechnician 266c838
I spent... 30 minutes... debugging this... only to change 1 line
Mnemotechnician b9ce39c
New obfuscation system. Still quite broken.
Mnemotechnician 53cc5ad
Hopefully fixed phrase obfuscation
Mnemotechnician 40284c3
fix the damn LANGUAGE PROTOTYPES!!!!!
Mnemotechnician 6d0b4ad
Make obfuscation different in each round
Mnemotechnician e714418
Merge remote-tracking branch 'newfrontiers/master' into feat/languages
Mnemotechnician 1858182
SolCommon (And test commit)
FoxxoTrystan fde54d9
Language Select Command
FoxxoTrystan c1185e3
MORE LANGUAGES!
FoxxoTrystan cec0d7f
Fixes
FoxxoTrystan 31bf9c3
Remove unused files
Mnemotechnician 50c97e5
Rework translators in a way that *seems* to work
Mnemotechnician 22c561a
Menu (WIP)
FoxxoTrystan 660e512
Merge branch 'feat/languages' of https://github.com/Mnemotechnician/f…
FoxxoTrystan 7306795
Translator File
FoxxoTrystan 9a9a842
Some template ui code for the language switcher
Mnemotechnician 286c025
Trystan why did you break this?..
Mnemotechnician 889c1f1
Split LanguageSystem in partials, fix some ui things
Mnemotechnician 1570cc2
New UI controller for the language menu action
Mnemotechnician eacfcc6
SCIENCE!
FoxxoTrystan 844559e
Merge branch 'feat/languages' of https://github.com/Mnemotechnician/f…
FoxxoTrystan 4e0fdda
Language update event
Mnemotechnician c7ac216
Moved stuff to more relevant packages
Mnemotechnician f7be705
First implementatiton of translator implanters
Mnemotechnician a16d9e5
Oops. Quick fix
Mnemotechnician c385f09
Update vending_machines.yml
FoxxoTrystan d736fcb
Merge branch 'feat/languages' of https://github.com/Mnemotechnician/f…
FoxxoTrystan 3c1057c
Finished Science / Translators
FoxxoTrystan e4e6e1d
Gives (Mostly) all NPC LangaugeSpeaker Component
FoxxoTrystan 51edfe9
CodeSpeak
FoxxoTrystan c11be22
Fix and finish implanters
Mnemotechnician 5d9b40a
Rename translator data fields
Mnemotechnician 6e5d9fa
Implemented visuals
Mnemotechnician f3d527b
Add missing stuff to the components
Mnemotechnician 1b2f57e
Woring Language Menu
FoxxoTrystan 76ae4cb
Update LanguageMenuWindow.xaml.cs
FoxxoTrystan 72156ea
Merge remote-tracking branch 'upstream/master' into pr/671
FoxxoTrystan 4272d8b
Broken mess, just to show, please dont use it AAA
FoxxoTrystan 574f459
Added language names and descriptions.
Mnemotechnician 5474fc5
Merge remote-tracking branch 'origin/feat/languages' into feat/languages
Mnemotechnician 45dde77
Fix what I just did
Mnemotechnician 3fefa62
Send LanguagesUpdateEvent upon successful implantation
Mnemotechnician 70d450e
Language menu improvements
Mnemotechnician 5fc308f
Made "make sentient" and cognizine give out a LanguageSpeakerComponent
Mnemotechnician 1b583cc
UI Nightmare
FoxxoTrystan d28fe81
Merge branch 'feat/languages' of https://github.com/Mnemotechnician/f…
FoxxoTrystan 926fd49
Update guardian.yml
FoxxoTrystan c2af6eb
Actually finished the language menu
Mnemotechnician bcac627
Translator Uses Power, KINDA...
FoxxoTrystan c1c0368
Update languages.ftl
FoxxoTrystan edd14b6
Merge branch 'feat/languages' of https://github.com/Mnemotechnician/f…
FoxxoTrystan 271a24d
Contravand CodeSpeak / Fixes
FoxxoTrystan 991dc0c
Fixes... again.
FoxxoTrystan 1c2632d
Hmm Drawrate fix
FoxxoTrystan 8f48707
Change the default language window size and margins
Mnemotechnician 149cd28
Refactor some yml files
Mnemotechnician 646a2a9
Fixed translator implant appearence
Mnemotechnician 73a7e15
Oops
Mnemotechnician 573cbe5
Finish Translator Power.
FoxxoTrystan 78854ec
Linter HAPPY!
FoxxoTrystan e98e663
Update Translator Sprite.
FoxxoTrystan 42078ca
Update languages.ftl
FoxxoTrystan 782c766
Update languages.ftl
FoxxoTrystan 49ee4b2
Adds Moffic Language
FoxxoTrystan 5464483
Update translator_implants.yml
FoxxoTrystan e8d4ce5
Added frontier comments
Mnemotechnician 81a8087
Revert "Update translator_implants.yml"
FoxxoTrystan 893ca83
Merge branch 'feat/languages' of https://github.com/Mnemotechnician/f…
FoxxoTrystan 6fad295
Missed a couple changes with my previous commit.
Mnemotechnician 731f3ee
Minor refactor
Mnemotechnician 5c4eff7
Pets can now understand GalacticCommon
FoxxoTrystan 1f2aa4c
Merge branch 'feat/languages' of https://github.com/Mnemotechnician/f…
FoxxoTrystan 3514e54
Merge remote-tracking branch 'upstream/master' into pr/671
FoxxoTrystan a8b91ea
Merge remote-tracking branch 'upstream/master' into pr/671
FoxxoTrystan 0094be3
Merge remote-tracking branch 'upstream/master' into pr/671
FoxxoTrystan 216159f
Shuffle files around
Mnemotechnician b7a5f90
Delete refrences to the long gone hardcoded vulp language
Mnemotechnician d6c88f7
Move the ui controller as well
Mnemotechnician c9ace81
Merge remote-tracking branch 'upstream/master' into pr/671
FoxxoTrystan 5052677
Merge remote-tracking branch 'newfrontiers/master' into feat/languages
Mnemotechnician 014b76d
Wa
Mnemotechnician 571b560
Merge remote-tracking branch 'origin/feat/languages' into feat/languages
Mnemotechnician 1f5dc56
Fix window flickering and increase the default window size
Mnemotechnician cd7e250
Added a language selector to the chat ui (kmp)
Mnemotechnician 800b7fa
Merge remote-tracking branch 'upstream/master' into feat/languages
FoxxoTrystan 6287ead
QOL - Language Menu
FoxxoTrystan 1750226
OnStateUpdate Update now LanguageSelector
FoxxoTrystan 2282345
Revert "OnStateUpdate Update now LanguageSelector"
FoxxoTrystan 6fc0831
Merge remote-tracking branch 'upstream/master' into pr/671
FoxxoTrystan 10bca44
Total refactor of the client-server interactions and client-side logic
Mnemotechnician 34de3a6
Typo
Mnemotechnician e91f7e1
Fixes for universal speakers (no more walls speaking GC)
Mnemotechnician File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<DefaultWindow xmlns="https://spacestation14.io" | ||
xmlns:ui="clr-namespace:Content.Client.UserInterface.Controls" | ||
Title="a" | ||
SetSize="300 300"> | ||
<BoxContainer Orientation="Vertical" SeparationOverride="4" MinWidth="150"> | ||
<PanelContainer Name="CurrentLanguageContainer" Access="Public" StyleClasses="PdaBorderRect"> | ||
<Label Name="CurrentLanguageLabel" Access="Public" Text="Current Language:" HorizontalExpand="True"></Label> | ||
</PanelContainer> | ||
|
||
<ui:HLine></ui:HLine> | ||
|
||
<ScrollContainer HorizontalExpand="True" VerticalExpand="True" HScrollEnabled="False" VScrollEnabled="True" MinHeight="50"> | ||
<BoxContainer Name="OptionsList" Access="Public" HorizontalExpand="True" SeparationOverride="2" Orientation="Vertical"> | ||
<!-- The rest here is generated programmatically --> | ||
</BoxContainer> | ||
</ScrollContainer> | ||
</BoxContainer> | ||
</DefaultWindow> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
using Content.Client.Language.Systems; | ||
using Content.Shared.Language; | ||
using Content.Shared.Language.Systems; | ||
using Robust.Client.AutoGenerated; | ||
using Robust.Client.UserInterface.Controls; | ||
using Robust.Client.UserInterface.CustomControls; | ||
using Robust.Client.UserInterface.XAML; | ||
using Robust.Shared.Console; | ||
using Robust.Shared.Utility; | ||
using static Content.Shared.Language.Systems.SharedLanguageSystem; | ||
|
||
namespace Content.Client._NF.Language; // This EXACT class must have the _NF part because of xaml linking | ||
|
||
[GenerateTypedNameReferences] | ||
public sealed partial class LanguageMenuWindow : DefaultWindow | ||
{ | ||
private readonly LanguageSystem _clientLanguageSystem; | ||
private readonly List<EntryState> _entries = new(); | ||
|
||
public LanguageMenuWindow() | ||
{ | ||
RobustXamlLoader.Load(this); | ||
_clientLanguageSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<LanguageSystem>(); | ||
|
||
Title = Loc.GetString("language-menu-window-title"); | ||
} | ||
|
||
public void UpdateState(string currentLanguage, List<string> spokenLanguages) | ||
{ | ||
var langName = LanguagePrototype.GetLocalizedName(currentLanguage); | ||
CurrentLanguageLabel.Text = Loc.GetString("language-menu-current-language", ("language", langName ?? "<error>")); | ||
|
||
OptionsList.RemoveAllChildren(); | ||
_entries.Clear(); | ||
|
||
foreach (var language in spokenLanguages) | ||
{ | ||
AddLanguageEntry(language); | ||
} | ||
|
||
// Disable the button for the currently chosen language | ||
foreach (var entry in _entries) | ||
{ | ||
if (entry.button != null) | ||
entry.button.Disabled = entry.language == currentLanguage; | ||
} | ||
} | ||
|
||
private void AddLanguageEntry(string language) | ||
{ | ||
var proto = _clientLanguageSystem.GetLanguage(language); | ||
var state = new EntryState { language = language }; | ||
|
||
var container = new BoxContainer(); | ||
container.Orientation = BoxContainer.LayoutOrientation.Vertical; | ||
|
||
// Create and add a header with the name and the button to select the language | ||
{ | ||
var header = new BoxContainer(); | ||
header.Orientation = BoxContainer.LayoutOrientation.Horizontal; | ||
|
||
header.Orientation = BoxContainer.LayoutOrientation.Horizontal; | ||
header.HorizontalExpand = true; | ||
header.SeparationOverride = 2; | ||
|
||
var name = new Label(); | ||
name.Text = proto?.LocalizedName ?? "<error>"; | ||
name.MinWidth = 50; | ||
name.HorizontalExpand = true; | ||
|
||
var button = new Button(); | ||
button.Text = "Choose"; | ||
button.OnPressed += _ => OnLanguageChosen(language); | ||
state.button = button; | ||
|
||
header.AddChild(name); | ||
header.AddChild(button); | ||
|
||
container.AddChild(header); | ||
} | ||
|
||
// Create and add a collapsible description | ||
{ | ||
var body = new CollapsibleBody(); | ||
body.HorizontalExpand = true; | ||
body.Margin = new Thickness(4f, 4f); | ||
|
||
var description = new RichTextLabel(); | ||
description.SetMessage(proto?.LocalizedDescription ?? "<error>"); | ||
description.HorizontalExpand = true; | ||
|
||
body.AddChild(description); | ||
|
||
var collapser = new Collapsible(Loc.GetString("language-menu-description-header"), body); | ||
collapser.Orientation = BoxContainer.LayoutOrientation.Vertical; | ||
collapser.HorizontalExpand = true; | ||
|
||
container.AddChild(collapser); | ||
} | ||
|
||
// Before adding, wrap the new container in a PanelContainer to give it a distinct look | ||
var wrapper = new PanelContainer(); | ||
wrapper.StyleClasses.Add("PdaBorderRect"); | ||
|
||
wrapper.AddChild(container); | ||
OptionsList.AddChild(wrapper); | ||
|
||
_entries.Add(state); | ||
} | ||
|
||
private void OnLanguageChosen(string id) | ||
{ | ||
var proto = _clientLanguageSystem.GetLanguage(id); | ||
if (proto != null) | ||
_clientLanguageSystem.RequestSetLanguage(proto); | ||
} | ||
|
||
private struct EntryState | ||
{ | ||
public string language; | ||
public Button? button; | ||
} | ||
} |
102 changes: 102 additions & 0 deletions
102
Content.Client/_NF/Language/Systems/Chat/Controls/LanguageSelectorButton.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
using System.Linq; | ||
using System.Numerics; | ||
using Content.Client.Language.Systems; | ||
using Content.Client.UserInterface.Systems.Chat.Controls; | ||
using Content.Client.UserInterface.Systems.Language; | ||
using Content.Shared.Language; | ||
using Robust.Client.UserInterface; | ||
using Robust.Shared.Utility; | ||
|
||
namespace Content.Client._NF.Language.Systems.Chat.Controls; | ||
|
||
// Mostly copied from ChannelSelectorButton | ||
public sealed class LanguageSelectorButton : ChatPopupButton<LanguageSelectorPopup> | ||
{ | ||
public LanguagePrototype? SelectedLanguage { get; private set; } | ||
|
||
private const int SelectorDropdownOffset = 38; | ||
|
||
public LanguageSelectorButton() | ||
{ | ||
Name = "LanguageSelector"; | ||
|
||
Popup.Selected += Select; | ||
|
||
if (Popup.FirstLanguage is { } firstSelector) | ||
{ | ||
Select(firstSelector); | ||
} | ||
|
||
IoCManager.Resolve<IUserInterfaceManager>().GetUIController<LanguageMenuUIController>().LanguagesUpdatedHook += UpdateLanguage; | ||
} | ||
|
||
private void UpdateLanguage((string current, List<string> spoken, List<string> understood) args) | ||
{ | ||
Popup.SetLanguages(args.spoken); | ||
|
||
// Kill me please | ||
SelectedLanguage = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<LanguageSystem>().GetLanguage(args.current); | ||
Text = LanguageSelectorName(SelectedLanguage!); | ||
} | ||
|
||
protected override UIBox2 GetPopupPosition() | ||
{ | ||
var globalLeft = GlobalPosition.X; | ||
var globalBot = GlobalPosition.Y + Height; | ||
return UIBox2.FromDimensions( | ||
new Vector2(globalLeft, globalBot), | ||
new Vector2(SizeBox.Width, SelectorDropdownOffset)); | ||
} | ||
|
||
public void Select(LanguagePrototype language) | ||
{ | ||
if (Popup.Visible) | ||
{ | ||
Popup.Close(); | ||
} | ||
|
||
if (SelectedLanguage == language) | ||
return; | ||
SelectedLanguage = language; | ||
IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<LanguageSystem>().RequestSetLanguage(language); | ||
|
||
Text = LanguageSelectorName(language); | ||
} | ||
|
||
public static string LanguageSelectorName(LanguagePrototype language, bool full = false) | ||
{ | ||
var name = language.LocalizedName; | ||
|
||
// if the language name is short enough, just return it | ||
if (full || name.Length < 5) | ||
return name; | ||
|
||
// If the language name is multi-word, collect first letters and capitalize them | ||
if (name.Contains(' ')) | ||
{ | ||
var result = name | ||
.Split(" ") | ||
.Select(it => it.FirstOrNull()) | ||
.Where(it => it != null) | ||
.Select(it => char.ToUpper(it!.Value)); | ||
|
||
return new string(result.ToArray()); | ||
} | ||
|
||
// Alternatively, take the first 5 letters | ||
return name[..5]; | ||
} | ||
|
||
// public Color ChannelSelectColor(ChatSelectChannel channel) | ||
// { | ||
// return channel switch | ||
// { | ||
// ChatSelectChannel.Radio => Color.LimeGreen, | ||
// ChatSelectChannel.LOOC => Color.MediumTurquoise, | ||
// ChatSelectChannel.OOC => Color.LightSkyBlue, | ||
// ChatSelectChannel.Dead => Color.MediumPurple, | ||
// ChatSelectChannel.Admin => Color.HotPink, | ||
// _ => Color.DarkGray | ||
// }; | ||
// } | ||
} |
28 changes: 28 additions & 0 deletions
28
Content.Client/_NF/Language/Systems/Chat/Controls/LanguageSelectorItemButton.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using Content.Client.Stylesheets; | ||
using Content.Client.UserInterface.Systems.Chat; | ||
using Content.Client.UserInterface.Systems.Chat.Controls; | ||
using Content.Shared.Chat; | ||
using Content.Shared.Language; | ||
using Robust.Client.UserInterface.Controls; | ||
|
||
namespace Content.Client._NF.Language.Systems.Chat.Controls; | ||
|
||
// Mostly copied from ChannelSelectorItemButton | ||
public sealed class LanguageSelectorItemButton : Button | ||
{ | ||
public readonly LanguagePrototype Language; | ||
|
||
public bool IsHidden => Parent == null; | ||
|
||
public LanguageSelectorItemButton(LanguagePrototype language) | ||
{ | ||
Language = language; | ||
AddStyleClass(StyleNano.StyleClassChatChannelSelectorButton); | ||
|
||
Text = LanguageSelectorButton.LanguageSelectorName(language, full: true); | ||
|
||
// var prefix = ChatUIController.ChannelPrefixes[selector]; | ||
// if (prefix != default) | ||
// Text = Loc.GetString("hud-chatbox-select-name-prefixed", ("name", Text), ("prefix", prefix)); | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this not be
using Content.Client._NF.Language;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
honestly, namespaces are fucked up here, _NF should be gone except in cases where it's absolutely needed (like .xaml.cs files)