Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translate src/vector #4119

Merged
merged 4 commits into from
May 31, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/i18n/strings/en_EN.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"%(appName)s via %(browserName)s on %(osName)s": "%(appName)s via %(browserName)s on %(osName)s",
"<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.",
"Add an email address above to configure email notifications": "Add an email address above to configure email notifications",
"Advanced notification settings": "Advanced notification settings",
Expand All @@ -11,6 +12,8 @@
"Can't update user notification settings": "Can't update user notification settings",
"Close": "Close",
"Collapse panel": "Collapse panel",
"Collecting app version information": "Collecting app version information",
"Collecting logs": "Collecting logs",
"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",
Expand Down Expand Up @@ -88,7 +91,9 @@
"remove %(name)s from the directory": "remove %(name)s from the directory",
"Remove from Directory": "Remove from Directory",
"Resend": "Resend",
"Riot Desktop on %(platformName)": "Riot Desktop on %(platformName)",
"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 is not supported on mobile web. Install the app?": "Riot is not supported on mobile web. Install the app?",
"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",
Expand All @@ -106,11 +111,14 @@
"Unable to join network": "Unable to join network",
"Unable to look up room ID from server": "Unable to look up room ID from server",
"Unhide Preview": "Unhide Preview",
"Unknown device": "Unknown device",
"unknown error code": "unknown error code",
"Unnamed room": "Unnamed room",
"Uploaded on %(date)s by %(user)s": "Uploaded on %(date)s by %(user)s",
"Uploading report": "Uploading report",
"View Decrypted Source": "View Decrypted Source",
"View Source": "View Source",
"Waiting for response from server": "Waiting for response from server",
"When I'm invited to a room": "When I'm invited to a room",
"World readable": "World readable",
"You cannot delete this image. (%(code)s)": "You cannot delete this image. (%(code)s)",
Expand All @@ -126,6 +134,7 @@
"Saturday": "Saturday",
"Today": "Today",
"Yesterday": "Yesterday",
"You need to be using HTTPS to place a screen-sharing call.": "You need to be using HTTPS to place a screen-sharing call.",
"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!"
}
1 change: 1 addition & 0 deletions src/i18n/strings/pt_BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"Files": "Arquivos",
"Filter room names": "Filtrar salas por título",
"Forget": "Esquecer",
"Forward Message": "Encaminhar",
" from room": " da sala",
"Guests can join": "Convidados podem entrar",
"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",
Expand Down
2 changes: 1 addition & 1 deletion src/vector/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
</head>
<body style="height: 100%;">
<section id="matrixchat" style="height: 100%;"></section>
<noscript>Sorry, Riot requires JavaScript to be enabled.</noscript>
<noscript>Sorry, Riot requires JavaScript to be enabled.</noscript> <!-- TODO: Translate this? -->
<% for (var i=0; i < htmlWebpackPlugin.files.js.length; i++) {
// Not a particularly graceful way of not putting the indexeddb worker script
// into the main page
Expand Down
5 changes: 2 additions & 3 deletions src/vector/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,13 +245,13 @@ async function loadApp() {

if (!preventRedirect) {
if (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) {
if (confirm("Riot is not supported on mobile web. Install the app?")) {
if (confirm(languageHandler._t("Riot is not supported on mobile web. Install the app?"))) {
window.location = "https://itunes.apple.com/us/app/vector.im/id1083446067";
return;
}
}
else if (/Android/.test(navigator.userAgent)) {
if (confirm("Riot is not supported on mobile web. Install the app?")) {
if (confirm(languageHandler._t("Riot is not supported on mobile web. Install the app?"))) {
window.location = "https://play.google.com/store/apps/details?id=im.vector.alpha";
return;
}
Expand All @@ -278,7 +278,6 @@ async function loadApp() {
</div>, document.getElementById('matrixchat'));
} else if (validBrowser) {
UpdateChecker.start();

const MatrixChat = sdk.getComponent('structures.MatrixChat');
window.matrixChat = ReactDOM.render(
<MatrixChat
Expand Down
5 changes: 3 additions & 2 deletions src/vector/platform/ElectronPlatform.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ limitations under the License.

import VectorBasePlatform from './VectorBasePlatform';
import dis from 'matrix-react-sdk/lib/dispatcher';
import { _t } from 'matrix-react-sdk/lib/languageHandler';
import q from 'q';
import electron, {remote, ipcRenderer} from 'electron';

Expand Down Expand Up @@ -68,7 +69,7 @@ export default class ElectronPlatform extends VectorBasePlatform {
}

getHumanReadableName(): string {
return 'Electron Platform';
return 'Electron Platform'; // no translation required: only used for analytics
}

setNotificationCount(count: number) {
Expand Down Expand Up @@ -146,7 +147,7 @@ export default class ElectronPlatform extends VectorBasePlatform {
}

getDefaultDeviceDisplayName(): string {
return 'Riot Desktop on ' + platformFriendlyName();
return _t('Riot Desktop on %(platformName)s', { platformName: platformFriendlyName() });
}

screenCaptureErrorString(): ?string {
Expand Down
6 changes: 4 additions & 2 deletions src/vector/platform/VectorBasePlatform.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ limitations under the License.
*/

import BasePlatform from 'matrix-react-sdk/lib/BasePlatform';
import { _t } from 'matrix-react-sdk/lib/languageHandler';

import Favico from 'favico.js';

/**
Expand All @@ -36,7 +38,7 @@ export default class VectorBasePlatform extends BasePlatform {
}

getHumanReadableName(): string {
return 'Vector Base Platform';
return 'Vector Base Platform'; // no translation required: only used for analytics
}

_updateFavicon() {
Expand Down Expand Up @@ -94,6 +96,6 @@ export default class VectorBasePlatform extends BasePlatform {
* device Vector is running on
*/
getDefaultDeviceDisplayName(): string {
return "Unknown device";
return _t("Unknown device");
}
}
9 changes: 6 additions & 3 deletions src/vector/platform/WebPlatform.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ limitations under the License.
import VectorBasePlatform from './VectorBasePlatform';
import request from 'browser-request';
import dis from 'matrix-react-sdk/lib/dispatcher.js';
import { _t } from 'matrix-react-sdk/lib/languageHandler';
import q from 'q';

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

getHumanReadableName(): string {
return 'Web Platform';
return 'Web Platform'; // no translation required: only used for analytics
}

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

const ua = new UAParser();
return `${appName} via ${ua.getBrowser().name} on ${ua.getOS().name}`;
const browserName = ua.getBrowser().name;
const osName = ua.getOS().name;
return _t('%(appName)s via %(browserName)s on %(osName)s', {appName: appName, browserName: browserName, osName: osName});
}

screenCaptureErrorString(): ?string {
// it won't work at all if you're not on HTTPS so whine whine whine
if (!global.window || global.window.location.protocol !== "https:") {
return "You need to be using HTTPS to place a screen-sharing call.";
return _t("You need to be using HTTPS to place a screen-sharing call.");
}
return null;
}
Expand Down
9 changes: 5 additions & 4 deletions src/vector/submit-rageshake.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import q from "q";

import MatrixClientPeg from 'matrix-react-sdk/lib/MatrixClientPeg';
import PlatformPeg from 'matrix-react-sdk/lib/PlatformPeg';
import { _t } from 'matrix-react-sdk/lib/languageHandler';

import rageshake from './rageshake'

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

progressCallback("Collecting app version information");
progressCallback(_t("Collecting app version information"));
let version = "UNKNOWN";
try {
version = await PlatformPeg.get().getAppVersion();
Expand Down Expand Up @@ -81,7 +82,7 @@ export default async function sendBugReport(bugReportEndpoint, opts) {
}

if (opts.sendLogs) {
progressCallback("Collecting logs");
progressCallback(_t("Collecting logs"));
const logs = await rageshake.getLogsForReport();
for (let entry of logs) {
// encode as UTF-8
Expand All @@ -94,7 +95,7 @@ export default async function sendBugReport(bugReportEndpoint, opts) {
}
}

progressCallback("Uploading report");
progressCallback(_t("Uploading report"));
await _submitReport(bugReportEndpoint, body, progressCallback);
}

Expand All @@ -106,7 +107,7 @@ function _submitReport(endpoint, body, progressCallback) {
req.timeout = 5 * 60 * 1000;
req.onreadystatechange = function() {
if (req.readyState === XMLHttpRequest.LOADING) {
progressCallback("Waiting for response from server");
progressCallback(_t("Waiting for response from server"));
} else if (req.readyState === XMLHttpRequest.DONE) {
on_done();
}
Expand Down