From 614cf950b63fc64a15f51bf1324eb99bc764eda9 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Fri, 29 Sep 2017 14:45:00 -0600 Subject: [PATCH] Supply user-friendly labels for common events Signed-off-by: Travis Ralston --- src/components/views/rooms/RoomSettings.js | 15 ++++++++++++++- src/i18n/strings/en_EN.json | 5 +++++ src/i18n/strings/en_US.json | 5 +++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/components/views/rooms/RoomSettings.js b/src/components/views/rooms/RoomSettings.js index 942da9ba06..412f67fc23 100644 --- a/src/components/views/rooms/RoomSettings.js +++ b/src/components/views/rooms/RoomSettings.js @@ -35,6 +35,16 @@ function parseIntWithDefault(val, def) { return isNaN(res) ? def : res; } +const plEventsToLabels = { + // These will be translated for us later. + // TODO: _td() these when https://github.com/matrix-org/matrix-react-sdk/pull/1421 lands + "m.room.avatar": "To change the room's avatar, you must be a", + "m.room.name": "To change the room's name, you must be a", + "m.room.canonical_alias": "To change the room's main address, you must be a", + "m.room.history_visibility": "To change the room's history visibility, you must be a", + "m.room.power_levels": "To change the permissions in the room, you must be a", +}; + const BannedUser = React.createClass({ propTypes: { canUnban: React.PropTypes.bool, @@ -885,9 +895,12 @@ module.exports = React.createClass({ {Object.keys(events_levels).map(function(event_type, i) { + let label = plEventsToLabels[event_type]; + if (label) label = _t(label); + else label = _tJsx("To send events of type , you must be a", //, () => { event_type }); return (
- { _tJsx("To send events of type , you must be a", //, () => { event_type }) } + { label }
diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 8873b54091..6309e60e82 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -832,6 +832,11 @@ "To ban users, you must be a": "To ban users, you must be a", "To remove other users' messages, you must be a": "To remove other users' messages, you must be a", "To send events of type , you must be a": "To send events of type , you must be a", + "To change the room's avatar, you must be a": "To change the room's avatar, you must be a", + "To change the room's name, you must be a": "To change the room's name, you must be a", + "To change the room's main address, you must be a": "To change the room's main address, you must be a", + "To change the room's history visibility, you must be a": "To change the room's history visibility, you must be a", + "To change the permissions in the room, you must be a": "To change the permissions in the room, you must be a", "Error whilst fetching joined groups": "Error whilst fetching joined groups", "Featured Users:": "Featured Users:", "Edit Group": "Edit Group", diff --git a/src/i18n/strings/en_US.json b/src/i18n/strings/en_US.json index c3b3b6a1bc..7f99f7789c 100644 --- a/src/i18n/strings/en_US.json +++ b/src/i18n/strings/en_US.json @@ -656,6 +656,11 @@ "To ban users, you must be a": "To ban users, you must be a", "To remove other users' messages, you must be a": "To remove other users' messages, you must be a", "To send events of type , you must be a": "To send events of type , you must be a", + "To change the room's avatar, you must be a": "To change the room's avatar, you must be a", + "To change the room's name, you must be a": "To change the room's name, you must be a", + "To change the room's main address, you must be a": "To change the room's main address, you must be a", + "To change the room's history visibility, you must be a": "To change the room's history visibility, you must be a", + "To change the permissions in the room, you must be a": "To change the permissions in the room, you must be a", "This Home Server would like to make sure you are not a robot": "This Home Server would like to make sure you are not a robot", "Sign in with CAS": "Sign in with CAS", "Custom Server Options": "Custom Server Options",