Globalization

The globalization process combines the translation of component messages with adapting them to specific locales.

For more information on how globalization practices are implemented in KendoReact, refer to the overview article. For more information on the globalization aspects which are available for each component, refer to the article on globalization support.

The following example demonstrates how to localize the built-in messages of the KendoReact Sortable.

import React from 'react';
import ReactDOM from 'react-dom';
import { Sortable } from '@progress/kendo-react-sortable';

import { IntlProvider, LocalizationProvider, loadMessages } from '@progress/kendo-react-intl';

const bgMessages = {
    "sortable": {
        "noData": "Няма данни"
    }
};

loadMessages(bgMessages, 'bg-BG');

const SortableItemUI = (props) => {
    const { style, attributes, dataItem, forwardRef } = props;

    return (
        <div
            ref={forwardRef}
            {...attributes}
            style={{
                ...style
            }}
        >
            {dataItem.text}
        </div>
    );
};

class App extends React.Component {
    render() {
        return (
            <LocalizationProvider language="bg-BG">
                <IntlProvider locale="bg" >
                    <div className="container-fluid">
                        <Sortable
                            idField={'id'}
                            data={[]}

                            itemUI={SortableItemUI}
                        />
                    </div>
                </IntlProvider>
            </LocalizationProvider>
        );
    }
}

ReactDOM.render(
    <App />,
    document.querySelector('my-app')
);

Internationalization

The internationalization process applies specific culture formats to a web application.

For more information, refer to:

Messages

The Sortable supports the localization of its messages by utilizing the KendoReact Internationalization package.

The following table lists the built-in message keys and their default values.

Message KeyDefault Value
sortable.noDataNo Data

Right-to-Left Support

The following example demonstrates how to utilize the RTL support for the Sortable.

import React from 'react';
import ReactDOM from 'react-dom';
import { Sortable } from '@progress/kendo-react-sortable';

const getBaseItemStyle = (isActive) => ({
    height: 70,
    lineHeight: '68px',
    fontSize: '16px',
    textAlign: 'center',
    outline: 'none',
    border: '1px solid',
    cursor: 'move',
    display: 'inline-block',
    background: isActive ? '#27aceb' : '#bfe7f9',
    color: isActive ? '#fff' : '#1494d0',
    borderColor: isActive ? '#27aceb' : '#fff'
});

const SortableItemUI = (props) => {
    const { isDisabled, isActive, style, attributes, dataItem, forwardRef } = props;
    const classNames = [ 'col-xs-6 col-sm-3' ];

    if (isDisabled) {
        classNames.push('k-state-disabled');
    }

    return (
        <div
            ref={forwardRef}
            {...attributes}
            style={{
                ...getBaseItemStyle(isActive),
                ...style
            }}
            className={classNames.join(' ')}
        >
            {dataItem.text}
        </div>
    );
};

class App extends React.Component {
    state = {
        data: [
            { id: 1, text: 'item1' },
            { id: 2, text: 'item2' },
            { id: 3, text: 'item3' },
            { id: 4, text: 'item4' },
            { id: 5, text: 'item5' },
            { id: 6, text: 'item6' },
            { id: 7, text: 'item7' },
            { id: 8, text: 'item8' }
        ]
    };

    onDragOver = (event) => {
        this.setState({
            data: event.newState
        });
    }

    onNavigate = (event) => {
        this.setState({
            data: event.newState
        });
    }

    render() {
        return (
            <div className="container-fluid k-rtl">
                <div className="example-config">
                    <h6>Items: {JSON.stringify(this.state.data)}</h6>
                </div>
                <Sortable
                    idField={'id'}
                    disabledField={'disabled'}
                    data={this.state.data}

                    itemUI={SortableItemUI}

                    onDragOver={this.onDragOver}
                    onNavigate={this.onNavigate}
                />
            </div>
        );
    }
}

ReactDOM.render(
    <App />,
    document.querySelector('my-app')
);
 /