Skip to content

Commit bac5ae8

Browse files
authored
Merge pull request element-hq#4119 from vector-im/kegan/translation-chimp
Translate src/vector
2 parents d988eb5 + 7dc55a9 commit bac5ae8

8 files changed

Lines changed: 31 additions & 15 deletions

File tree

‎src/i18n/strings/en_EN.json‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"%(appName)s via %(browserName)s on %(osName)s": "%(appName)s via %(browserName)s on %(osName)s",
23
"<a href=\"http://apple.com/safari\">Safari</a> and <a href=\"http://opera.com\">Opera</a> work too.": "<a href=\"http://apple.com/safari\">Safari</a> and <a href=\"http://opera.com\">Opera</a> work too.",
34
"Add an email address above to configure email notifications": "Add an email address above to configure email notifications",
45
"Advanced notification settings": "Advanced notification settings",
@@ -11,6 +12,8 @@
1112
"Can't update user notification settings": "Can't update user notification settings",
1213
"Close": "Close",
1314
"Collapse panel": "Collapse panel",
15+
"Collecting app version information": "Collecting app version information",
16+
"Collecting logs": "Collecting logs",
1417
"Create new room": "Create new room",
1518
"Couldn't find a matching Matrix room": "Couldn't find a matching Matrix room",
1619
"Custom Server Options": "Custom Server Options",
@@ -88,7 +91,9 @@
8891
"remove %(name)s from the directory": "remove %(name)s from the directory",
8992
"Remove from Directory": "Remove from Directory",
9093
"Resend": "Resend",
94+
"Riot Desktop on %(platformName)": "Riot Desktop on %(platformName)",
9195
"Riot does not know how to join a room on this network": "Riot does not know how to join a room on this network",
96+
"Riot is not supported on mobile web. Install the app?": "Riot is not supported on mobile web. Install the app?",
9297
"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.",
9398
"Room directory": "Room directory",
9499
"Room not found": "Room not found",
@@ -106,11 +111,14 @@
106111
"Unable to join network": "Unable to join network",
107112
"Unable to look up room ID from server": "Unable to look up room ID from server",
108113
"Unhide Preview": "Unhide Preview",
114+
"Unknown device": "Unknown device",
109115
"unknown error code": "unknown error code",
110116
"Unnamed room": "Unnamed room",
111117
"Uploaded on %(date)s by %(user)s": "Uploaded on %(date)s by %(user)s",
118+
"Uploading report": "Uploading report",
112119
"View Decrypted Source": "View Decrypted Source",
113120
"View Source": "View Source",
121+
"Waiting for response from server": "Waiting for response from server",
114122
"When I'm invited to a room": "When I'm invited to a room",
115123
"World readable": "World readable",
116124
"You cannot delete this image. (%(code)s)": "You cannot delete this image. (%(code)s)",
@@ -126,6 +134,7 @@
126134
"Saturday": "Saturday",
127135
"Today": "Today",
128136
"Yesterday": "Yesterday",
137+
"You need to be using HTTPS to place a screen-sharing call.": "You need to be using HTTPS to place a screen-sharing call.",
129138
"Welcome page": "Welcome page",
130139
"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!"
131140
}

‎src/i18n/strings/pt_BR.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
"Files": "Arquivos",
4343
"Filter room names": "Filtrar salas por título",
4444
"Forget": "Esquecer",
45+
"Forward Message": "Encaminhar",
4546
" from room": " da sala",
4647
"Guests can join": "Convidados podem entrar",
4748
"Guest users can't invite users. Please register to invite": "Usuários convidados não podem convidar outros usuários. Por gentileza se registre para enviar convites",

‎src/vector/index.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
</head>
3737
<body style="height: 100%;">
3838
<section id="matrixchat" style="height: 100%;"></section>
39-
<noscript>Sorry, Riot requires JavaScript to be enabled.</noscript>
39+
<noscript>Sorry, Riot requires JavaScript to be enabled.</noscript> <!-- TODO: Translate this? -->
4040
<% for (var i=0; i < htmlWebpackPlugin.files.js.length; i++) {
4141
// Not a particularly graceful way of not putting the indexeddb worker script
4242
// into the main page

‎src/vector/index.js‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,13 +245,13 @@ async function loadApp() {
245245

246246
if (!preventRedirect) {
247247
if (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) {
248-
if (confirm("Riot is not supported on mobile web. Install the app?")) {
248+
if (confirm(languageHandler._t("Riot is not supported on mobile web. Install the app?"))) {
249249
window.location = "https://itunes.apple.com/us/app/vector.im/id1083446067";
250250
return;
251251
}
252252
}
253253
else if (/Android/.test(navigator.userAgent)) {
254-
if (confirm("Riot is not supported on mobile web. Install the app?")) {
254+
if (confirm(languageHandler._t("Riot is not supported on mobile web. Install the app?"))) {
255255
window.location = "https://play.google.com/store/apps/details?id=im.vector.alpha";
256256
return;
257257
}
@@ -278,7 +278,6 @@ async function loadApp() {
278278
</div>, document.getElementById('matrixchat'));
279279
} else if (validBrowser) {
280280
UpdateChecker.start();
281-
282281
const MatrixChat = sdk.getComponent('structures.MatrixChat');
283282
window.matrixChat = ReactDOM.render(
284283
<MatrixChat

‎src/vector/platform/ElectronPlatform.js‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ limitations under the License.
1919

2020
import VectorBasePlatform from './VectorBasePlatform';
2121
import dis from 'matrix-react-sdk/lib/dispatcher';
22+
import { _t } from 'matrix-react-sdk/lib/languageHandler';
2223
import q from 'q';
2324
import electron, {remote, ipcRenderer} from 'electron';
2425

@@ -68,7 +69,7 @@ export default class ElectronPlatform extends VectorBasePlatform {
6869
}
6970

7071
getHumanReadableName(): string {
71-
return 'Electron Platform';
72+
return 'Electron Platform'; // no translation required: only used for analytics
7273
}
7374

7475
setNotificationCount(count: number) {
@@ -150,7 +151,7 @@ export default class ElectronPlatform extends VectorBasePlatform {
150151
}
151152

152153
getDefaultDeviceDisplayName(): string {
153-
return 'Riot Desktop on ' + platformFriendlyName();
154+
return _t('Riot Desktop on %(platformName)s', { platformName: platformFriendlyName() });
154155
}
155156

156157
screenCaptureErrorString(): ?string {

‎src/vector/platform/VectorBasePlatform.js‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ limitations under the License.
1818
*/
1919

2020
import BasePlatform from 'matrix-react-sdk/lib/BasePlatform';
21+
import { _t } from 'matrix-react-sdk/lib/languageHandler';
22+
2123
import Favico from 'favico.js';
2224

2325
/**
@@ -36,7 +38,7 @@ export default class VectorBasePlatform extends BasePlatform {
3638
}
3739

3840
getHumanReadableName(): string {
39-
return 'Vector Base Platform';
41+
return 'Vector Base Platform'; // no translation required: only used for analytics
4042
}
4143

4244
_updateFavicon() {
@@ -94,6 +96,6 @@ export default class VectorBasePlatform extends BasePlatform {
9496
* device Vector is running on
9597
*/
9698
getDefaultDeviceDisplayName(): string {
97-
return "Unknown device";
99+
return _t("Unknown device");
98100
}
99101
}

‎src/vector/platform/WebPlatform.js‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ limitations under the License.
2020
import VectorBasePlatform from './VectorBasePlatform';
2121
import request from 'browser-request';
2222
import dis from 'matrix-react-sdk/lib/dispatcher.js';
23+
import { _t } from 'matrix-react-sdk/lib/languageHandler';
2324
import q from 'q';
2425

2526
import url from 'url';
@@ -32,7 +33,7 @@ export default class WebPlatform extends VectorBasePlatform {
3233
}
3334

3435
getHumanReadableName(): string {
35-
return 'Web Platform';
36+
return 'Web Platform'; // no translation required: only used for analytics
3637
}
3738

3839
/**
@@ -159,13 +160,15 @@ export default class WebPlatform extends VectorBasePlatform {
159160
const appName = u.format();
160161

161162
const ua = new UAParser();
162-
return `${appName} via ${ua.getBrowser().name} on ${ua.getOS().name}`;
163+
const browserName = ua.getBrowser().name;
164+
const osName = ua.getOS().name;
165+
return _t('%(appName)s via %(browserName)s on %(osName)s', {appName: appName, browserName: browserName, osName: osName});
163166
}
164167

165168
screenCaptureErrorString(): ?string {
166169
// it won't work at all if you're not on HTTPS so whine whine whine
167170
if (!global.window || global.window.location.protocol !== "https:") {
168-
return "You need to be using HTTPS to place a screen-sharing call.";
171+
return _t("You need to be using HTTPS to place a screen-sharing call.");
169172
}
170173
return null;
171174
}

‎src/vector/submit-rageshake.js‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import q from "q";
1919

2020
import MatrixClientPeg from 'matrix-react-sdk/lib/MatrixClientPeg';
2121
import PlatformPeg from 'matrix-react-sdk/lib/PlatformPeg';
22+
import { _t } from 'matrix-react-sdk/lib/languageHandler';
2223

2324
import rageshake from './rageshake'
2425

@@ -53,7 +54,7 @@ export default async function sendBugReport(bugReportEndpoint, opts) {
5354
opts = opts || {};
5455
const progressCallback = opts.progressCallback || (() => {});
5556

56-
progressCallback("Collecting app version information");
57+
progressCallback(_t("Collecting app version information"));
5758
let version = "UNKNOWN";
5859
try {
5960
version = await PlatformPeg.get().getAppVersion();
@@ -81,7 +82,7 @@ export default async function sendBugReport(bugReportEndpoint, opts) {
8182
}
8283

8384
if (opts.sendLogs) {
84-
progressCallback("Collecting logs");
85+
progressCallback(_t("Collecting logs"));
8586
const logs = await rageshake.getLogsForReport();
8687
for (let entry of logs) {
8788
// encode as UTF-8
@@ -94,7 +95,7 @@ export default async function sendBugReport(bugReportEndpoint, opts) {
9495
}
9596
}
9697

97-
progressCallback("Uploading report");
98+
progressCallback(_t("Uploading report"));
9899
await _submitReport(bugReportEndpoint, body, progressCallback);
99100
}
100101

@@ -106,7 +107,7 @@ function _submitReport(endpoint, body, progressCallback) {
106107
req.timeout = 5 * 60 * 1000;
107108
req.onreadystatechange = function() {
108109
if (req.readyState === XMLHttpRequest.LOADING) {
109-
progressCallback("Waiting for response from server");
110+
progressCallback(_t("Waiting for response from server"));
110111
} else if (req.readyState === XMLHttpRequest.DONE) {
111112
on_done();
112113
}

0 commit comments

Comments
 (0)