Merge pull request #4119 from vector-im/kegan/translation-chimp

Translate src/vector
This commit is contained in:
Matthew Hodgson 2017-06-01 00:34:45 +01:00 committed by GitHub
commit bac5ae89ce
8 changed files with 31 additions and 15 deletions

View file

@ -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

View file

@ -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;
}
@ -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

View file

@ -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';
@ -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) {
@ -150,7 +151,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 {

View file

@ -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';
/**
@ -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() {
@ -94,6 +96,6 @@ export default class VectorBasePlatform extends BasePlatform {
* device Vector is running on
*/
getDefaultDeviceDisplayName(): string {
return "Unknown device";
return _t("Unknown device");
}
}

View file

@ -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';
@ -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
}
/**
@ -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;
}

View file

@ -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'
@ -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();
@ -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
@ -94,7 +95,7 @@ export default async function sendBugReport(bugReportEndpoint, opts) {
}
}
progressCallback("Uploading report");
progressCallback(_t("Uploading report"));
await _submitReport(bugReportEndpoint, body, progressCallback);
}
@ -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();
}