How to use the matrix-react-sdk/lib/languageHandler._td function in matrix-react-sdk

To help you get started, we’ve selected a few matrix-react-sdk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vector-im / riot-web / src / vector / index.js View on Github external
let wkConfig = config['default_server_config']; // overwritten later under some conditions
        const serverName = config['default_server_name'];
        const hsUrl = config['default_hs_url'];
        const isUrl = config['default_is_url'];

        const incompatibleOptions = [wkConfig, serverName, hsUrl].filter(i => !!i);
        if (incompatibleOptions.length > 1) {
            // noinspection ExceptionCaughtLocallyJS
            throw newTranslatableError(_td(
                "Invalid configuration: can only specify one of default_server_config, default_server_name, " +
                "or default_hs_url.",
            ));
        }
        if (incompatibleOptions.length < 1) {
            // noinspection ExceptionCaughtLocallyJS
            throw newTranslatableError(_td("Invalid configuration: no default server specified."));
        }

        if (hsUrl) {
            console.log("Config uses a default_hs_url - constructing a default_server_config using this information");
            console.warn(
                "DEPRECATED CONFIG OPTION: In the future, default_hs_url will not be accepted. Please use " +
                "default_server_config instead.",
            );

            wkConfig = {
                "m.homeserver": {
                    "base_url": hsUrl,
                },
            };
            if (isUrl) {
                wkConfig["m.identity_server"] = {
github vector-im / riot-web / src / vector / index.js View on Github external
// Note: Although we throw all 3 possible configuration options through a .well-known-style
        // verification, we do not care if the servers are online at this point. We do moderately
        // care if they are syntactically correct though, so we shove them through the .well-known
        // validators for that purpose.

        const config = SdkConfig.get();
        let wkConfig = config['default_server_config']; // overwritten later under some conditions
        const serverName = config['default_server_name'];
        const hsUrl = config['default_hs_url'];
        const isUrl = config['default_is_url'];

        const incompatibleOptions = [wkConfig, serverName, hsUrl].filter(i => !!i);
        if (incompatibleOptions.length > 1) {
            // noinspection ExceptionCaughtLocallyJS
            throw newTranslatableError(_td(
                "Invalid configuration: can only specify one of default_server_config, default_server_name, " +
                "or default_hs_url.",
            ));
        }
        if (incompatibleOptions.length < 1) {
            // noinspection ExceptionCaughtLocallyJS
            throw newTranslatableError(_td("Invalid configuration: no default server specified."));
        }

        if (hsUrl) {
            console.log("Config uses a default_hs_url - constructing a default_server_config using this information");
            console.warn(
                "DEPRECATED CONFIG OPTION: In the future, default_hs_url will not be accepted. Please use " +
                "default_server_config instead.",
            );
github vector-im / riot-web / src / components / views / context_menus / PresenceContextMenu.js View on Github external
http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

import React from 'react';
import { _t, _td } from 'matrix-react-sdk/lib/languageHandler';
import sdk from 'matrix-react-sdk';

const STATUS_LABELS = {
    "online": _td("Online"),
    "unavailable": _td("Away"),
    "offline": _td("Appear Offline"),
};

const PresenceContextMenuOption = React.createClass({
    displayName: 'PresenceContextMenuOption',

    propTypes: {
        forStatus: React.PropTypes.string.isRequired,
        isCurrent: React.PropTypes.bool,
        onChange: React.PropTypes.func.isRequired,
    },

    onClick: function() {
        if (this.isCurrent) return;
        this.props.onChange(this.props.forStatus);
    },
github vector-im / riot-web / src / components / views / context_menus / PresenceContextMenu.js View on Github external
http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

import React from 'react';
import { _t, _td } from 'matrix-react-sdk/lib/languageHandler';
import sdk from 'matrix-react-sdk';

const STATUS_LABELS = {
    "online": _td("Online"),
    "unavailable": _td("Away"),
    "offline": _td("Appear Offline"),
};

const PresenceContextMenuOption = React.createClass({
    displayName: 'PresenceContextMenuOption',

    propTypes: {
        forStatus: React.PropTypes.string.isRequired,
        isCurrent: React.PropTypes.bool,
        onChange: React.PropTypes.func.isRequired,
    },

    onClick: function() {
        if (this.isCurrent) return;
        this.props.onChange(this.props.forStatus);
github vector-im / riot-web / src / components / views / context_menus / PresenceContextMenu.js View on Github external
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

import React from 'react';
import { _t, _td } from 'matrix-react-sdk/lib/languageHandler';
import sdk from 'matrix-react-sdk';

const STATUS_LABELS = {
    "online": _td("Online"),
    "unavailable": _td("Away"),
    "offline": _td("Appear Offline"),
};

const PresenceContextMenuOption = React.createClass({
    displayName: 'PresenceContextMenuOption',

    propTypes: {
        forStatus: React.PropTypes.string.isRequired,
        isCurrent: React.PropTypes.bool,
        onChange: React.PropTypes.func.isRequired,
    },

    onClick: function() {
        if (this.isCurrent) return;
        this.props.onChange(this.props.forStatus);
    },