mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
localize commands
This commit is contained in:
parent
94aa4ce8b1
commit
fd42b3f767
102
assets/voxygen/i18n/en/command.ftl
Normal file
102
assets/voxygen/i18n/en/command.ftl
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
command-no-permission = You don't have permisison to use '/{ $command_name }'
|
||||||
|
command-position-unavailable = Cannot get position for { $target }
|
||||||
|
command-player-role-unavailable = Cannot get administrator roles for { $target }
|
||||||
|
command-uid-unavailable = Cannot get uid for { $target }
|
||||||
|
command-area-not-found = Could not find area named { $area }
|
||||||
|
command-player-not-found = Player { $player } not found!
|
||||||
|
command-player-uuid-not-found = Player with UUID { $uuid } not found!
|
||||||
|
command-username-uuid-unavailable = Unable to determine UUID for username { $username }
|
||||||
|
command-uuid-username-unavailable = Unable to determine username for UUID { $uuid }
|
||||||
|
command-no-sudo = It's rude to impersonate people
|
||||||
|
command-entity-dead = Entity { $entity } is dead!
|
||||||
|
command-error-while-evaluating-request = Encountered an error while validating the request: { $error }
|
||||||
|
command-give-inventory-full = Player inventory full. Gave { $given } of { $total } items.
|
||||||
|
command-invalid-item = Invalid item: { $item }
|
||||||
|
command-invalid-block-kind = Invalid block kind { $kind }
|
||||||
|
command-nof-entities-at-least = Number of entities should be at least 1
|
||||||
|
command-nof-entities-less-than = Number of entities should be less than 50
|
||||||
|
command-entity-load-failed = Failed to load entity config: { $config }
|
||||||
|
command-spawned-entities-config = Spawned { $n } entities from config: { $config }
|
||||||
|
command-invalid-sprite = Invalid sprite kind: { $kind }
|
||||||
|
command-time-parse-too-large = { $n } is invalid, cannot be larger than 16 digits
|
||||||
|
command-time-parse-negative = { $n } is invalid, cannot be negative.
|
||||||
|
command-time-backwards = { $t } is before the current time, time cannot go backwards.
|
||||||
|
command-time-invalid = { $t } is not a valid time.
|
||||||
|
command-rtsim-purge-perms = You must be a real admin (not just a temporary admin) to purge rtsim data.
|
||||||
|
command-chunk-not-loaded = Chunk { $x }, { $y } not loaded
|
||||||
|
command-chunk-out-of-bounds = Chunk { $x }, { $y } not within map bounds
|
||||||
|
command-spawned-entity = Spawned entity with ID: { $id }
|
||||||
|
command-spawned-dummy = Spawned a training dummy
|
||||||
|
command-spawned-airship = Spawned an airship
|
||||||
|
command-spawned-campfire = Spawned a campfire
|
||||||
|
command-spawned-safezone = Spawned a safezone
|
||||||
|
command-volume-size-incorrect = Size has to be between 1 and 127.
|
||||||
|
command-volume-created = Created a volume
|
||||||
|
command-permit-build-given = You are now permitted to build in { $area }
|
||||||
|
command-permit-build-granted = Permission to build in { $area } granted
|
||||||
|
command-revoke-build-recv = Your permission to build in { $area } has been revoked
|
||||||
|
command-revoke-build = Permission to build in { $area } revoked
|
||||||
|
command-revoke-build-all = Your build permissions have been revoked.
|
||||||
|
command-revoked-all-build = All build permissions revoked
|
||||||
|
command-no-buid-perms = You do not have permission to build.
|
||||||
|
command-set-build-status = Toggled build mode { $mode ->
|
||||||
|
*[true] on
|
||||||
|
[false] off
|
||||||
|
}. { $mode ->
|
||||||
|
*[true] { $persistent ->
|
||||||
|
[true] Experimental terrain persistence is enabled. The server will attempt to persist
|
||||||
|
changes, but this is not guaranteed.
|
||||||
|
*[false] Changes will not be persisted when a chunk unloads.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
command-invalid-alignment = Invalid alignment: { $alignment }
|
||||||
|
command-kit-not-enough-slots = Inventory doesn't have enough slots
|
||||||
|
command-lantern-unequiped = Please equip a lantern first
|
||||||
|
command-lantern-adjusted = You adjusted { $color ->
|
||||||
|
*[false] flame strength.
|
||||||
|
[true] flame strength and color.
|
||||||
|
}
|
||||||
|
command-explosion-power-invalid = Explosion power { $more ->
|
||||||
|
*[true] must
|
||||||
|
[false] mustn't
|
||||||
|
} be more than { $power }
|
||||||
|
# Note: Do not translate "confirm" here
|
||||||
|
command-disconnectall-confirm = Please run the command again with the second argument of "confirm" to confirm that
|
||||||
|
you really want to disconnect all players from the server
|
||||||
|
command-invalid-skill-group = { $group } is not a skill group!
|
||||||
|
command-unknown = Unknown command
|
||||||
|
command-disabled-by-settings = Command disabled in server settings
|
||||||
|
command-battlemode-intown = You need to be in town to change battle mode!
|
||||||
|
command-battlemode-cooldown = Cooldown period active. Try again in { $cooldown } seconds
|
||||||
|
command-battlemode-available-modes = Available modes: pvp, pve
|
||||||
|
command-battlemode-same = Attempted to set the same battlemode
|
||||||
|
command-battlemode-updated = New battlemode: { $battlemode }
|
||||||
|
command-buff-unknown = Unknown buff: { $buff }
|
||||||
|
command-skillpreset-load-error = Error while loading presets
|
||||||
|
command-skillpreset-broken = Skill preset is broken
|
||||||
|
command-skillpreset-missing = Preset does not exist: { $preset }
|
||||||
|
command-location-invalid = Location name '{ $location }' is invalid. Names may only contain lowercase ASCII and
|
||||||
|
underscores
|
||||||
|
command-location-duplicate = Location '{ $location }' already exists, consider deleting it first
|
||||||
|
command-location-not-found = Location '{ $location }' does not exist
|
||||||
|
command-location-created = Created location '{ $location }'
|
||||||
|
command-location-deleted = Deleted location '{ $location }'
|
||||||
|
command-locations-empty = No locations currently exist
|
||||||
|
command-locations-list = Available locations: { $locations }
|
||||||
|
# Note: Do not translate these weather names
|
||||||
|
command-weather-valid-values = Valid values are 'clear', 'rain', 'wind', 'storm'
|
||||||
|
command-scale-set = Set scale to { $scale }
|
||||||
|
command-repaired-items = Repaired all equipped items
|
||||||
|
command-message-group-missing = You are using group chat but do not belong to a group. Use /world or
|
||||||
|
/region to change chat.
|
||||||
|
command-tell-request = { $sender } wants to talk to you.
|
||||||
|
|
||||||
|
# Unreachable/untestable but added for consistency
|
||||||
|
|
||||||
|
command-player-info-unavailable = Cannot get player information for { $target }
|
||||||
|
command-unimplemented-waypoint-spawn = Waypoint spawning is not implemented
|
||||||
|
command-unimplemented-teleporter-spawn = Teleporter spawning is not implemented
|
||||||
|
command-kit-inventory-unavailable = Could not get inventory
|
||||||
|
command-inventory-cant-fit-item = Can't fit item to inventory
|
||||||
|
# Emitted by /disconnect_all when you dont exist (?)
|
||||||
|
command-you-dont-exist = You do not exist, so you cannot use this command
|
@ -30,32 +30,26 @@ impl Component for ChatMode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl ChatMode {
|
impl ChatMode {
|
||||||
/// Create a plain message from your current chat mode and uuid.
|
/// Create a message from your current chat mode and uuid
|
||||||
pub fn to_plain_msg(
|
pub fn to_msg(
|
||||||
&self,
|
&self,
|
||||||
from: Uid,
|
from: Uid,
|
||||||
text: impl ToString,
|
content: Content,
|
||||||
group: Option<Group>,
|
group: Option<Group>,
|
||||||
) -> Result<UnresolvedChatMsg, &'static str> {
|
) -> Result<UnresolvedChatMsg, Content> {
|
||||||
let chat_type = match self {
|
let chat_type = match self {
|
||||||
ChatMode::Tell(to) => ChatType::Tell(from, *to),
|
ChatMode::Tell(to) => ChatType::Tell(from, *to),
|
||||||
ChatMode::Say => ChatType::Say(from),
|
ChatMode::Say => ChatType::Say(from),
|
||||||
ChatMode::Region => ChatType::Region(from),
|
ChatMode::Region => ChatType::Region(from),
|
||||||
ChatMode::Group => ChatType::Group(
|
ChatMode::Group => ChatType::Group(
|
||||||
from,
|
from,
|
||||||
group.ok_or(
|
group.ok_or(Content::localized("command-message-group-missing"))?,
|
||||||
"You tried sending a group message while not belonging to a group. Use /world \
|
|
||||||
or /region to change your chat mode.",
|
|
||||||
)?,
|
|
||||||
),
|
),
|
||||||
ChatMode::Faction(faction) => ChatType::Faction(from, faction.clone()),
|
ChatMode::Faction(faction) => ChatType::Faction(from, faction.clone()),
|
||||||
ChatMode::World => ChatType::World(from),
|
ChatMode::World => ChatType::World(from),
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(UnresolvedChatMsg {
|
Ok(UnresolvedChatMsg { chat_type, content })
|
||||||
chat_type,
|
|
||||||
content: Content::Plain(text.to_string()),
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1667,7 +1667,7 @@ pub fn handle_teleport_to_position(server: &mut Server, entity: EcsEntity, posit
|
|||||||
.state
|
.state
|
||||||
.position_mut(entity, true, |pos| pos.0 = position)
|
.position_mut(entity, true, |pos| pos.0 = position)
|
||||||
{
|
{
|
||||||
warn!("Failed to teleport entity: {error}");
|
warn!("Failed to teleport entity: {error:?}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
use common::comp::Content;
|
||||||
use hashbrown::HashMap;
|
use hashbrown::HashMap;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use vek::*;
|
use vek::*;
|
||||||
@ -9,6 +10,22 @@ pub enum LocationError<'a> {
|
|||||||
DoesNotExist(&'a str),
|
DoesNotExist(&'a str),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'a> From<LocationError<'a>> for Content {
|
||||||
|
fn from(value: LocationError<'a>) -> Self {
|
||||||
|
match value {
|
||||||
|
LocationError::InvalidName(location) => {
|
||||||
|
Content::localized_with_args("command-location-invalid", [("location", location)])
|
||||||
|
},
|
||||||
|
LocationError::DuplicateName(location) => {
|
||||||
|
Content::localized_with_args("command-location-duplicate", [("location", location)])
|
||||||
|
},
|
||||||
|
LocationError::DoesNotExist(location) => {
|
||||||
|
Content::localized_with_args("command-location-not-found", [("location", location)])
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<'a> fmt::Display for LocationError<'a> {
|
impl<'a> fmt::Display for LocationError<'a> {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
|
@ -21,7 +21,8 @@ use common::{
|
|||||||
misc::PortalData,
|
misc::PortalData,
|
||||||
object,
|
object,
|
||||||
skills::{GeneralSkill, Skill},
|
skills::{GeneralSkill, Skill},
|
||||||
ChatType, Group, Inventory, Item, LootOwner, Object, Player, Poise, Presence, PresenceKind,
|
ChatType, Content, Group, Inventory, Item, LootOwner, Object, Player, Poise, Presence,
|
||||||
|
PresenceKind,
|
||||||
},
|
},
|
||||||
effect::Effect,
|
effect::Effect,
|
||||||
link::{Is, Link, LinkHandle},
|
link::{Is, Link, LinkHandle},
|
||||||
@ -169,7 +170,7 @@ pub trait StateExt {
|
|||||||
entity: EcsEntity,
|
entity: EcsEntity,
|
||||||
dismount_volume: bool,
|
dismount_volume: bool,
|
||||||
f: impl for<'a> FnOnce(&'a mut comp::Pos) -> T,
|
f: impl for<'a> FnOnce(&'a mut comp::Pos) -> T,
|
||||||
) -> Result<T, &'static str>;
|
) -> Result<T, Content>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl StateExt for State {
|
impl StateExt for State {
|
||||||
@ -1082,10 +1083,8 @@ impl StateExt for State {
|
|||||||
// triggered if the message is sent in the same tick as the sender is
|
// triggered if the message is sent in the same tick as the sender is
|
||||||
// removed from the group?)
|
// removed from the group?)
|
||||||
|
|
||||||
let reply = comp::ChatType::CommandError.into_plain_msg(
|
let reply = comp::ChatType::CommandError
|
||||||
"You are using group chat but do not belong to a group. Use /world or \
|
.into_msg(Content::localized("command-message-group-missing"));
|
||||||
/region to change chat.",
|
|
||||||
);
|
|
||||||
|
|
||||||
let clients = ecs.read_storage::<Client>();
|
let clients = ecs.read_storage::<Client>();
|
||||||
if let Some(client) =
|
if let Some(client) =
|
||||||
@ -1260,7 +1259,7 @@ impl StateExt for State {
|
|||||||
entity: EcsEntity,
|
entity: EcsEntity,
|
||||||
dismount_volume: bool,
|
dismount_volume: bool,
|
||||||
f: impl for<'a> FnOnce(&'a mut comp::Pos) -> T,
|
f: impl for<'a> FnOnce(&'a mut comp::Pos) -> T,
|
||||||
) -> Result<T, &'static str> {
|
) -> Result<T, Content> {
|
||||||
if dismount_volume {
|
if dismount_volume {
|
||||||
self.ecs().write_storage::<Is<VolumeRider>>().remove(entity);
|
self.ecs().write_storage::<Is<VolumeRider>>().remove(entity);
|
||||||
}
|
}
|
||||||
@ -1299,7 +1298,10 @@ impl StateExt for State {
|
|||||||
maybe_pos = Some(pos.0);
|
maybe_pos = Some(pos.0);
|
||||||
res
|
res
|
||||||
})
|
})
|
||||||
.ok_or("Cannot get position for entity!");
|
.ok_or(Content::localized_with_args(
|
||||||
|
"command-position-unavailable",
|
||||||
|
[("target", "entity")],
|
||||||
|
));
|
||||||
|
|
||||||
if let Some(pos) = maybe_pos {
|
if let Some(pos) = maybe_pos {
|
||||||
if self
|
if self
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use crate::client::Client;
|
use crate::client::Client;
|
||||||
use common::{
|
use common::{
|
||||||
comp::{ChatMode, ChatType, Group, Player},
|
comp::{ChatMode, ChatType, Content, Group, Player},
|
||||||
event::{EventBus, ServerEvent},
|
event::{EventBus, ServerEvent},
|
||||||
resources::Time,
|
resources::Time,
|
||||||
uid::Uid,
|
uid::Uid,
|
||||||
@ -29,13 +29,17 @@ impl Sys {
|
|||||||
const CHAT_MODE_DEFAULT: &ChatMode = &ChatMode::default();
|
const CHAT_MODE_DEFAULT: &ChatMode = &ChatMode::default();
|
||||||
let mode = chat_modes.get(entity).unwrap_or(CHAT_MODE_DEFAULT);
|
let mode = chat_modes.get(entity).unwrap_or(CHAT_MODE_DEFAULT);
|
||||||
// Try sending the chat message
|
// Try sending the chat message
|
||||||
match mode.to_plain_msg(*from, message, groups.get(entity).copied()) {
|
match mode.to_msg(
|
||||||
|
*from,
|
||||||
|
Content::Plain(message),
|
||||||
|
groups.get(entity).copied(),
|
||||||
|
) {
|
||||||
Ok(message) => {
|
Ok(message) => {
|
||||||
server_emitter.emit(ServerEvent::Chat(message));
|
server_emitter.emit(ServerEvent::Chat(message));
|
||||||
},
|
},
|
||||||
Err(error) => {
|
Err(error) => {
|
||||||
client.send_fallible(ServerGeneral::ChatMsg(
|
client.send_fallible(ServerGeneral::ChatMsg(
|
||||||
ChatType::CommandError.into_plain_msg(error),
|
ChatType::CommandError.into_msg(error),
|
||||||
));
|
));
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user