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.
To begin satisfying space-wizards/space-station-14#5543, these changes allow for command localization to be automatically recognized if the correct keys are defined in the locale. This takes some heavy inspiration from how it was implemented for EntityPrototypes:
Additions:
ConsoleCommand
class, extends interface and overrides theDescription
andHelp
members.CommandLocData
record to house the localization data.Modifications:
GetCommandData()
, which fetches the fluent message from the locale and returns it for the abstract.I see that the
LocalizationManager
has been split between 3 partials, (main, Entity, and Fluent functions), but I didn't see a reason to add an entire separate partial just for one method, let me know if this is unwanted.I also just used the
[Dependency]
attribute to resolve the loc manager in the abstract, and didn't include a PostInject or anything like that, but I figured it was fine. Let me know if this is also problematic.Eventually I would think about changing over the reflection manager for console commands to look for the abstract rather than the interface, but for backwards compatibility I've left it unchanged for now. I'm working on a content-side to this PR that implements the new class and adds localization for all commands.
Thoughts?
Edit: meant to include that the message keys it looks for are of the format
cmd-<command>
, so for defining localization for thechangelog
command, it would becmd-changelog
with the value being the description, then the attribute.help
being the help localization.