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 {
|
||||
/// Create a plain message from your current chat mode and uuid.
|
||||
pub fn to_plain_msg(
|
||||
/// Create a message from your current chat mode and uuid
|
||||
pub fn to_msg(
|
||||
&self,
|
||||
from: Uid,
|
||||
text: impl ToString,
|
||||
content: Content,
|
||||
group: Option<Group>,
|
||||
) -> Result<UnresolvedChatMsg, &'static str> {
|
||||
) -> Result<UnresolvedChatMsg, Content> {
|
||||
let chat_type = match self {
|
||||
ChatMode::Tell(to) => ChatType::Tell(from, *to),
|
||||
ChatMode::Say => ChatType::Say(from),
|
||||
ChatMode::Region => ChatType::Region(from),
|
||||
ChatMode::Group => ChatType::Group(
|
||||
from,
|
||||
group.ok_or(
|
||||
"You tried sending a group message while not belonging to a group. Use /world \
|
||||
or /region to change your chat mode.",
|
||||
)?,
|
||||
group.ok_or(Content::localized("command-message-group-missing"))?,
|
||||
),
|
||||
ChatMode::Faction(faction) => ChatType::Faction(from, faction.clone()),
|
||||
ChatMode::World => ChatType::World(from),
|
||||
};
|
||||
|
||||
Ok(UnresolvedChatMsg {
|
||||
chat_type,
|
||||
content: Content::Plain(text.to_string()),
|
||||
})
|
||||
Ok(UnresolvedChatMsg { chat_type, content })
|
||||
}
|
||||
}
|
||||
|
||||
|
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
|
||||
.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 std::fmt;
|
||||
use vek::*;
|
||||
@ -9,6 +10,22 @@ pub enum LocationError<'a> {
|
||||
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> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match self {
|
||||
|
@ -21,7 +21,8 @@ use common::{
|
||||
misc::PortalData,
|
||||
object,
|
||||
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,
|
||||
link::{Is, Link, LinkHandle},
|
||||
@ -169,7 +170,7 @@ pub trait StateExt {
|
||||
entity: EcsEntity,
|
||||
dismount_volume: bool,
|
||||
f: impl for<'a> FnOnce(&'a mut comp::Pos) -> T,
|
||||
) -> Result<T, &'static str>;
|
||||
) -> Result<T, Content>;
|
||||
}
|
||||
|
||||
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
|
||||
// removed from the group?)
|
||||
|
||||
let reply = comp::ChatType::CommandError.into_plain_msg(
|
||||
"You are using group chat but do not belong to a group. Use /world or \
|
||||
/region to change chat.",
|
||||
);
|
||||
let reply = comp::ChatType::CommandError
|
||||
.into_msg(Content::localized("command-message-group-missing"));
|
||||
|
||||
let clients = ecs.read_storage::<Client>();
|
||||
if let Some(client) =
|
||||
@ -1260,7 +1259,7 @@ impl StateExt for State {
|
||||
entity: EcsEntity,
|
||||
dismount_volume: bool,
|
||||
f: impl for<'a> FnOnce(&'a mut comp::Pos) -> T,
|
||||
) -> Result<T, &'static str> {
|
||||
) -> Result<T, Content> {
|
||||
if dismount_volume {
|
||||
self.ecs().write_storage::<Is<VolumeRider>>().remove(entity);
|
||||
}
|
||||
@ -1299,7 +1298,10 @@ impl StateExt for State {
|
||||
maybe_pos = Some(pos.0);
|
||||
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 self
|
||||
|
@ -1,6 +1,6 @@
|
||||
use crate::client::Client;
|
||||
use common::{
|
||||
comp::{ChatMode, ChatType, Group, Player},
|
||||
comp::{ChatMode, ChatType, Content, Group, Player},
|
||||
event::{EventBus, ServerEvent},
|
||||
resources::Time,
|
||||
uid::Uid,
|
||||
@ -29,13 +29,17 @@ impl Sys {
|
||||
const CHAT_MODE_DEFAULT: &ChatMode = &ChatMode::default();
|
||||
let mode = chat_modes.get(entity).unwrap_or(CHAT_MODE_DEFAULT);
|
||||
// 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) => {
|
||||
server_emitter.emit(ServerEvent::Chat(message));
|
||||
},
|
||||
Err(error) => {
|
||||
client.send_fallible(ServerGeneral::ChatMsg(
|
||||
ChatType::CommandError.into_plain_msg(error),
|
||||
ChatType::CommandError.into_msg(error),
|
||||
));
|
||||
},
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user