Use brand name from config in all strings

This commit is contained in:
J. Ryan Stinnett 2020-07-13 14:12:44 +01:00
parent c135c819b7
commit 5b31589b3a
4 changed files with 22 additions and 11 deletions

View File

@ -16,6 +16,7 @@ limitations under the License.
import * as React from "react"; import * as React from "react";
import { _t } from "matrix-react-sdk/src/languageHandler"; import { _t } from "matrix-react-sdk/src/languageHandler";
import SdkConfig from 'matrix-react-sdk/src/SdkConfig';
// directly import the style here as this layer does not support rethemedex at this time so no matrix-react-sdk // directly import the style here as this layer does not support rethemedex at this time so no matrix-react-sdk
// scss variables will be accessible. // scss variables will be accessible.
@ -26,6 +27,7 @@ interface IProps {
} }
const CompatibilityView: React.FC<IProps> = ({ onAccept }) => { const CompatibilityView: React.FC<IProps> = ({ onAccept }) => {
const brand = SdkConfig.get().brand;
return <div className="mx_ErrorView"> return <div className="mx_ErrorView">
<div className="mx_ErrorView_container"> <div className="mx_ErrorView_container">
<div className="mx_HomePage_header"> <div className="mx_HomePage_header">
@ -38,10 +40,12 @@ const CompatibilityView: React.FC<IProps> = ({ onAccept }) => {
<div className="mx_HomePage_col"> <div className="mx_HomePage_col">
<div className="mx_HomePage_row"> <div className="mx_HomePage_row">
<div> <div>
<h2 id="step1_heading">{ _t("Your browser can't run Riot") }</h2> <h2 id="step1_heading">{ _t("Your browser can't run %(brand)s", { brand }) }</h2>
<p> <p>
{ _t( { _t(
"Riot uses advanced browser features which aren't supported by your current browser.", "%(brand)s uses advanced browser features which aren't " +
"supported by your current browser.",
{ brand },
) } ) }
</p> </p>
<p> <p>

View File

@ -2,8 +2,8 @@
"Missing indexeddb worker script!": "Missing indexeddb worker script!", "Missing indexeddb worker script!": "Missing indexeddb worker script!",
"Invalid configuration: can only specify one of default_server_config, default_server_name, or default_hs_url.": "Invalid configuration: can only specify one of default_server_config, default_server_name, or default_hs_url.", "Invalid configuration: can only specify one of default_server_config, default_server_name, or default_hs_url.": "Invalid configuration: can only specify one of default_server_config, default_server_name, or default_hs_url.",
"Invalid configuration: no default server specified.": "Invalid configuration: no default server specified.", "Invalid configuration: no default server specified.": "Invalid configuration: no default server specified.",
"Your Riot is misconfigured": "Your Riot is misconfigured", "Your Element is misconfigured": "Your Element is misconfigured",
"Your Riot configuration contains invalid JSON. Please correct the problem and reload the page.": "Your Riot configuration contains invalid JSON. Please correct the problem and reload the page.", "Your Element configuration contains invalid JSON. Please correct the problem and reload the page.": "Your Element configuration contains invalid JSON. Please correct the problem and reload the page.",
"The message from the parser is: %(message)s": "The message from the parser is: %(message)s", "The message from the parser is: %(message)s": "The message from the parser is: %(message)s",
"Invalid JSON": "Invalid JSON", "Invalid JSON": "Invalid JSON",
"Unable to load config file: please refresh the page to try again.": "Unable to load config file: please refresh the page to try again.", "Unable to load config file: please refresh the page to try again.": "Unable to load config file: please refresh the page to try again.",
@ -13,7 +13,7 @@
"Dismiss": "Dismiss", "Dismiss": "Dismiss",
"Open user settings": "Open user settings", "Open user settings": "Open user settings",
"Previous/next recently visited room or community": "Previous/next recently visited room or community", "Previous/next recently visited room or community": "Previous/next recently visited room or community",
"Riot Desktop (%(platformName)s)": "Riot Desktop (%(platformName)s)", "%(brand)s Desktop (%(platformName)s)": "%(brand)s Desktop (%(platformName)s)",
"Go to your browser to complete Sign In": "Go to your browser to complete Sign In", "Go to your browser to complete Sign In": "Go to your browser to complete Sign In",
"Unknown device": "Unknown device", "Unknown device": "Unknown device",
"%(appName)s (%(browserName)s, %(osName)s)": "%(appName)s (%(browserName)s, %(osName)s)", "%(appName)s (%(browserName)s, %(osName)s)": "%(appName)s (%(browserName)s, %(osName)s)",
@ -22,8 +22,8 @@
"Custom Server Options": "Custom Server Options", "Custom Server Options": "Custom Server Options",
"You can use the custom server options to sign into other Matrix servers by specifying a different homeserver URL. This allows you to use Riot with an existing Matrix account on a different homeserver.": "You can use the custom server options to sign into other Matrix servers by specifying a different homeserver URL. This allows you to use Riot with an existing Matrix account on a different homeserver.", "You can use the custom server options to sign into other Matrix servers by specifying a different homeserver URL. This allows you to use Riot with an existing Matrix account on a different homeserver.": "You can use the custom server options to sign into other Matrix servers by specifying a different homeserver URL. This allows you to use Riot with an existing Matrix account on a different homeserver.",
"Unsupported browser": "Unsupported browser", "Unsupported browser": "Unsupported browser",
"Your browser can't run Riot": "Your browser can't run Riot", "Your browser can't run %(brand)s": "Your browser can't run %(brand)s",
"Riot uses advanced browser features which aren't supported by your current browser.": "Riot uses advanced browser features which aren't supported by your current browser.", "%(brand)s uses advanced browser features which aren't supported by your current browser.": "%(brand)s uses advanced browser features which aren't supported by your current browser.",
"Please install <chromeLink>Chrome</chromeLink>, <firefoxLink>Firefox</firefoxLink>, or <safariLink>Safari</safariLink> for the best experience.": "Please install <chromeLink>Chrome</chromeLink>, <firefoxLink>Firefox</firefoxLink>, or <safariLink>Safari</safariLink> for the best experience.", "Please install <chromeLink>Chrome</chromeLink>, <firefoxLink>Firefox</firefoxLink>, or <safariLink>Safari</safariLink> for the best experience.": "Please install <chromeLink>Chrome</chromeLink>, <firefoxLink>Firefox</firefoxLink>, or <safariLink>Safari</safariLink> for the best experience.",
"You can continue using your current browser, but some or all features may not work and the look and feel of the application may be incorrect.": "You can continue using your current browser, but some or all features may not work and the look and feel of the application may be incorrect.", "You can continue using your current browser, but some or all features may not work and the look and feel of the application may be incorrect.": "You can continue using your current browser, but some or all features may not work and the look and feel of the application may be incorrect.",
"I understand the risks and wish to continue": "I understand the risks and wish to continue", "I understand the risks and wish to continue": "I understand the risks and wish to continue",

View File

@ -173,8 +173,9 @@ async function start() {
} catch (error) { } catch (error) {
// Now that we've loaded the theme (CSS), display the config syntax error if needed. // Now that we've loaded the theme (CSS), display the config syntax error if needed.
if (error.err && error.err instanceof SyntaxError) { if (error.err && error.err instanceof SyntaxError) {
return showError(_t("Your Riot is misconfigured"), [ // This uses the default brand since the app config is unavailable.
_t("Your Riot configuration contains invalid JSON. Please correct the problem and reload the page."), return showError(_t("Your Element is misconfigured"), [
_t("Your Element configuration contains invalid JSON. Please correct the problem and reload the page."),
_t("The message from the parser is: %(message)s", { message: error.err.message || _t("Invalid JSON")}), _t("The message from the parser is: %(message)s", { message: error.err.message || _t("Invalid JSON")}),
]); ]);
} }
@ -196,7 +197,8 @@ async function start() {
} catch (err) { } catch (err) {
console.error(err); console.error(err);
// Like the compatibility page, AWOOOOOGA at the user // Like the compatibility page, AWOOOOOGA at the user
await showError(_t("Your Riot is misconfigured"), [ // This uses the default brand since the app config is unavailable.
await showError(_t("Your Element is misconfigured"), [
err.translatedMessage || _t("Unexpected error preparing the app. See console for details."), err.translatedMessage || _t("Unexpected error preparing the app. See console for details."),
]); ]);
} }

View File

@ -31,6 +31,7 @@ import BaseEventIndexManager, {
} from 'matrix-react-sdk/src/indexing/BaseEventIndexManager'; } from 'matrix-react-sdk/src/indexing/BaseEventIndexManager';
import dis from 'matrix-react-sdk/src/dispatcher/dispatcher'; import dis from 'matrix-react-sdk/src/dispatcher/dispatcher';
import {_t, _td} from 'matrix-react-sdk/src/languageHandler'; import {_t, _td} from 'matrix-react-sdk/src/languageHandler';
import SdkConfig from 'matrix-react-sdk/src/SdkConfig';
import * as rageshake from 'matrix-react-sdk/src/rageshake/rageshake'; import * as rageshake from 'matrix-react-sdk/src/rageshake/rageshake';
import {MatrixClient} from "matrix-js-sdk/src/client"; import {MatrixClient} from "matrix-js-sdk/src/client";
import {Room} from "matrix-js-sdk/src/models/room"; import {Room} from "matrix-js-sdk/src/models/room";
@ -437,7 +438,11 @@ export default class ElectronPlatform extends VectorBasePlatform {
} }
getDefaultDeviceDisplayName(): string { getDefaultDeviceDisplayName(): string {
return _t('Riot Desktop (%(platformName)s)', { platformName: platformFriendlyName() }); const brand = SdkConfig.get().brand;
return _t('%(brand)s Desktop (%(platformName)s)', {
brand,
platformName: platformFriendlyName(),
});
} }
screenCaptureErrorString(): string | null { screenCaptureErrorString(): string | null {