From 7e21e00c99e888a48193b99a4b66aa5e94ebb904 Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Tue, 30 May 2017 16:27:48 +0100 Subject: [PATCH 1/2] Translate src/components/structures --- .../structures/CompatibilityPage.js | 35 +++++++++++++------ src/components/structures/RightPanel.js | 4 +-- src/components/structures/RoomDirectory.js | 6 ++-- src/components/structures/SearchBox.js | 4 +-- src/i18n/strings/en_EN.json | 8 ++++- 5 files changed, 39 insertions(+), 18 deletions(-) diff --git a/src/components/structures/CompatibilityPage.js b/src/components/structures/CompatibilityPage.js index bae33803aa..88b01cb2bb 100644 --- a/src/components/structures/CompatibilityPage.js +++ b/src/components/structures/CompatibilityPage.js @@ -17,6 +17,7 @@ limitations under the License. 'use strict'; var React = require('react'); +import { _t, _tJsx } from 'matrix-react-sdk/lib/languageHandler'; module.exports = React.createClass({ displayName: 'CompatibilityPage', @@ -39,23 +40,37 @@ module.exports = React.createClass({ return (
-

Sorry, your browser is not able to run Riot.

+

{ _tJsx("Sorry, your browser is not able to run Riot.", /(.*?)<\/b>/, (sub) => {sub}) }

- Riot uses many advanced browser features, some of which are not - available or experimental in your current browser. + { _t("Riot uses many advanced browser features, some of which are not available or experimental in your current browser.") }

- Please install Chrome or Firefox for - the best experience. Safari and Opera work too. + { _tJsx('Please install Chrome or Firefox for the best experience.', + [ + /(.*?)<\/a>/, + /(.*?)<\/a>/, + ], + [ + (sub) => {sub}, + (sub) => {sub}, + ] + )} + { _tJsx('Safari and Opera work too.', + [ + /(.*?)<\/a>/, + /(.*?)<\/a>/, + ], + [ + (sub) => {sub}, + (sub) => {sub}, + ] + )}

- With your current browser, the look and feel of the application may - be completely incorrect, and some or all features may not function. - If you want to try it anyway you can continue, but you are on your own - in terms of any issues you may encounter! + { _t("With your current browser, the look and feel of the application may be completely incorrect, and some or all features may not function. If you want to try it anyway you can continue, but you are on your own in terms of any issues you may encounter!") }

diff --git a/src/components/structures/RightPanel.js b/src/components/structures/RightPanel.js index c7f5394bf1..b4b82cfaef 100644 --- a/src/components/structures/RightPanel.js +++ b/src/components/structures/RightPanel.js @@ -93,7 +93,7 @@ module.exports = React.createClass({ var NeedToRegisterDialog = sdk.getComponent("dialogs.NeedToRegisterDialog"); Modal.createDialog(NeedToRegisterDialog, { title: _t('Please Register'), - description: _t('Guest users can\'t invite users. Please register to invite') + '.' + description: _t('Guest users can\'t invite users. Please register to invite.') }); return; } @@ -218,7 +218,7 @@ module.exports = React.createClass({ { notificationsHighlight } -
+
; diff --git a/src/components/structures/RoomDirectory.js b/src/components/structures/RoomDirectory.js index e935084742..257fdbd5cd 100644 --- a/src/components/structures/RoomDirectory.js +++ b/src/components/structures/RoomDirectory.js @@ -213,11 +213,11 @@ module.exports = React.createClass({ var Loader = sdk.getComponent("elements.Spinner"); var modal = Modal.createDialog(Loader); - var step = _t('remove %(name)s from the directory', {name: name}) + '.'; + var step = _t('remove %(name)s from the directory.', {name: name}); MatrixClientPeg.get().setRoomDirectoryVisibility(room.room_id, 'private').then(() => { if (!alias) return; - step = _t('delete the alias') + '.'; + step = _t('delete the alias.'); return MatrixClientPeg.get().deleteAlias(alias); }).done(() => { modal.close(); @@ -356,7 +356,7 @@ module.exports = React.createClass({ var NeedToRegisterDialog = sdk.getComponent("dialogs.NeedToRegisterDialog"); Modal.createDialog(NeedToRegisterDialog, { title: _t('Failed to join the room'), - description: _t('This room is inaccessible to guests. You may be able to join if you register') + '.' + description: _t('This room is inaccessible to guests. You may be able to join if you register.') }); return; } diff --git a/src/components/structures/SearchBox.js b/src/components/structures/SearchBox.js index faee0b5f71..99c4486690 100644 --- a/src/components/structures/SearchBox.js +++ b/src/components/structures/SearchBox.js @@ -100,13 +100,13 @@ module.exports = React.createClass({ if (this.props.collapsed) { toggleCollapse = - + } else { toggleCollapse = - + } diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 039f5b76d3..7f1b8bf4c5 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -1,4 +1,5 @@ { + "Safari and Opera work too.": "Safari and Opera work too.", "Add an email address above to configure email notifications": "Add an email address above to configure email notifications", "Advanced notification settings": "Advanced notification settings", "All messages": "All messages", @@ -48,6 +49,7 @@ " from room": " from room", "Guests can join": "Guests can join", "Guest users can't invite users. Please register to invite": "Guest users can't invite users. Please register to invite", + "I understand the risks and wish to continue": "I understand the risks and wish to continue", "Invite to this room": "Invite to this room", "Keywords": "Keywords", "Leave": "Leave", @@ -72,6 +74,7 @@ "On": "On", "Operation failed": "Operation failed", "Permalink": "Permalink", + "Please install Chrome or Firefox for the best experience.": "Please install Chrome or Firefox for the best experience.", "Please Register": "Please Register", "powered by Matrix": "powered by Matrix", "Quote": "Quote", @@ -83,11 +86,13 @@ "Remove from Directory": "Remove from Directory", "Resend": "Resend", "Riot does not know how to join a room on this network": "Riot does not know how to join a room on this network", + "Riot uses many advanced browser features, some of which are not available or experimental in your current browser.": "Riot uses many advanced browser features, some of which are not available or experimental in your current browser.", "Room directory": "Room directory", "Room not found": "Room not found", "Search for a room": "Search for a room", "Settings": "Settings", "Source URL": "Source URL", + "Sorry, your browser is not able to run Riot.": "Sorry, your browser is not able to run Riot.", "Start chat": "Start chat", "The Home Server may be too old to support third party networks": "The Home Server may be too old to support third party networks", "There are advanced notifications which are not shown here": "There are advanced notifications which are not shown here", @@ -118,5 +123,6 @@ "Saturday": "Saturday", "Today": "Today", "Yesterday": "Yesterday", - "Welcome page": "Welcome page" + "Welcome page": "Welcome page", + "With your current browser, the look and feel of the application may be completely incorrect, and some or all features may not function. If you want to try it anyway you can continue, but you are on your own in terms of any issues you may encounter!": "With your current browser, the look and feel of the application may be completely incorrect, and some or all features may not function. If you want to try it anyway you can continue, but you are on your own in terms of any issues you may encounter!" } From 1b4444cc73ef78de69c20bf96f2bffb1f991d251 Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Tue, 30 May 2017 16:30:56 +0100 Subject: [PATCH 2/2] Add missing translations --- src/i18n/strings/en_EN.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 7f1b8bf4c5..4f3467ae0b 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -10,6 +10,7 @@ "Cancel Sending": "Cancel Sending", "Can't update user notification settings": "Can't update user notification settings", "Close": "Close", + "Collapse panel": "Collapse panel", "Create new room": "Create new room", "Couldn't find a matching Matrix room": "Couldn't find a matching Matrix room", "Custom Server Options": "Custom Server Options", @@ -30,6 +31,7 @@ "Error": "Error", "Error saving email notification preferences": "Error saving email notification preferences", "#example": "#example", + "Expand panel": "Expand panel", "Failed to": "Failed to", "Failed to add tag %(tagName)s to room": "Failed to add tag %(tagName)s to room", "Failed to change settings": "Failed to change settings",