Update to use newer _t()

This commit is contained in:
Stefan Parviainen 2017-11-14 21:54:00 +01:00
parent 73e7581fc6
commit ca4b71b6e2
3 changed files with 23 additions and 28 deletions

View file

@ -17,7 +17,7 @@ limitations under the License.
'use strict'; 'use strict';
var React = require('react'); var React = require('react');
import { _t, _tJsx } from 'matrix-react-sdk/lib/languageHandler'; import { _t } from 'matrix-react-sdk/lib/languageHandler';
module.exports = React.createClass({ module.exports = React.createClass({
displayName: 'CompatibilityPage', displayName: 'CompatibilityPage',
@ -40,30 +40,24 @@ module.exports = React.createClass({
return ( return (
<div className="mx_CompatibilityPage"> <div className="mx_CompatibilityPage">
<div className="mx_CompatibilityPage_box"> <div className="mx_CompatibilityPage_box">
<p>{ _tJsx("Sorry, your browser is <b>not</b> able to run Riot.", /<b>(.*?)<\/b>/, (sub) => <b>{sub}</b>) } </p> <p>{ _t("Sorry, your browser is <b>not</b> able to run Riot.", {}, { 'b': (sub) => <b>{sub}</b> }) } </p>
<p> <p>
{ _t("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.") }
</p> </p>
<p> <p>
{ _tJsx('Please install <a href="https://www.google.com/chrome">Chrome</a> or <a href="https://getfirefox.com">Firefox</a> for the best experience.', { _t('Please install <chromeLink>Chrome</chromeLink> or <firefoxLink>Firefox</firefoxLink> for the best experience.',
[ {},
/<a href="https:\/\/www.google.com\/chrome">(.*?)<\/a>/, {
/<a href="https:\/\/getfirefox.com">(.*?)<\/a>/, 'chromeLink': (sub) => <a href="https://www.google.com/chrome">{sub}</a>,
], 'firefoxLink': (sub) => <a href="https://getfirefox.com">{sub}</a>,
[ },
(sub) => <a href="https://www.google.com/chrome">{sub}</a>,
(sub) => <a href="https://getfirefox.com">{sub}</a>,
]
)} )}
{ _tJsx('<a href="http://apple.com/safari">Safari</a> and <a href="http://opera.com">Opera</a> work too.', { _t('< safariLink>Safari</safariLink> and <operaLink>Opera</operaLink> work too.',
[ {},
/<a href="http:\/\/apple\.com\/safari">(.*?)<\/a>/, {
/<a href="http:\/\/opera\.com">(.*?)<\/a>/, 'safariLink': (sub) => <a href="http://apple.com/safari">{sub}</a>,
], 'operaLink': (sub) => <a href="http://opera.com">{sub}</a>,
[ },
(sub) => <a href="http://apple.com/safari">{sub}</a>,
(sub) => <a href="http://opera.com">{sub}</a>,
]
)} )}
</p> </p>
<p> <p>

View file

@ -20,7 +20,7 @@ import React from 'react';
import sdk from 'matrix-react-sdk'; import sdk from 'matrix-react-sdk';
import Modal from 'matrix-react-sdk/lib/Modal'; import Modal from 'matrix-react-sdk/lib/Modal';
import dis from 'matrix-react-sdk/lib/dispatcher'; import dis from 'matrix-react-sdk/lib/dispatcher';
import { _t, _tJsx } from 'matrix-react-sdk/lib/languageHandler'; import { _t } from 'matrix-react-sdk/lib/languageHandler';
export default React.createClass({ export default React.createClass({
onUpdateClicked: function() { onUpdateClicked: function() {
@ -49,10 +49,10 @@ export default React.createClass({
alt="Warning" alt="Warning"
/> />
<div className="mx_MatrixToolbar_content"> <div className="mx_MatrixToolbar_content">
{ _tJsx( { _t(
"To return to your account in future you need to <u>set a password</u>", "To return to your account in future you need to <u>set a password</u>",
/<u>(.*?)<\/u>/, {},
(sub) => { return <u>{ sub }</u>; }, { 'u': (sub) => <u>{ sub }</u> },
) } ) }
</div> </div>
<button className="mx_MatrixToolbar_action"> <button className="mx_MatrixToolbar_action">

View file

@ -17,7 +17,7 @@ limitations under the License.
import React from 'react'; import React from 'react';
import Promise from 'bluebird'; import Promise from 'bluebird';
import sdk from 'matrix-react-sdk'; import sdk from 'matrix-react-sdk';
import { _t, _tJsx } from 'matrix-react-sdk/lib/languageHandler'; import { _t } from 'matrix-react-sdk/lib/languageHandler';
import MatrixClientPeg from 'matrix-react-sdk/lib/MatrixClientPeg'; import MatrixClientPeg from 'matrix-react-sdk/lib/MatrixClientPeg';
import UserSettingsStore from 'matrix-react-sdk/lib/UserSettingsStore'; import UserSettingsStore from 'matrix-react-sdk/lib/UserSettingsStore';
import Modal from 'matrix-react-sdk/lib/Modal'; import Modal from 'matrix-react-sdk/lib/Modal';
@ -542,10 +542,11 @@ module.exports = React.createClass({
"vectorRuleId": "_keywords", "vectorRuleId": "_keywords",
"description" : ( "description" : (
<span> <span>
{ _tJsx('Messages containing <span>keywords</span>', { _t('Messages containing <span>keywords</span>',
/<span>(.*?)<\/span>/, {},
(sub) => { 'span': (sub) =>
<span className="mx_UserNotifSettings_keywords" onClick={ self.onKeywordsClicked }>{sub}</span> <span className="mx_UserNotifSettings_keywords" onClick={ self.onKeywordsClicked }>{sub}</span>
},
)} )}
</span> </span>
), ),