Change localizeMessage to take a MessageDescriptor as a parameter (#28141)

* Change localizeAndFormatMessage to take a MessageDescriptor

* Change localizeMessage to take a MessageDescriptor as a parameter

* Update mmjstool to support new localizeMessage signature

* Change mmjstool commit back to master branch
Этот коммит содержится в:
Harrison Healey
2024-09-24 12:07:51 -04:00
коммит произвёл GitHub
родитель 8e2dc45841
Коммит e080f9f5ed
120 изменённых файлов: 532 добавлений и 518 удалений

Просмотреть файл

@@ -105,6 +105,7 @@
"@hot-loader/react-dom": "17.0.2", "@hot-loader/react-dom": "17.0.2",
"@mattermost/calls-common": "0.27.0", "@mattermost/calls-common": "0.27.0",
"@mattermost/eslint-plugin": "*", "@mattermost/eslint-plugin": "*",
"@mattermost/mmjstool": "github:mattermost/mattermost-utilities#7b63833d208d482ba4a1c12230bb3e68dd9c5e5e",
"@redux-devtools/extension": "3.2.3", "@redux-devtools/extension": "3.2.3",
"@stylistic/stylelint-plugin": "2.1.0", "@stylistic/stylelint-plugin": "2.1.0",
"@testing-library/jest-dom": "5.16.4", "@testing-library/jest-dom": "5.16.4",
@@ -162,7 +163,6 @@
"jest-environment-jsdom": "29.7.0", "jest-environment-jsdom": "29.7.0",
"jest-junit": "16.0.0", "jest-junit": "16.0.0",
"jest-watch-typeahead": "2.2.2", "jest-watch-typeahead": "2.2.2",
"mmjstool": "github:mattermost/mattermost-utilities#73e61d2ede0ebf802492df4cfbac481d35efed54",
"nock": "13.2.8", "nock": "13.2.8",
"prettier": "2.3.2", "prettier": "2.3.2",
"react-router-enzyme-context": "1.2.0", "react-router-enzyme-context": "1.2.0",

Просмотреть файл

@@ -78,7 +78,7 @@ export function executeCommand(message: string, args: CommandArgs): ActionFuncAs
return {data: {frontendHandled: true}}; return {data: {frontendHandled: true}};
case '/shortcuts': case '/shortcuts':
if (UserAgent.isMobile()) { if (UserAgent.isMobile()) {
const error = {message: localizeMessage('create_post.shortcutsNotSupported', 'Keyboard shortcuts are not supported on your device')}; const error = {message: localizeMessage({id: 'create_post.shortcutsNotSupported', defaultMessage: 'Keyboard shortcuts are not supported on your device'})};
return {error}; return {error};
} }
@@ -132,12 +132,12 @@ export function executeCommand(message: string, args: CommandArgs): ActionFuncAs
case '/marketplace': case '/marketplace':
// check if user has permissions to access the read plugins // check if user has permissions to access the read plugins
if (!haveICurrentTeamPermission(state, Permissions.SYSCONSOLE_WRITE_PLUGINS)) { if (!haveICurrentTeamPermission(state, Permissions.SYSCONSOLE_WRITE_PLUGINS)) {
return {error: {message: localizeMessage('marketplace_command.no_permission', 'You do not have the appropriate permissions to access the marketplace.')}}; return {error: {message: localizeMessage({id: 'marketplace_command.no_permission', defaultMessage: 'You do not have the appropriate permissions to access the marketplace.'})}};
} }
// check config to see if marketplace is enabled // check config to see if marketplace is enabled
if (!isMarketplaceEnabled(state)) { if (!isMarketplaceEnabled(state)) {
return {error: {message: localizeMessage('marketplace_command.disabled', 'The marketplace is disabled. Please contact your System Administrator for details.')}}; return {error: {message: localizeMessage({id: 'marketplace_command.disabled', defaultMessage: 'The marketplace is disabled. Please contact your System Administrator for details.'})}};
} }
dispatch(openModal({modalId: ModalIdentifiers.PLUGIN_MARKETPLACE, dialogType: MarketplaceModal, dialogProps: {openedFrom: 'command'}})); dispatch(openModal({modalId: ModalIdentifiers.PLUGIN_MARKETPLACE, dialogType: MarketplaceModal, dialogProps: {openedFrom: 'command'}}));

Просмотреть файл

@@ -98,9 +98,9 @@ export function uploadFile({file, name, type, rootId, channelId, clientId, onPro
try { try {
const errorResponse = JSON.parse(xhr.response); const errorResponse = JSON.parse(xhr.response);
errorMessage = errorMessage =
(errorResponse?.id && errorResponse?.message) ? localizeMessage(errorResponse.id, errorResponse.message) : localizeMessage('file_upload.generic_error', 'There was a problem uploading your files.'); (errorResponse?.id && errorResponse?.message) ? localizeMessage({id: errorResponse.id, defaultMessage: errorResponse.message}) : localizeMessage({id: 'file_upload.generic_error', defaultMessage: 'There was a problem uploading your files.'});
} catch (e) { } catch (e) {
errorMessage = localizeMessage('file_upload.generic_error', 'There was a problem uploading your files.'); errorMessage = localizeMessage({id: 'file_upload.generic_error', defaultMessage: 'There was a problem uploading your files.'});
} }
dispatch({ dispatch({
@@ -133,7 +133,7 @@ export function uploadFile({file, name, type, rootId, channelId, clientId, onPro
dispatch(batchActions([uploadFailureAction, getLogErrorAction(errorResponse)])); dispatch(batchActions([uploadFailureAction, getLogErrorAction(errorResponse)]));
onError(errorResponse, clientId, channelId, rootId); onError(errorResponse, clientId, channelId, rootId);
} else { } else {
const errorMessage = xhr.status === 0 || !xhr.status ? localizeMessage('file_upload.generic_error', 'There was a problem uploading your files.') : localizeMessage('channel_loader.unknown_error', 'We received an unexpected status code from the server.') + ' (' + xhr.status + ')'; const errorMessage = xhr.status === 0 || !xhr.status ? localizeMessage({id: 'file_upload.generic_error', defaultMessage: 'There was a problem uploading your files.'}) : localizeMessage({id: 'channel_loader.unknown_error', defaultMessage: 'We received an unexpected status code from the server.'}) + ' (' + xhr.status + ')';
dispatch({ dispatch({
type: FileTypes.UPLOAD_FILES_FAILURE, type: FileTypes.UPLOAD_FILES_FAILURE,

Просмотреть файл

@@ -20,7 +20,6 @@ import {isThreadOpen} from 'selectors/views/threads';
import {getHistory} from 'utils/browser_history'; import {getHistory} from 'utils/browser_history';
import Constants, {NotificationLevels, UserStatuses, IgnoreChannelMentions} from 'utils/constants'; import Constants, {NotificationLevels, UserStatuses, IgnoreChannelMentions} from 'utils/constants';
import DesktopApp from 'utils/desktop_api'; import DesktopApp from 'utils/desktop_api';
import {t} from 'utils/i18n';
import {stripMarkdown, formatWithRenderer} from 'utils/markdown'; import {stripMarkdown, formatWithRenderer} from 'utils/markdown';
import MentionableRenderer from 'utils/markdown/mentionable_renderer'; import MentionableRenderer from 'utils/markdown/mentionable_renderer';
import * as NotificationSounds from 'utils/notification_sounds'; import * as NotificationSounds from 'utils/notification_sounds';
@@ -200,10 +199,10 @@ export function sendDesktopNotification(post, msgProps) {
} else if (msgProps.sender_name) { } else if (msgProps.sender_name) {
username = msgProps.sender_name; username = msgProps.sender_name;
} else { } else {
username = Utils.localizeMessage('channel_loader.someone', 'Someone'); username = Utils.localizeMessage({id: 'channel_loader.someone', defaultMessage: 'Someone'});
} }
let title = Utils.localizeMessage('channel_loader.posted', 'Posted'); let title = Utils.localizeMessage({id: 'channel_loader.posted', defaultMessage: 'Posted'});
if (!channel) { if (!channel) {
title = msgProps.channel_display_name; title = msgProps.channel_display_name;
channel = { channel = {
@@ -211,21 +210,21 @@ export function sendDesktopNotification(post, msgProps) {
type: msgProps.channel_type, type: msgProps.channel_type,
}; };
} else if (channel.type === Constants.DM_CHANNEL) { } else if (channel.type === Constants.DM_CHANNEL) {
title = Utils.localizeMessage('notification.dm', 'Direct Message'); title = Utils.localizeMessage({id: 'notification.dm', defaultMessage: 'Direct Message'});
} else { } else {
title = channel.display_name; title = channel.display_name;
} }
if (title === '') { if (title === '') {
if (msgProps.channel_type === Constants.DM_CHANNEL) { if (msgProps.channel_type === Constants.DM_CHANNEL) {
title = Utils.localizeMessage('notification.dm', 'Direct Message'); title = Utils.localizeMessage({id: 'notification.dm', defaultMessage: 'Direct Message'});
} else { } else {
title = msgProps.channel_display_name; title = msgProps.channel_display_name;
} }
} }
if (isCrtReply) { if (isCrtReply) {
title = Utils.localizeAndFormatMessage(t('notification.crt'), 'Reply in {title}', {title}); title = Utils.localizeAndFormatMessage({id: 'notification.crt', defaultMessage: 'Reply in {title}'}, {title});
} }
let notifyText = post.message; let notifyText = post.message;
@@ -247,13 +246,13 @@ export function sendDesktopNotification(post, msgProps) {
let body = `@${username}`; let body = `@${username}`;
if (strippedMarkdownNotifyText.length === 0) { if (strippedMarkdownNotifyText.length === 0) {
if (msgProps.image) { if (msgProps.image) {
body += Utils.localizeMessage('channel_loader.uploadedImage', ' uploaded an image'); body += Utils.localizeMessage({id: 'channel_loader.uploadedImage', defaultMessage: ' uploaded an image'});
} else if (msgProps.otherFile) { } else if (msgProps.otherFile) {
body += Utils.localizeMessage('channel_loader.uploadedFile', ' uploaded a file'); body += Utils.localizeMessage({id: 'channel_loader.uploadedFile', defaultMessage: ' uploaded a file'});
} else if (image) { } else if (image) {
body += Utils.localizeMessage('channel_loader.postedImage', ' posted an image'); body += Utils.localizeMessage({id: 'channel_loader.postedImage', defaultMessage: ' posted an image'});
} else { } else {
body += Utils.localizeMessage('channel_loader.something', ' did something new'); body += Utils.localizeMessage({id: 'channel_loader.something', defaultMessage: ' did something new'});
} }
} else { } else {
body += `: ${strippedMarkdownNotifyText}`; body += `: ${strippedMarkdownNotifyText}`;

Просмотреть файл

@@ -267,7 +267,7 @@ export function makeOnEditLatestPost(rootId: string): () => ActionFunc<boolean>
return dispatch(PostActions.setEditingPost( return dispatch(PostActions.setEditingPost(
lastPost.id, lastPost.id,
'reply_textbox', 'reply_textbox',
Utils.localizeMessage('create_comment.commentTitle', 'Comment'), Utils.localizeMessage({id: 'create_comment.commentTitle', defaultMessage: 'Comment'}),
true, true,
)); ));
}; };

Просмотреть файл

@@ -388,7 +388,7 @@ export class ActionMenuClass extends React.PureComponent<Props, State> {
key='more-actions-button' key='more-actions-button'
ref={this.buttonRef} ref={this.buttonRef}
id={`${this.props.location}_actions_button_${this.props.post.id}`} id={`${this.props.location}_actions_button_${this.props.post.id}`}
aria-label={Utils.localizeMessage('post_info.actions.tooltip.actions', 'Actions').toLowerCase()} aria-label={Utils.localizeMessage({id: 'post_info.actions.tooltip.actions', defaultMessage: 'Actions'}).toLowerCase()}
className={classNames('post-menu__item', { className={classNames('post-menu__item', {
'post-menu__item--active': this.props.isMenuOpen, 'post-menu__item--active': this.props.isMenuOpen,
})} })}
@@ -402,7 +402,7 @@ export class ActionMenuClass extends React.PureComponent<Props, State> {
id={`${this.props.location}_actions_dropdown_${this.props.post.id}`} id={`${this.props.location}_actions_dropdown_${this.props.post.id}`}
openLeft={true} openLeft={true}
openUp={this.state.openUp} openUp={this.state.openUp}
ariaLabel={Utils.localizeMessage('post_info.menuAriaLabel', 'Post extra options')} ariaLabel={Utils.localizeMessage({id: 'post_info.menuAriaLabel', defaultMessage: 'Post extra options'})}
key={`${this.props.location}_actions_dropdown_${this.props.post.id}`} key={`${this.props.location}_actions_dropdown_${this.props.post.id}`}
> >
{menuItems} {menuItems}

Просмотреть файл

@@ -242,8 +242,8 @@ export class AddGroupsToChannelModal extends React.PureComponent<Props, State> {
</div> </div>
); );
const buttonSubmitText = localizeMessage('multiselect.add', 'Add'); const buttonSubmitText = localizeMessage({id: 'multiselect.add', defaultMessage: 'Add'});
const buttonSubmitLoadingText = localizeMessage('multiselect.adding', 'Adding...'); const buttonSubmitLoadingText = localizeMessage({id: 'multiselect.adding', defaultMessage: 'Adding...'});
let addError = null; let addError = null;
if (this.state.addError) { if (this.state.addError) {
@@ -305,7 +305,7 @@ export class AddGroupsToChannelModal extends React.PureComponent<Props, State> {
buttonSubmitLoadingText={buttonSubmitLoadingText} buttonSubmitLoadingText={buttonSubmitLoadingText}
saving={this.state.saving} saving={this.state.saving}
loading={this.state.loadingGroups} loading={this.state.loadingGroups}
placeholderText={localizeMessage('multiselect.addGroupsPlaceholder', 'Search and add groups')} placeholderText={localizeMessage({id: 'multiselect.addGroupsPlaceholder', defaultMessage: 'Search and add groups'})}
/> />
</Modal.Body> </Modal.Body>
</Modal> </Modal>

Просмотреть файл

@@ -248,8 +248,8 @@ export class AddGroupsToTeamModal extends React.PureComponent<Props, State> {
</div> </div>
); );
const buttonSubmitText = localizeMessage('multiselect.add', 'Add'); const buttonSubmitText = localizeMessage({id: 'multiselect.add', defaultMessage: 'Add'});
const buttonSubmitLoadingText = localizeMessage('multiselect.adding', 'Adding...'); const buttonSubmitLoadingText = localizeMessage({id: 'multiselect.adding', defaultMessage: 'Adding...'});
let addError = null; let addError = null;
if (this.state.addError) { if (this.state.addError) {
@@ -319,7 +319,7 @@ export class AddGroupsToTeamModal extends React.PureComponent<Props, State> {
buttonSubmitLoadingText={buttonSubmitLoadingText} buttonSubmitLoadingText={buttonSubmitLoadingText}
saving={this.state.saving} saving={this.state.saving}
loading={this.state.loadingGroups} loading={this.state.loadingGroups}
placeholderText={localizeMessage('multiselect.addGroupsPlaceholder', 'Search and add groups')} placeholderText={localizeMessage({id: 'multiselect.addGroupsPlaceholder', defaultMessage: 'Search and add groups'})}
/> />
</Modal.Body> </Modal.Body>
</Modal> </Modal>

Просмотреть файл

@@ -196,8 +196,8 @@ export class AddUserToGroupMultiSelect extends React.PureComponent<Props, State>
}; };
public render = (): JSX.Element => { public render = (): JSX.Element => {
const buttonSubmitText = this.props.buttonSubmitText || localizeMessage('multiselect.createGroup', 'Create Group'); const buttonSubmitText = this.props.buttonSubmitText || localizeMessage({id: 'multiselect.createGroup', defaultMessage: 'Create Group'});
const buttonSubmitLoadingText = this.props.buttonSubmitLoadingText || localizeMessage('multiselect.creating', 'Creating...'); const buttonSubmitLoadingText = this.props.buttonSubmitLoadingText || localizeMessage({id: 'multiselect.creating', defaultMessage: 'Creating...'});
let users = filterProfilesStartingWithTerm(this.props.profiles, this.state.term).filter((user) => { let users = filterProfilesStartingWithTerm(this.props.profiles, this.state.term).filter((user) => {
return user.delete_at === 0 && return user.delete_at === 0 &&
@@ -214,7 +214,7 @@ export class AddUserToGroupMultiSelect extends React.PureComponent<Props, State>
if (this.state.values.length >= MAX_SELECTABLE_VALUES) { if (this.state.values.length >= MAX_SELECTABLE_VALUES) {
maxValues = MAX_SELECTABLE_VALUES; maxValues = MAX_SELECTABLE_VALUES;
numRemainingText = localizeMessage('multiselect.maxGroupMembers', 'No more than 256 members can be added to a group at once.'); numRemainingText = localizeMessage({id: 'multiselect.maxGroupMembers', defaultMessage: 'No more than 256 members can be added to a group at once.'});
} }
return ( return (
@@ -237,7 +237,7 @@ export class AddUserToGroupMultiSelect extends React.PureComponent<Props, State>
buttonSubmitLoadingText={buttonSubmitLoadingText} buttonSubmitLoadingText={buttonSubmitLoadingText}
saving={this.props.saving} saving={this.props.saving}
loading={this.state.loadingUsers} loading={this.state.loadingUsers}
placeholderText={localizeMessage('multiselect.placeholder', 'Search for people')} placeholderText={localizeMessage({id: 'multiselect.placeholder', defaultMessage: 'Search for people'})}
valueWithImage={true} valueWithImage={true}
focusOnLoad={this.props.focusOnLoad} focusOnLoad={this.props.focusOnLoad}
savingEnabled={this.props.savingEnabled} savingEnabled={this.props.savingEnabled}

Просмотреть файл

@@ -136,8 +136,8 @@ const AddUsersToGroupModal = (props: Props) => {
deleteUserCallback={deleteUserCallback} deleteUserCallback={deleteUserCallback}
groupId={props.groupId} groupId={props.groupId}
searchOptions={searchOptions} searchOptions={searchOptions}
buttonSubmitText={localizeMessage('multiselect.addPeopleToGroup', 'Add People')} buttonSubmitText={localizeMessage({id: 'multiselect.addPeopleToGroup', defaultMessage: 'Add People'})}
buttonSubmitLoadingText={localizeMessage('multiselect.adding', 'Adding...')} buttonSubmitLoadingText={localizeMessage({id: 'multiselect.adding', defaultMessage: 'Adding...'})}
backButtonClick={goBack} backButtonClick={goBack}
backButtonClass={'multiselect-back'} backButtonClass={'multiselect-back'}
saving={saving} saving={saving}

Просмотреть файл

@@ -192,8 +192,8 @@ export class AddUsersToTeamModal extends React.PureComponent<Props, State> {
</div> </div>
); );
const buttonSubmitText = localizeMessage('multiselect.add', 'Add'); const buttonSubmitText = localizeMessage({id: 'multiselect.add', defaultMessage: 'Add'});
const buttonSubmitLoadingText = localizeMessage('multiselect.adding', 'Adding...'); const buttonSubmitLoadingText = localizeMessage({id: 'multiselect.adding', defaultMessage: 'Adding...'});
let addError = null; let addError = null;
if (this.state.addError) { if (this.state.addError) {
@@ -259,7 +259,7 @@ export class AddUsersToTeamModal extends React.PureComponent<Props, State> {
buttonSubmitLoadingText={buttonSubmitLoadingText} buttonSubmitLoadingText={buttonSubmitLoadingText}
saving={this.state.saving} saving={this.state.saving}
loading={this.state.loading} loading={this.state.loading}
placeholderText={localizeMessage('multiselect.placeholder', 'Search and add members')} placeholderText={localizeMessage({id: 'multiselect.placeholder', defaultMessage: 'Search and add members'})}
/> />
</Modal.Body> </Modal.Body>
</Modal> </Modal>

Просмотреть файл

@@ -150,7 +150,7 @@ const CompanyInfoEdit: React.FC<Props> = () => {
type='text' type='text'
value={address} value={address}
onChange={updateState(setAddress)} onChange={updateState(setAddress)}
placeholder={Utils.localizeMessage('admin.billing.company_info.address', 'Address')} placeholder={Utils.localizeMessage({id: 'admin.billing.company_info.address', defaultMessage: 'Address'})}
required={true} required={true}
/> />
</div> </div>
@@ -160,7 +160,7 @@ const CompanyInfoEdit: React.FC<Props> = () => {
type='text' type='text'
value={address2} value={address2}
onChange={updateState(setAddress2)} onChange={updateState(setAddress2)}
placeholder={Utils.localizeMessage('admin.billing.company_info.address_2', 'Address 2')} placeholder={Utils.localizeMessage({id: 'admin.billing.company_info.address_2', defaultMessage: 'Address 2'})}
/> />
</div> </div>
<div className='form-row'> <div className='form-row'>
@@ -169,7 +169,7 @@ const CompanyInfoEdit: React.FC<Props> = () => {
type='text' type='text'
value={city} value={city}
onChange={updateState(setCity)} onChange={updateState(setCity)}
placeholder={Utils.localizeMessage('admin.billing.company_info.city', 'City')} placeholder={Utils.localizeMessage({id: 'admin.billing.company_info.city', defaultMessage: 'City'})}
required={true} required={true}
/> />
</div> </div>
@@ -190,7 +190,7 @@ const CompanyInfoEdit: React.FC<Props> = () => {
type='text' type='text'
value={postalCode} value={postalCode}
onChange={updateState(setPostalCode)} onChange={updateState(setPostalCode)}
placeholder={Utils.localizeMessage('admin.billing.company_info.zipcode', 'Zip/Postal Code')} placeholder={Utils.localizeMessage({id: 'admin.billing.company_info.zipcode', defaultMessage: 'Zip/Postal Code'})}
required={true} required={true}
/> />
</div> </div>
@@ -228,7 +228,7 @@ const CompanyInfoEdit: React.FC<Props> = () => {
type='text' type='text'
value={companyName} value={companyName}
onChange={updateState(setCompanyName)} onChange={updateState(setCompanyName)}
placeholder={Utils.localizeMessage('admin.billing.company_info.companyName', 'Company name')} placeholder={Utils.localizeMessage({id: 'admin.billing.company_info.companyName', defaultMessage: 'Company name'})}
required={true} required={true}
/> />
</div> </div>
@@ -238,7 +238,7 @@ const CompanyInfoEdit: React.FC<Props> = () => {
type='number' type='number'
value={numEmployees} value={numEmployees}
onChange={updateNumEmployees} onChange={updateNumEmployees}
placeholder={Utils.localizeMessage('admin.billing.company_info.numEmployees', 'Number of employees (optional)')} placeholder={Utils.localizeMessage({id: 'admin.billing.company_info.numEmployees', defaultMessage: 'Number of employees (optional)'})}
/> />
</div> </div>
<div className='section-title'> <div className='section-title'>

Просмотреть файл

@@ -98,15 +98,15 @@ export default class ClusterTable extends PureComponent<Props> {
let status = null; let status = null;
if (clusterInfo.hostname === '') { if (clusterInfo.hostname === '') {
clusterInfo.hostname = Utils.localizeMessage('admin.cluster.unknown', 'unknown'); clusterInfo.hostname = Utils.localizeMessage({id: 'admin.cluster.unknown', defaultMessage: 'unknown'});
} }
if (clusterInfo.version === '') { if (clusterInfo.version === '') {
clusterInfo.version = Utils.localizeMessage('admin.cluster.unknown', 'unknown'); clusterInfo.version = Utils.localizeMessage({id: 'admin.cluster.unknown', defaultMessage: 'unknown'});
} }
if (clusterInfo.config_hash === '') { if (clusterInfo.config_hash === '') {
clusterInfo.config_hash = Utils.localizeMessage('admin.cluster.unknown', 'unknown'); clusterInfo.config_hash = Utils.localizeMessage({id: 'admin.cluster.unknown', defaultMessage: 'unknown'});
} }
if (singleItem) { if (singleItem) {

Просмотреть файл

@@ -61,7 +61,7 @@ class DataGridSearch extends React.PureComponent<Props, State> {
let {placeholder} = this.props; let {placeholder} = this.props;
if (!placeholder) { if (!placeholder) {
placeholder = Utils.localizeMessage('search_bar.search', 'Search'); placeholder = Utils.localizeMessage({id: 'search_bar.search', defaultMessage: 'Search'});
} }
let filter; let filter;
@@ -81,7 +81,7 @@ class DataGridSearch extends React.PureComponent<Props, State> {
<input <input
type='text' type='text'
placeholder={Utils.localizeMessage('search_bar.search', 'Search')} placeholder={Utils.localizeMessage({id: 'search_bar.search', defaultMessage: 'Search'})}
onChange={this.handleSearch} onChange={this.handleSearch}
value={this.props.term} value={this.props.term}
data-testid='searchInput' data-testid='searchInput'

Просмотреть файл

@@ -235,7 +235,7 @@ export default class CustomPolicyForm extends React.PureComponent<Props, State>
let postDuration = parseInt(messageRetentionInputValue, 10); let postDuration = parseInt(messageRetentionInputValue, 10);
if (postDuration <= 0) { if (postDuration <= 0) {
this.setState({formErrorText: Utils.localizeMessage('admin.data_retention.custom_policy.form.durationInput.error', 'Error parsing message retention.'), saving: false}); this.setState({formErrorText: Utils.localizeMessage({id: 'admin.data_retention.custom_policy.form.durationInput.error', defaultMessage: 'Error parsing message retention.'}), saving: false});
return; return;
} }
if (messageRetentionDropdownValue.value === FOREVER) { if (messageRetentionDropdownValue.value === FOREVER) {
@@ -245,7 +245,7 @@ export default class CustomPolicyForm extends React.PureComponent<Props, State>
} }
if (!policyName?.trim()) { if (!policyName?.trim()) {
this.setState({inputErrorText: Utils.localizeMessage('admin.data_retention.custom_policy.form.input.error', 'Policy name can\'t be blank.'), saving: false}); this.setState({inputErrorText: Utils.localizeMessage({id: 'admin.data_retention.custom_policy.form.input.error', defaultMessage: 'Policy name can\'t be blank.'}), saving: false});
return; return;
} }
@@ -256,7 +256,7 @@ export default class CustomPolicyForm extends React.PureComponent<Props, State>
}; };
if (((policy?.team_count + teamsToAdd.length) - teamsToRemove.length) === 0 && ((policy?.channel_count + channelsToAdd.length) - channelsToRemove.length) === 0) { if (((policy?.team_count + teamsToAdd.length) - teamsToRemove.length) === 0 && ((policy?.channel_count + channelsToAdd.length) - channelsToRemove.length) === 0) {
this.setState({formErrorText: Utils.localizeMessage('admin.data_retention.custom_policy.form.teamsError', 'You must add a team or a channel to the policy.'), saving: false}); this.setState({formErrorText: Utils.localizeMessage({id: 'admin.data_retention.custom_policy.form.teamsError', defaultMessage: 'You must add a team or a channel to the policy.'}), saving: false});
return; return;
} }
@@ -282,7 +282,7 @@ export default class CustomPolicyForm extends React.PureComponent<Props, State>
} }
} else { } else {
if (teamsToAdd.length < 1 && channelsToAdd.length < 1) { if (teamsToAdd.length < 1 && channelsToAdd.length < 1) {
this.setState({formErrorText: Utils.localizeMessage('admin.data_retention.custom_policy.form.teamsError', 'You must add a team or a channel to the policy.'), saving: false}); this.setState({formErrorText: Utils.localizeMessage({id: 'admin.data_retention.custom_policy.form.teamsError', defaultMessage: 'You must add a team or a channel to the policy.'}), saving: false});
return; return;
} }
const newPolicy = { const newPolicy = {
@@ -359,7 +359,7 @@ export default class CustomPolicyForm extends React.PureComponent<Props, State>
this.setState({policyName: e.target.value, saveNeeded: true}); this.setState({policyName: e.target.value, saveNeeded: true});
this.props.actions.setNavigationBlocked(true); this.props.actions.setNavigationBlocked(true);
}} }}
placeholder={Utils.localizeMessage('admin.data_retention.custom_policy.form.input', 'Policy name')} placeholder={Utils.localizeMessage({id: 'admin.data_retention.custom_policy.form.input', defaultMessage: 'Policy name'})}
customMessage={{type: ItemStatus.ERROR, value: this.state.inputErrorText}} customMessage={{type: ItemStatus.ERROR, value: this.state.inputErrorText}}
/> />
<DropdownInputHybrid <DropdownInputHybrid
@@ -379,8 +379,8 @@ export default class CustomPolicyForm extends React.PureComponent<Props, State>
exceptionToInput={[FOREVER]} exceptionToInput={[FOREVER]}
defaultValue={keepForeverOption()} defaultValue={keepForeverOption()}
options={[daysOption(), yearsOption(), keepForeverOption()]} options={[daysOption(), yearsOption(), keepForeverOption()]}
legend={Utils.localizeMessage('admin.data_retention.form.channelAndDirectMessageRetention', 'Channel & direct message retention')} legend={Utils.localizeMessage({id: 'admin.data_retention.form.channelAndDirectMessageRetention', defaultMessage: 'Channel & direct message retention'})}
placeholder={Utils.localizeMessage('admin.data_retention.form.channelAndDirectMessageRetention', 'Channel & direct message retention')} placeholder={Utils.localizeMessage({id: 'admin.data_retention.form.channelAndDirectMessageRetention', defaultMessage: 'Channel & direct message retention'})}
inputType={'number'} inputType={'number'}
name={'message_retention'} name={'message_retention'}
dropdownClassNamePrefix={'message_retention'} dropdownClassNamePrefix={'message_retention'}

Просмотреть файл

@@ -9,7 +9,7 @@ export const FOREVER = 'FOREVER';
export const YEARS = 'YEARS'; export const YEARS = 'YEARS';
export const DAYS = 'DAYS'; export const DAYS = 'DAYS';
export const HOURS = 'HOURS'; export const HOURS = 'HOURS';
export const keepForeverOption = () => ({value: FOREVER, label: <div><i className='icon icon-infinity option-icon'/><span className='option_forever'>{Utils.localizeMessage('admin.data_retention.form.keepForever', 'Keep forever')}</span></div>}); export const keepForeverOption = () => ({value: FOREVER, label: <div><i className='icon icon-infinity option-icon'/><span className='option_forever'>{Utils.localizeMessage({id: 'admin.data_retention.form.keepForever', defaultMessage: 'Keep forever'})}</span></div>});
export const yearsOption = () => ({value: YEARS, label: <span className='option_years'>{Utils.localizeMessage('admin.data_retention.form.years', 'Years')}</span>}); export const yearsOption = () => ({value: YEARS, label: <span className='option_years'>{Utils.localizeMessage({id: 'admin.data_retention.form.years', defaultMessage: 'Years'})}</span>});
export const daysOption = () => ({value: DAYS, label: <span className='option_days'>{Utils.localizeMessage('admin.data_retention.form.days', 'Days')}</span>}); export const daysOption = () => ({value: DAYS, label: <span className='option_days'>{Utils.localizeMessage({id: 'admin.data_retention.form.days', defaultMessage: 'Days'})}</span>});
export const hoursOption = () => ({value: HOURS, label: <span className='option_hours'>{Utils.localizeMessage('admin.data_retention.form.hours', 'Hours')}</span>}); export const hoursOption = () => ({value: HOURS, label: <span className='option_hours'>{Utils.localizeMessage({id: 'admin.data_retention.form.hours', defaultMessage: 'Hours'})}</span>});

Просмотреть файл

@@ -103,7 +103,7 @@ export default class GlobalPolicyForm extends React.PureComponent<Props, State>
this.setState({saving: true}); this.setState({saving: true});
if ((messageRetentionDropdownValue.value !== FOREVER && parseInt(messageRetentionInputValue, 10) < 1) || (fileRetentionDropdownValue.value !== FOREVER && parseInt(fileRetentionInputValue, 10) < 1)) { if ((messageRetentionDropdownValue.value !== FOREVER && parseInt(messageRetentionInputValue, 10) < 1) || (fileRetentionDropdownValue.value !== FOREVER && parseInt(fileRetentionInputValue, 10) < 1)) {
this.setState({formErrorText: Utils.localizeMessage('admin.data_retention.global_policy.form.numberError', 'You must add a number greater than or equal to 1.'), saving: false}); this.setState({formErrorText: Utils.localizeMessage({id: 'admin.data_retention.global_policy.form.numberError', defaultMessage: 'You must add a number greater than or equal to 1.'}), saving: false});
return; return;
} }
@@ -185,7 +185,7 @@ export default class GlobalPolicyForm extends React.PureComponent<Props, State>
<div <div
className='global_policy' className='global_policy'
> >
<p>{Utils.localizeMessage('admin.data_retention.form.text', 'Applies to all teams and channels, but does not apply to custom retention policies.')}</p> <p>{Utils.localizeMessage({id: 'admin.data_retention.form.text', defaultMessage: 'Applies to all teams and channels, but does not apply to custom retention policies.'})}</p>
<div id='global_direct_message_dropdown'> <div id='global_direct_message_dropdown'>
<DropdownInputHybrid <DropdownInputHybrid
onDropdownChange={(value) => { onDropdownChange={(value) => {
@@ -205,8 +205,8 @@ export default class GlobalPolicyForm extends React.PureComponent<Props, State>
disabled={this.isMessageRetentionSetByEnv()} disabled={this.isMessageRetentionSetByEnv()}
defaultValue={keepForeverOption()} defaultValue={keepForeverOption()}
options={[hoursOption(), daysOption(), yearsOption(), keepForeverOption()]} options={[hoursOption(), daysOption(), yearsOption(), keepForeverOption()]}
legend={Utils.localizeMessage('admin.data_retention.form.channelAndDirectMessageRetention', 'Channel & direct message retention')} legend={Utils.localizeMessage({id: 'admin.data_retention.form.channelAndDirectMessageRetention', defaultMessage: 'Channel & direct message retention'})}
placeholder={Utils.localizeMessage('admin.data_retention.form.channelAndDirectMessageRetention', 'Channel & direct message retention')} placeholder={Utils.localizeMessage({id: 'admin.data_retention.form.channelAndDirectMessageRetention', defaultMessage: 'Channel & direct message retention'})}
name={'channel_message_retention'} name={'channel_message_retention'}
inputType={'number'} inputType={'number'}
dropdownClassNamePrefix={'channel_message_retention_dropdown'} dropdownClassNamePrefix={'channel_message_retention_dropdown'}
@@ -233,8 +233,8 @@ export default class GlobalPolicyForm extends React.PureComponent<Props, State>
disabled={this.isFileRetentionSetByEnv()} disabled={this.isFileRetentionSetByEnv()}
defaultValue={keepForeverOption()} defaultValue={keepForeverOption()}
options={[hoursOption(), daysOption(), yearsOption(), keepForeverOption()]} options={[hoursOption(), daysOption(), yearsOption(), keepForeverOption()]}
legend={Utils.localizeMessage('admin.data_retention.form.fileRetention', 'File retention')} legend={Utils.localizeMessage({id: 'admin.data_retention.form.fileRetention', defaultMessage: 'File retention'})}
placeholder={Utils.localizeMessage('admin.data_retention.form.fileRetention', 'File retention')} placeholder={Utils.localizeMessage({id: 'admin.data_retention.form.fileRetention', defaultMessage: 'File retention'})}
name={'file_retention'} name={'file_retention'}
inputType={'number'} inputType={'number'}
dropdownClassNamePrefix={'file_retention_dropdown'} dropdownClassNamePrefix={'file_retention_dropdown'}

Просмотреть файл

@@ -199,7 +199,7 @@ export default class TeamList extends React.PureComponent<Props, State> {
}} }}
href='#' href='#'
> >
{Utils.localizeMessage('admin.data_retention.custom_policy.teams.remove', 'Remove')} {Utils.localizeMessage({id: 'admin.data_retention.custom_policy.teams.remove', defaultMessage: 'Remove'})}
</a> </a>
), ),
}, },

Просмотреть файл

@@ -147,10 +147,10 @@ export default class FeatureDiscovery extends React.PureComponent<Props, State>
// by default we assume is not cloud, so the cta button is Start Trial (which will request a trial license) // by default we assume is not cloud, so the cta button is Start Trial (which will request a trial license)
let ctaPrimaryButton = ( let ctaPrimaryButton = (
<StartTrialBtn <StartTrialBtn
message={Utils.localizeMessage( message={Utils.localizeMessage({
'admin.ldap_feature_discovery.call_to_action.primary', id: 'admin.ldap_feature_discovery.call_to_action.primary',
'Start trial', defaultMessage: 'Start trial',
)} })}
telemetryId={`start_self_hosted_trial_from_${this.props.featureName}`} telemetryId={`start_self_hosted_trial_from_${this.props.featureName}`}
btnClass='btn btn-primary' btnClass='btn btn-primary'
renderAsButton={true} renderAsButton={true}

Просмотреть файл

@@ -99,10 +99,10 @@ State
<Menu <Menu
openLeft={true} openLeft={true}
openUp={true} openUp={true}
ariaLabel={localizeMessage( ariaLabel={localizeMessage({
'admin.team_channel_settings.group_row.memberRole', id: 'admin.team_channel_settings.group_row.memberRole',
'Member Role', defaultMessage: 'Member Role',
)} })}
id={`${name}_change_role_options`} id={`${name}_change_role_options`}
> >
<Menu.ItemAction <Menu.ItemAction

Просмотреть файл

@@ -471,7 +471,7 @@ export default class GroupsList extends React.PureComponent<Props, State> {
<div className='group-list-search'> <div className='group-list-search'>
<input <input
type='text' type='text'
placeholder={Utils.localizeMessage('search_bar.search', 'Search')} placeholder={Utils.localizeMessage({id: 'search_bar.search', defaultMessage: 'Search'})}
onKeyUp={(e: any) => this.handleGroupSearchKeyUp(e)} onKeyUp={(e: any) => this.handleGroupSearchKeyUp(e)}
onChange={(e) => this.setState({searchString: e.target.value})} onChange={(e) => this.setState({searchString: e.target.value})}
value={this.state.searchString} value={this.state.searchString}

Просмотреть файл

@@ -205,7 +205,7 @@ const UploadLicenseModal = (props: Props): JSX.Element | null => {
> >
<LoadingWrapper <LoadingWrapper
loading={Boolean(isUploading)} loading={Boolean(isUploading)}
text={localizeMessage('admin.license.modal.uploading', 'Uploading')} text={localizeMessage({id: 'admin.license.modal.uploading', defaultMessage: 'Uploading'})}
> >
<FormattedMessage <FormattedMessage
id='admin.license.modal.upload' id='admin.license.modal.upload'

Просмотреть файл

@@ -127,10 +127,10 @@ const TeamEditionRightPanel: React.FC<TeamEditionRightPanelProps> = ({
> >
<LoadingWrapper <LoadingWrapper
loading={restarting} loading={restarting}
text={localizeMessage( text={localizeMessage({
'admin.license.enterprise.restarting', id: 'admin.license.enterprise.restarting',
'Restarting', defaultMessage: 'Restarting',
)} })}
> >
<FormattedMessage <FormattedMessage
id='admin.license.enterprise.restart' id='admin.license.enterprise.restart'

Просмотреть файл

@@ -62,13 +62,13 @@ const ManageTeamsDropdown = (props: Props) => {
const {team} = props; const {team} = props;
let title; let title;
if (isSysAdmin) { if (isSysAdmin) {
title = localizeMessage('admin.user_item.sysAdmin', 'System Admin'); title = localizeMessage({id: 'admin.user_item.sysAdmin', defaultMessage: 'System Admin'});
} else if (isTeamAdmin) { } else if (isTeamAdmin) {
title = localizeMessage('admin.user_item.teamAdmin', 'Team Admin'); title = localizeMessage({id: 'admin.user_item.teamAdmin', defaultMessage: 'Team Admin'});
} else if (isGuestUser) { } else if (isGuestUser) {
title = localizeMessage('admin.user_item.guest', 'Guest'); title = localizeMessage({id: 'admin.user_item.guest', defaultMessage: 'Guest'});
} else { } else {
title = localizeMessage('admin.user_item.teamMember', 'Team Member'); title = localizeMessage({id: 'admin.user_item.teamMember', defaultMessage: 'Team Member'});
} }
return ( return (
@@ -79,22 +79,22 @@ const ManageTeamsDropdown = (props: Props) => {
</a> </a>
<Menu <Menu
openLeft={true} openLeft={true}
ariaLabel={localizeMessage('team_members_dropdown.menuAriaLabel', 'Change the role of a team member')} ariaLabel={localizeMessage({id: 'team_members_dropdown.menuAriaLabel', defaultMessage: 'Change the role of a team member'})}
> >
<Menu.ItemAction <Menu.ItemAction
show={!isTeamAdmin && !isGuestUser} show={!isTeamAdmin && !isGuestUser}
onClick={makeTeamAdmin} onClick={makeTeamAdmin}
text={localizeMessage('admin.user_item.makeTeamAdmin', 'Make Team Admin')} text={localizeMessage({id: 'admin.user_item.makeTeamAdmin', defaultMessage: 'Make Team Admin'})}
/> />
<Menu.ItemAction <Menu.ItemAction
show={isTeamAdmin} show={isTeamAdmin}
onClick={makeMember} onClick={makeMember}
text={localizeMessage('admin.user_item.makeMember', 'Make Team Member')} text={localizeMessage({id: 'admin.user_item.makeMember', defaultMessage: 'Make Team Member'})}
/> />
<Menu.ItemAction <Menu.ItemAction
show={!team.group_constrained} show={!team.group_constrained}
onClick={removeFromTeam} onClick={removeFromTeam}
text={localizeMessage('team_members_dropdown.leave_team', 'Remove from Team')} text={localizeMessage({id: 'team_members_dropdown.leave_team', defaultMessage: 'Remove from Team'})}
/> />
</Menu> </Menu>
</MenuWrapper> </MenuWrapper>

Просмотреть файл

@@ -78,7 +78,7 @@ export default class PermissionsSchemeSummary extends React.PureComponent<Props
const confirmButton = ( const confirmButton = (
<LoadingWrapper <LoadingWrapper
loading={this.state.deleting} loading={this.state.deleting}
text={Utils.localizeMessage('admin.permissions.permissionsSchemeSummary.deleting', 'Deleting...')} text={Utils.localizeMessage({id: 'admin.permissions.permissionsSchemeSummary.deleting', defaultMessage: 'Deleting...'})}
> >
<FormattedMessage <FormattedMessage
id='admin.permissions.permissionsSchemeSummary.deleteConfirmButton' id='admin.permissions.permissionsSchemeSummary.deleteConfirmButton'

Просмотреть файл

@@ -194,8 +194,8 @@ export class AddUsersToRoleModal extends React.PureComponent<Props, State> {
</div> </div>
); );
const buttonSubmitText = localizeMessage('multiselect.add', 'Add'); const buttonSubmitText = localizeMessage({id: 'multiselect.add', defaultMessage: 'Add'});
const buttonSubmitLoadingText = localizeMessage('multiselect.adding', 'Adding...'); const buttonSubmitLoadingText = localizeMessage({id: 'multiselect.adding', defaultMessage: 'Adding...'});
let addError = null; let addError = null;
if (this.state.addError) { if (this.state.addError) {
@@ -268,7 +268,7 @@ export class AddUsersToRoleModal extends React.PureComponent<Props, State> {
buttonSubmitLoadingText={buttonSubmitLoadingText} buttonSubmitLoadingText={buttonSubmitLoadingText}
saving={this.state.saving} saving={this.state.saving}
loading={this.state.loading} loading={this.state.loading}
placeholderText={localizeMessage('multiselect.placeholder', 'Search and add members')} placeholderText={localizeMessage({id: 'multiselect.placeholder', defaultMessage: 'Search and add members'})}
/> />
</Modal.Body> </Modal.Body>
</Modal> </Modal>

Просмотреть файл

@@ -118,7 +118,7 @@ export default class SystemRolePermissionDropdown extends React.PureComponent<Pr
break; break;
} }
const ariaLabel = Utils.localizeMessage('admin.permissions.system_role_permissions.change_access', 'Change role access on a system console section'); const ariaLabel = Utils.localizeMessage({id: 'admin.permissions.system_role_permissions.change_access', defaultMessage: 'Change role access on a system console section'});
return ( return (
<MenuWrapper <MenuWrapper
isDisabled={isDisabled} isDisabled={isDisabled}

Просмотреть файл

@@ -67,11 +67,11 @@ export default class GroupRow extends React.PureComponent<GroupRowProps> {
displayRoleToBe = () => { displayRoleToBe = () => {
const {group, type} = this.props; const {group, type} = this.props;
if (!group.scheme_admin && type === 'channel') { if (!group.scheme_admin && type === 'channel') {
return localizeMessage('admin.team_channel_settings.group_row.channelAdmin', 'Channel Admin'); return localizeMessage({id: 'admin.team_channel_settings.group_row.channelAdmin', defaultMessage: 'Channel Admin'});
} else if (!group.scheme_admin && type === 'team') { } else if (!group.scheme_admin && type === 'team') {
return localizeMessage('admin.team_channel_settings.group_row.teamAdmin', 'Team Admin'); return localizeMessage({id: 'admin.team_channel_settings.group_row.teamAdmin', defaultMessage: 'Team Admin'});
} }
return localizeMessage('admin.team_channel_settings.group_row.member', 'Member'); return localizeMessage({id: 'admin.team_channel_settings.group_row.member', defaultMessage: 'Member'});
}; };
render = () => { render = () => {
@@ -119,7 +119,7 @@ export default class GroupRow extends React.PureComponent<GroupRowProps> {
id='role-to-be-menu' id='role-to-be-menu'
openLeft={true} openLeft={true}
openUp={false} openUp={false}
ariaLabel={localizeMessage('admin.team_channel_settings.group_row.memberRole', 'Member Role')} ariaLabel={localizeMessage({id: 'admin.team_channel_settings.group_row.memberRole', defaultMessage: 'Member Role'})}
> >
<Menu.ItemAction <Menu.ItemAction
id='role-to-be' id='role-to-be'

Просмотреть файл

@@ -35,14 +35,14 @@ export default class UserGridRoleDropdown extends React.PureComponent<Props> {
private getDropDownOptions = () => { private getDropDownOptions = () => {
if (this.props.scope === 'team') { if (this.props.scope === 'team') {
return { return {
makeAdmin: Utils.localizeMessage('team_members_dropdown.makeAdmin', 'Make Team Admin'), makeAdmin: Utils.localizeMessage({id: 'team_members_dropdown.makeAdmin', defaultMessage: 'Make Team Admin'}),
makeMember: Utils.localizeMessage('team_members_dropdown.makeMember', 'Make Team Member'), makeMember: Utils.localizeMessage({id: 'team_members_dropdown.makeMember', defaultMessage: 'Make Team Member'}),
}; };
} }
return { return {
makeAdmin: Utils.localizeMessage('channel_members_dropdown.make_channel_admin', 'Make Channel Admin'), makeAdmin: Utils.localizeMessage({id: 'channel_members_dropdown.make_channel_admin', defaultMessage: 'Make Channel Admin'}),
makeMember: Utils.localizeMessage('channel_members_dropdown.make_channel_member', 'Make Channel Member'), makeMember: Utils.localizeMessage({id: 'channel_members_dropdown.make_channel_member', defaultMessage: 'Make Channel Member'}),
}; };
}; };
@@ -79,18 +79,18 @@ export default class UserGridRoleDropdown extends React.PureComponent<Props> {
private getLocalizedRole = (role: Role) => { private getLocalizedRole = (role: Role) => {
switch (role) { switch (role) {
case 'system_admin': case 'system_admin':
return Utils.localizeMessage('admin.user_grid.system_admin', 'System Admin'); return Utils.localizeMessage({id: 'admin.user_grid.system_admin', defaultMessage: 'System Admin'});
case 'team_admin': case 'team_admin':
return Utils.localizeMessage('admin.user_grid.team_admin', 'Team Admin'); return Utils.localizeMessage({id: 'admin.user_grid.team_admin', defaultMessage: 'Team Admin'});
case 'channel_admin': case 'channel_admin':
return Utils.localizeMessage('admin.user_grid.channel_admin', 'Channel Admin'); return Utils.localizeMessage({id: 'admin.user_grid.channel_admin', defaultMessage: 'Channel Admin'});
case 'shared_member': case 'shared_member':
return Utils.localizeMessage('admin.user_grid.shared_member', 'Shared Member'); return Utils.localizeMessage({id: 'admin.user_grid.shared_member', defaultMessage: 'Shared Member'});
case 'team_user': case 'team_user':
case 'channel_user': case 'channel_user':
return Utils.localizeMessage('admin.group_teams_and_channels_row.member', 'Member'); return Utils.localizeMessage({id: 'admin.group_teams_and_channels_row.member', defaultMessage: 'Member'});
default: default:
return Utils.localizeMessage('admin.user_grid.guest', 'Guest'); return Utils.localizeMessage({id: 'admin.user_grid.guest', defaultMessage: 'Guest'});
} }
}; };
@@ -113,9 +113,9 @@ export default class UserGridRoleDropdown extends React.PureComponent<Props> {
private getAriaLabel = () => { private getAriaLabel = () => {
const {scope} = this.props; const {scope} = this.props;
if (scope === 'team') { if (scope === 'team') {
return Utils.localizeMessage('team_members_dropdown.menuAriaLabel', 'Change the role of a team member'); return Utils.localizeMessage({id: 'team_members_dropdown.menuAriaLabel', defaultMessage: 'Change the role of a team member'});
} }
return Utils.localizeMessage('channel_members_dropdown.menuAriaLabel', 'Change the role of channel member'); return Utils.localizeMessage({id: 'channel_members_dropdown.menuAriaLabel', defaultMessage: 'Change the role of channel member'});
}; };
public render = (): React.ReactNode => { public render = (): React.ReactNode => {

Просмотреть файл

@@ -6,8 +6,8 @@ import * as Utils from 'utils/utils';
export function formatChannelDoughtnutData(totalPublic: any, totalPrivate: any) { export function formatChannelDoughtnutData(totalPublic: any, totalPrivate: any) {
const channelTypeData = { const channelTypeData = {
labels: [ labels: [
Utils.localizeMessage('analytics.system.publicChannels', 'Public Channels'), Utils.localizeMessage({id: 'analytics.system.publicChannels', defaultMessage: 'Public Channels'}),
Utils.localizeMessage('analytics.system.privateGroups', 'Private Channels'), Utils.localizeMessage({id: 'analytics.system.privateGroups', defaultMessage: 'Private Channels'}),
], ],
datasets: [{ datasets: [{
data: [totalPublic, totalPrivate], data: [totalPublic, totalPrivate],
@@ -22,9 +22,9 @@ export function formatChannelDoughtnutData(totalPublic: any, totalPrivate: any)
export function formatPostDoughtnutData(filePosts: any, hashtagPosts: any, totalPosts: any) { export function formatPostDoughtnutData(filePosts: any, hashtagPosts: any, totalPosts: any) {
const postTypeData = { const postTypeData = {
labels: [ labels: [
Utils.localizeMessage('analytics.system.totalFilePosts', 'Posts with Files'), Utils.localizeMessage({id: 'analytics.system.totalFilePosts', defaultMessage: 'Posts with Files'}),
Utils.localizeMessage('analytics.system.totalHashtagPosts', 'Posts with Hashtags'), Utils.localizeMessage({id: 'analytics.system.totalHashtagPosts', defaultMessage: 'Posts with Hashtags'}),
Utils.localizeMessage('analytics.system.textPosts', 'Posts with Text-only'), Utils.localizeMessage({id: 'analytics.system.textPosts', defaultMessage: 'Posts with Text-only'}),
], ],
datasets: [{ datasets: [{
data: [filePosts, hashtagPosts, (totalPosts - filePosts - hashtagPosts)], data: [filePosts, hashtagPosts, (totalPosts - filePosts - hashtagPosts)],

Просмотреть файл

@@ -518,10 +518,10 @@ export class AppsForm extends React.PureComponent<Props, State> {
autoFocus={!fields || fields.length === 0} autoFocus={!fields || fields.length === 0}
className='btn btn-primary save-button' className='btn btn-primary save-button'
spinning={Boolean(this.state.submitting)} spinning={Boolean(this.state.submitting)}
spinningText={localizeMessage( spinningText={localizeMessage({
'interactive_dialog.submitting', id: 'interactive_dialog.submitting',
'Submitting...', defaultMessage: 'Submitting...',
)} })}
> >
{submitText} {submitText}
</SpinnerButton> </SpinnerButton>

Просмотреть файл

@@ -51,7 +51,7 @@ const getPaging = (remainingProps: Props, childCount: number, hasFilter: boolean
return {startCount, endCount, total, isFirstPage, isLastPage}; return {startCount, endCount, total, isFirstPage, isLastPage};
}; };
const BackstageList = ({searchPlaceholder = localizeMessage('backstage_list.search', 'Search'), ...remainingProps}: Props) => { const BackstageList = ({searchPlaceholder = localizeMessage({id: 'backstage_list.search', defaultMessage: 'Search'}), ...remainingProps}: Props) => {
const {formatMessage} = useIntl(); const {formatMessage} = useIntl();
const [filter, setFilter] = useState(''); const [filter, setFilter] = useState('');

Просмотреть файл

@@ -314,7 +314,7 @@ export default class BrowseChannels extends React.PureComponent<Props, State> {
id='createNewChannelButton' id='createNewChannelButton'
className={buttonClassName} className={buttonClassName}
onClick={this.handleNewChannel} onClick={this.handleNewChannel}
aria-label={localizeMessage('more_channels.create', 'Create New Channel')} aria-label={localizeMessage({id: 'more_channels.create', defaultMessage: 'Create New Channel'})}
> >
{icon} {icon}
<FormattedMessage <FormattedMessage

Просмотреть файл

@@ -73,9 +73,9 @@ class ChannelGroupsManageModal extends React.PureComponent<Props> {
public renderRow = (item: Group, listModal: any) => { public renderRow = (item: Group, listModal: any) => {
let title; let title;
if (item.scheme_admin) { if (item.scheme_admin) {
title = Utils.localizeMessage('channel_members_dropdown.channel_admins', 'Channel Admins'); title = Utils.localizeMessage({id: 'channel_members_dropdown.channel_admins', defaultMessage: 'Channel Admins'});
} else { } else {
title = Utils.localizeMessage('channel_members_dropdown.channel_members', 'Channel Members'); title = Utils.localizeMessage({id: 'channel_members_dropdown.channel_members', defaultMessage: 'Channel Members'});
} }
return ( return (
@@ -116,21 +116,21 @@ class ChannelGroupsManageModal extends React.PureComponent<Props> {
</button> </button>
<Menu <Menu
openLeft={true} openLeft={true}
ariaLabel={Utils.localizeMessage('channel_members_dropdown.menuAriaLabel', 'Change the role of channel member')} ariaLabel={Utils.localizeMessage({id: 'channel_members_dropdown.menuAriaLabel', defaultMessage: 'Change the role of channel member'})}
> >
<Menu.ItemAction <Menu.ItemAction
show={!item.scheme_admin} show={!item.scheme_admin}
onClick={() => this.setChannelMemberStatus(item, listModal, true)} onClick={() => this.setChannelMemberStatus(item, listModal, true)}
text={Utils.localizeMessage('channel_members_dropdown.make_channel_admins', 'Make Channel Admins')} text={Utils.localizeMessage({id: 'channel_members_dropdown.make_channel_admins', defaultMessage: 'Make Channel Admins'})}
/> />
<Menu.ItemAction <Menu.ItemAction
show={Boolean(item.scheme_admin)} show={Boolean(item.scheme_admin)}
onClick={() => this.setChannelMemberStatus(item, listModal, false)} onClick={() => this.setChannelMemberStatus(item, listModal, false)}
text={Utils.localizeMessage('channel_members_dropdown.make_channel_members', 'Make Channel Members')} text={Utils.localizeMessage({id: 'channel_members_dropdown.make_channel_members', defaultMessage: 'Make Channel Members'})}
/> />
<Menu.ItemAction <Menu.ItemAction
onClick={() => this.onClickRemoveGroup(item, listModal)} onClick={() => this.onClickRemoveGroup(item, listModal)}
text={Utils.localizeMessage('group_list_modal.removeGroupButton', 'Remove Group')} text={Utils.localizeMessage({id: 'group_list_modal.removeGroupButton', defaultMessage: 'Remove Group'})}
/> />
</Menu> </Menu>
</MenuWrapper> </MenuWrapper>

Просмотреть файл

@@ -11,7 +11,7 @@ import {localizeMessage} from 'utils/utils';
const ChannelHeaderDropdown = () => ( const ChannelHeaderDropdown = () => (
<Menu <Menu
id='channelHeaderDropdownMenu' id='channelHeaderDropdownMenu'
ariaLabel={localizeMessage('channel_header.menuAriaLabel', 'Channel Menu').toLowerCase()} ariaLabel={localizeMessage({id: 'channel_header.menuAriaLabel', defaultMessage: 'Channel Menu'}).toLowerCase()}
> >
<ChannelHeaderDropdownItems isMobile={false}/> <ChannelHeaderDropdownItems isMobile={false}/>
</Menu> </Menu>

Просмотреть файл

@@ -135,7 +135,7 @@ export default class ChannelHeaderDropdown extends React.PureComponent<Props> {
channel, channel,
currentUser: user, currentUser: user,
}} }}
text={localizeMessage('navbar.preferences', 'Notification Preferences')} text={localizeMessage({id: 'navbar.preferences', defaultMessage: 'Notification Preferences'})}
/> />
<MenuItemToggleMuteChannel <MenuItemToggleMuteChannel
id='channelToggleMuteChannel' id='channelToggleMuteChannel'
@@ -157,7 +157,7 @@ export default class ChannelHeaderDropdown extends React.PureComponent<Props> {
modalId={ModalIdentifiers.CHANNEL_INVITE} modalId={ModalIdentifiers.CHANNEL_INVITE}
dialogType={ChannelInviteModal} dialogType={ChannelInviteModal}
dialogProps={{channel}} dialogProps={{channel}}
text={localizeMessage('navbar.addMembers', 'Add Members')} text={localizeMessage({id: 'navbar.addMembers', defaultMessage: 'Add Members'})}
/> />
<Menu.ItemToggleModalRedux <Menu.ItemToggleModalRedux
id='channelAddMembers' id='channelAddMembers'
@@ -165,14 +165,14 @@ export default class ChannelHeaderDropdown extends React.PureComponent<Props> {
modalId={ModalIdentifiers.CREATE_DM_CHANNEL} modalId={ModalIdentifiers.CREATE_DM_CHANNEL}
dialogType={MoreDirectChannels} dialogType={MoreDirectChannels}
dialogProps={{isExistingChannel: true}} dialogProps={{isExistingChannel: true}}
text={localizeMessage('navbar.addMembers', 'Add Members')} text={localizeMessage({id: 'navbar.addMembers', defaultMessage: 'Add Members'})}
/> />
</ChannelPermissionGate> </ChannelPermissionGate>
<MenuItemOpenMembersRHS <MenuItemOpenMembersRHS
id='channelViewMembers' id='channelViewMembers'
channel={channel} channel={channel}
show={channel.type !== Constants.DM_CHANNEL && channel.type !== Constants.GM_CHANNEL && (isArchived || isDefault)} show={channel.type !== Constants.DM_CHANNEL && channel.type !== Constants.GM_CHANNEL && (isArchived || isDefault)}
text={localizeMessage('channel_header.viewMembers', 'View Members')} text={localizeMessage({id: 'channel_header.viewMembers', defaultMessage: 'View Members'})}
/> />
<ChannelPermissionGate <ChannelPermissionGate
channelId={channel.id} channelId={channel.id}
@@ -184,7 +184,7 @@ export default class ChannelHeaderDropdown extends React.PureComponent<Props> {
show={channel.type !== Constants.DM_CHANNEL && channel.type !== Constants.GM_CHANNEL && !isArchived && !isDefault && isGroupConstrained && isLicensedForLDAPGroups} show={channel.type !== Constants.DM_CHANNEL && channel.type !== Constants.GM_CHANNEL && !isArchived && !isDefault && isGroupConstrained && isLicensedForLDAPGroups}
modalId={ModalIdentifiers.ADD_GROUPS_TO_CHANNEL} modalId={ModalIdentifiers.ADD_GROUPS_TO_CHANNEL}
dialogType={AddGroupsToChannelModal} dialogType={AddGroupsToChannelModal}
text={localizeMessage('navbar.addGroups', 'Add Groups')} text={localizeMessage({id: 'navbar.addGroups', defaultMessage: 'Add Groups'})}
/> />
<Menu.ItemToggleModalRedux <Menu.ItemToggleModalRedux
id='channelManageGroups' id='channelManageGroups'
@@ -192,13 +192,13 @@ export default class ChannelHeaderDropdown extends React.PureComponent<Props> {
modalId={ModalIdentifiers.MANAGE_CHANNEL_GROUPS} modalId={ModalIdentifiers.MANAGE_CHANNEL_GROUPS}
dialogType={ChannelGroupsManageModal} dialogType={ChannelGroupsManageModal}
dialogProps={{channelID: channel.id}} dialogProps={{channelID: channel.id}}
text={localizeMessage('navbar_dropdown.manageGroups', 'Manage Groups')} text={localizeMessage({id: 'navbar_dropdown.manageGroups', defaultMessage: 'Manage Groups'})}
/> />
<MenuItemOpenMembersRHS <MenuItemOpenMembersRHS
id='channelManageMembers' id='channelManageMembers'
channel={channel} channel={channel}
show={channel.type !== Constants.DM_CHANNEL && channel.type !== Constants.GM_CHANNEL && !isArchived && !isDefault} show={channel.type !== Constants.DM_CHANNEL && channel.type !== Constants.GM_CHANNEL && !isArchived && !isDefault}
text={localizeMessage('channel_header.manageMembers', 'Manage Members')} text={localizeMessage({id: 'channel_header.manageMembers', defaultMessage: 'Manage Members'})}
editMembers={!isArchived} editMembers={!isArchived}
/> />
</ChannelPermissionGate> </ChannelPermissionGate>
@@ -212,7 +212,7 @@ export default class ChannelHeaderDropdown extends React.PureComponent<Props> {
id='channelViewMembers' id='channelViewMembers'
channel={channel} channel={channel}
show={channel.type !== Constants.DM_CHANNEL && channel.type !== Constants.GM_CHANNEL && !isArchived && !isDefault} show={channel.type !== Constants.DM_CHANNEL && channel.type !== Constants.GM_CHANNEL && !isArchived && !isDefault}
text={localizeMessage('channel_header.viewMembers', 'View Members')} text={localizeMessage({id: 'channel_header.viewMembers', defaultMessage: 'View Members'})}
/> />
</ChannelPermissionGate> </ChannelPermissionGate>
</Menu.Group> </Menu.Group>
@@ -224,7 +224,7 @@ export default class ChannelHeaderDropdown extends React.PureComponent<Props> {
modalId={ModalIdentifiers.EDIT_CHANNEL_HEADER} modalId={ModalIdentifiers.EDIT_CHANNEL_HEADER}
dialogType={EditChannelHeaderModal} dialogType={EditChannelHeaderModal}
dialogProps={{channel}} dialogProps={{channel}}
text={localizeMessage('channel_header.setConversationHeader', 'Edit Conversation Header')} text={localizeMessage({id: 'channel_header.setConversationHeader', defaultMessage: 'Edit Conversation Header'})}
/> />
<Menu.ItemToggleModalRedux <Menu.ItemToggleModalRedux
@@ -233,7 +233,7 @@ export default class ChannelHeaderDropdown extends React.PureComponent<Props> {
modalId={ModalIdentifiers.CONVERT_GM_TO_CHANNEL} modalId={ModalIdentifiers.CONVERT_GM_TO_CHANNEL}
dialogType={ConvertGmToChannelModal} dialogType={ConvertGmToChannelModal}
dialogProps={{channel}} dialogProps={{channel}}
text={localizeMessage('sidebar_left.sidebar_channel_menu_convert_to_channel', 'Convert to Private Channel')} text={localizeMessage({id: 'sidebar_left.sidebar_channel_menu_convert_to_channel', defaultMessage: 'Convert to Private Channel'})}
/> />
</Menu.Group> </Menu.Group>
@@ -249,7 +249,7 @@ export default class ChannelHeaderDropdown extends React.PureComponent<Props> {
modalId={ModalIdentifiers.EDIT_CHANNEL_HEADER} modalId={ModalIdentifiers.EDIT_CHANNEL_HEADER}
dialogType={EditChannelHeaderModal} dialogType={EditChannelHeaderModal}
dialogProps={{channel}} dialogProps={{channel}}
text={localizeMessage('channel_header.setHeader', 'Edit Channel Header')} text={localizeMessage({id: 'channel_header.setHeader', defaultMessage: 'Edit Channel Header'})}
/> />
<Menu.ItemToggleModalRedux <Menu.ItemToggleModalRedux
id='channelEditPurpose' id='channelEditPurpose'
@@ -257,7 +257,7 @@ export default class ChannelHeaderDropdown extends React.PureComponent<Props> {
modalId={ModalIdentifiers.EDIT_CHANNEL_PURPOSE} modalId={ModalIdentifiers.EDIT_CHANNEL_PURPOSE}
dialogType={EditChannelPurposeModal} dialogType={EditChannelPurposeModal}
dialogProps={{channel}} dialogProps={{channel}}
text={localizeMessage('channel_header.setPurpose', 'Edit Channel Purpose')} text={localizeMessage({id: 'channel_header.setPurpose', defaultMessage: 'Edit Channel Purpose'})}
/> />
<Menu.ItemToggleModalRedux <Menu.ItemToggleModalRedux
id='channelRename' id='channelRename'
@@ -265,7 +265,7 @@ export default class ChannelHeaderDropdown extends React.PureComponent<Props> {
modalId={ModalIdentifiers.RENAME_CHANNEL} modalId={ModalIdentifiers.RENAME_CHANNEL}
dialogType={RenameChannelModal} dialogType={RenameChannelModal}
dialogProps={{channel}} dialogProps={{channel}}
text={localizeMessage('channel_header.rename', 'Rename Channel')} text={localizeMessage({id: 'channel_header.rename', defaultMessage: 'Rename Channel'})}
/> />
</ChannelPermissionGate> </ChannelPermissionGate>
<ChannelPermissionGate <ChannelPermissionGate
@@ -282,7 +282,7 @@ export default class ChannelHeaderDropdown extends React.PureComponent<Props> {
channelId: channel.id, channelId: channel.id,
channelDisplayName: channel.display_name, channelDisplayName: channel.display_name,
}} }}
text={localizeMessage('channel_header.convert', 'Convert to Private Channel')} text={localizeMessage({id: 'channel_header.convert', defaultMessage: 'Convert to Private Channel'})}
/> />
</ChannelPermissionGate> </ChannelPermissionGate>
<MenuItemLeaveChannel <MenuItemLeaveChannel
@@ -306,7 +306,7 @@ export default class ChannelHeaderDropdown extends React.PureComponent<Props> {
channel, channel,
penultimateViewedChannelName, penultimateViewedChannelName,
}} }}
text={localizeMessage('channel_header.delete', 'Archive Channel')} text={localizeMessage({id: 'channel_header.delete', defaultMessage: 'Archive Channel'})}
/> />
</ChannelPermissionGate> </ChannelPermissionGate>
{isMobile && {isMobile &&
@@ -340,7 +340,7 @@ export default class ChannelHeaderDropdown extends React.PureComponent<Props> {
dialogProps={{ dialogProps={{
channel, channel,
}} }}
text={localizeMessage('channel_header.unarchive', 'Unarchive Channel')} text={localizeMessage({id: 'channel_header.unarchive', defaultMessage: 'Unarchive Channel'})}
/> />
</ChannelPermissionGate> </ChannelPermissionGate>
</Menu.Group> </Menu.Group>

Просмотреть файл

@@ -96,9 +96,9 @@ export default class CloseMessage extends React.PureComponent<Props> {
let text; let text;
if (channel.type === Constants.DM_CHANNEL) { if (channel.type === Constants.DM_CHANNEL) {
text = localizeMessage('center_panel.direct.closeDirectMessage', 'Close Direct Message'); text = localizeMessage({id: 'center_panel.direct.closeDirectMessage', defaultMessage: 'Close Direct Message'});
} else if (channel.type === Constants.GM_CHANNEL) { } else if (channel.type === Constants.GM_CHANNEL) {
text = localizeMessage('center_panel.direct.closeGroupMessage', 'Close Group Message'); text = localizeMessage({id: 'center_panel.direct.closeGroupMessage', defaultMessage: 'Close Group Message'});
} }
return ( return (

Просмотреть файл

@@ -30,7 +30,7 @@ const ToggleInfo = ({show, channel, rhsOpen, actions}: Props) => {
actions.showChannelInfo(channel.id); actions.showChannelInfo(channel.id);
}; };
const text = rhsOpen ? localizeMessage('channelHeader.hideInfo', 'Close Info') : localizeMessage('channelHeader.viewInfo', 'View Info'); const text = rhsOpen ? localizeMessage({id: 'channelHeader.hideInfo', defaultMessage: 'Close Info'}) : localizeMessage({id: 'channelHeader.viewInfo', defaultMessage: 'View Info'});
return ( return (
<Menu.ItemAction <Menu.ItemAction

Просмотреть файл

@@ -19,7 +19,7 @@ type Props = {
const NavbarInfoButton: React.FunctionComponent<Props> = ({channel, actions}: Props): JSX.Element => ( const NavbarInfoButton: React.FunctionComponent<Props> = ({channel, actions}: Props): JSX.Element => (
<button <button
className='navbar-toggle navbar-right__icon navbar-info-button pull-right' className='navbar-toggle navbar-right__icon navbar-info-button pull-right'
aria-label={localizeMessage('accessibility.button.Info', 'Info')} aria-label={localizeMessage({id: 'accessibility.button.Info', defaultMessage: 'Info'})}
onClick={() => actions.showChannelInfo(channel.id)} onClick={() => actions.showChannelInfo(channel.id)}
> >
<InfoIcon <InfoIcon

Просмотреть файл

@@ -25,7 +25,7 @@ const ShowSearchButton = ({actions}: Props) => {
type='button' type='button'
className='navbar-toggle navbar-right__icon navbar-search pull-right' className='navbar-toggle navbar-right__icon navbar-search pull-right'
onClick={handleClick} onClick={handleClick}
aria-label={localizeMessage('accessibility.button.Search', 'Search')} aria-label={localizeMessage({id: 'accessibility.button.Search', defaultMessage: 'Search'})}
> >
<SearchIcon <SearchIcon
className='icon icon__search' className='icon icon__search'

Просмотреть файл

@@ -454,8 +454,8 @@ export class ChannelInviteModal extends React.PureComponent<Props, State> {
inviteError = (<label className='has-error control-label'>{this.state.inviteError}</label>); inviteError = (<label className='has-error control-label'>{this.state.inviteError}</label>);
} }
const buttonSubmitText = localizeMessage('multiselect.add', 'Add'); const buttonSubmitText = localizeMessage({id: 'multiselect.add', defaultMessage: 'Add'});
const buttonSubmitLoadingText = localizeMessage('multiselect.adding', 'Adding...'); const buttonSubmitLoadingText = localizeMessage({id: 'multiselect.adding', defaultMessage: 'Adding...'});
const closeMembersInviteModal = () => { const closeMembersInviteModal = () => {
this.props.actions.closeModal(ModalIdentifiers.CHANNEL_INVITE); this.props.actions.closeModal(ModalIdentifiers.CHANNEL_INVITE);
@@ -517,9 +517,9 @@ export class ChannelInviteModal extends React.PureComponent<Props, State> {
buttonSubmitLoadingText={buttonSubmitLoadingText} buttonSubmitLoadingText={buttonSubmitLoadingText}
saving={this.state.saving} saving={this.state.saving}
loading={this.state.loadingUsers} loading={this.state.loadingUsers}
placeholderText={this.props.isGroupsEnabled ? localizeMessage('multiselect.placeholder.peopleOrGroups', 'Search for people or groups') : localizeMessage('multiselect.placeholder', 'Search for people')} placeholderText={this.props.isGroupsEnabled ? localizeMessage({id: 'multiselect.placeholder.peopleOrGroups', defaultMessage: 'Search for people or groups'}) : localizeMessage({id: 'multiselect.placeholder', defaultMessage: 'Search for people'})}
valueWithImage={true} valueWithImage={true}
backButtonText={localizeMessage('multiselect.cancel', 'Cancel')} backButtonText={localizeMessage({id: 'multiselect.cancel', defaultMessage: 'Cancel'})}
backButtonClick={closeMembersInviteModal} backButtonClick={closeMembersInviteModal}
backButtonClass={'btn-tertiary tertiary-button'} backButtonClass={'btn-tertiary tertiary-button'}
customNoOptionsMessage={this.props.emailInvitationsEnabled ? customNoOptionsMessage : null} customNoOptionsMessage={this.props.emailInvitationsEnabled ? customNoOptionsMessage : null}

Просмотреть файл

@@ -159,7 +159,7 @@ export default function ChannelMembersDropdown({
const canMakeUserChannelMember = canChangeMemberRoles && isChannelAdmin; const canMakeUserChannelMember = canChangeMemberRoles && isChannelAdmin;
const canMakeUserChannelAdmin = canChangeMemberRoles && isMember; const canMakeUserChannelAdmin = canChangeMemberRoles && isMember;
const canRemoveUserFromChannel = canRemoveMember && (!channel.group_constrained || user.is_bot) && (!isDefaultChannel || isGuest); const canRemoveUserFromChannel = canRemoveMember && (!channel.group_constrained || user.is_bot) && (!isDefaultChannel || isGuest);
const removeFromChannelText = user.id === currentUserId ? Utils.localizeMessage('channel_header.leave', 'Leave Channel') : Utils.localizeMessage('channel_members_dropdown.remove_from_channel', 'Remove from Channel'); const removeFromChannelText = user.id === currentUserId ? Utils.localizeMessage({id: 'channel_header.leave', defaultMessage: 'Leave Channel'}) : Utils.localizeMessage({id: 'channel_members_dropdown.remove_from_channel', defaultMessage: 'Remove from Channel'});
const removeFromChannelTestId = user.id === currentUserId ? 'leaveChannel' : 'removeFromChannel'; const removeFromChannelTestId = user.id === currentUserId ? 'leaveChannel' : 'removeFromChannel';
if (canMakeUserChannelMember || canMakeUserChannelAdmin || canRemoveUserFromChannel) { if (canMakeUserChannelMember || canMakeUserChannelAdmin || canRemoveUserFromChannel) {
@@ -177,7 +177,7 @@ export default function ChannelMembersDropdown({
id={`${user.username}-make-channel-admin`} id={`${user.username}-make-channel-admin`}
show={canMakeUserChannelAdmin} show={canMakeUserChannelAdmin}
onClick={handleMakeChannelAdmin} onClick={handleMakeChannelAdmin}
text={Utils.localizeMessage('channel_members_dropdown.make_channel_admin', 'Make Channel Admin')} text={Utils.localizeMessage({id: 'channel_members_dropdown.make_channel_admin', defaultMessage: 'Make Channel Admin'})}
/> />
); );
const makeMemberMenu = ( const makeMemberMenu = (
@@ -185,7 +185,7 @@ export default function ChannelMembersDropdown({
id={`${user.username}-make-channel-member`} id={`${user.username}-make-channel-member`}
show={canMakeUserChannelMember} show={canMakeUserChannelMember}
onClick={handleMakeChannelMember} onClick={handleMakeChannelMember}
text={Utils.localizeMessage('channel_members_dropdown.make_channel_member', 'Make Channel Member')} text={Utils.localizeMessage({id: 'channel_members_dropdown.make_channel_member', defaultMessage: 'Make Channel Member'})}
/> />
); );
return ( return (
@@ -201,7 +201,7 @@ export default function ChannelMembersDropdown({
<Menu <Menu
openLeft={true} openLeft={true}
openUp={totalUsers > ROWS_FROM_BOTTOM_TO_OPEN_UP && totalUsers - index <= ROWS_FROM_BOTTOM_TO_OPEN_UP} openUp={totalUsers > ROWS_FROM_BOTTOM_TO_OPEN_UP && totalUsers - index <= ROWS_FROM_BOTTOM_TO_OPEN_UP}
ariaLabel={Utils.localizeMessage('channel_members_dropdown.menuAriaLabel', 'Change the role of channel member')} ariaLabel={Utils.localizeMessage({id: 'channel_members_dropdown.menuAriaLabel', defaultMessage: 'Change the role of channel member'})}
> >
{canMakeUserChannelMember ? makeMemberMenu : null} {canMakeUserChannelMember ? makeMemberMenu : null}
{canMakeUserChannelAdmin ? makeAdminMenu : null} {canMakeUserChannelAdmin ? makeAdminMenu : null}

Просмотреть файл

@@ -37,11 +37,11 @@ function validateDisplayName(displayNameParam: string) {
const displayName = displayNameParam.trim(); const displayName = displayNameParam.trim();
if (displayName.length < Constants.MIN_CHANNELNAME_LENGTH) { if (displayName.length < Constants.MIN_CHANNELNAME_LENGTH) {
errors.push(localizeMessage('channel_modal.name.longer', 'Channel names must have at least 2 characters.')); errors.push(localizeMessage({id: 'channel_modal.name.longer', defaultMessage: 'Channel names must have at least 2 characters.'}));
} }
if (displayName.length > Constants.MAX_CHANNELNAME_LENGTH) { if (displayName.length > Constants.MAX_CHANNELNAME_LENGTH) {
errors.push(localizeMessage('channel_modal.name.shorter', 'Channel names must have maximum 64 characters.')); errors.push(localizeMessage({id: 'channel_modal.name.shorter', defaultMessage: 'Channel names must have maximum 64 characters.'}));
} }
return errors; return errors;

Просмотреть файл

@@ -208,7 +208,7 @@ export class ChannelSelectorModal extends React.PureComponent<Props, State> {
/> />
); );
const buttonSubmitText = localizeMessage('multiselect.add', 'Add'); const buttonSubmitText = localizeMessage({id: 'multiselect.add', defaultMessage: 'Add'});
let options = this.state.channels.map((i): ChannelWithTeamDataValue => ({...i, label: i.display_name, value: i.id})); let options = this.state.channels.map((i): ChannelWithTeamDataValue => ({...i, label: i.display_name, value: i.id}));
if (this.props.alreadySelected) { if (this.props.alreadySelected) {
@@ -261,7 +261,7 @@ export class ChannelSelectorModal extends React.PureComponent<Props, State> {
buttonSubmitText={buttonSubmitText} buttonSubmitText={buttonSubmitText}
saving={false} saving={false}
loading={this.state.loadingChannels} loading={this.state.loadingChannels}
placeholderText={localizeMessage('multiselect.addChannelsPlaceholder', 'Search and add channels')} placeholderText={localizeMessage({id: 'multiselect.addChannelsPlaceholder', defaultMessage: 'Search and add channels'})}
/> />
</Modal.Body> </Modal.Body>
</Modal> </Modal>

Просмотреть файл

@@ -46,7 +46,7 @@ const LDAPToEmail = (props: Props) => {
const ldapPassword = ldapPasswordInput.current?.value; const ldapPassword = ldapPasswordInput.current?.value;
if (!ldapPassword) { if (!ldapPassword) {
setLdapPasswordError(localizeMessage('claim.ldap_to_email.ldapPasswordError', 'Please enter your AD/LDAP password.')); setLdapPasswordError(localizeMessage({id: 'claim.ldap_to_email.ldapPasswordError', defaultMessage: 'Please enter your AD/LDAP password.'}));
setPasswordError(''); setPasswordError('');
setConfirmError(''); setConfirmError('');
setServerError(''); setServerError('');
@@ -55,7 +55,7 @@ const LDAPToEmail = (props: Props) => {
const password = passwordInput.current?.value; const password = passwordInput.current?.value;
if (!password) { if (!password) {
setPasswordError(localizeMessage('claim.ldap_to_email.pwdError', 'Please enter your password.')); setPasswordError(localizeMessage({id: 'claim.ldap_to_email.pwdError', defaultMessage: 'Please enter your password.'}));
setConfirmError(''); setConfirmError('');
setLdapPasswordError(''); setLdapPasswordError('');
setServerError(''); setServerError('');
@@ -75,7 +75,7 @@ const LDAPToEmail = (props: Props) => {
const confirmPassword = passwordConfirmInput.current?.value; const confirmPassword = passwordConfirmInput.current?.value;
if (!confirmPassword || password !== confirmPassword) { if (!confirmPassword || password !== confirmPassword) {
setConfirmError(localizeMessage('claim.ldap_to_email.pwdNotMatch', 'Passwords do not match.')); setConfirmError(localizeMessage({id: 'claim.ldap_to_email.pwdNotMatch', defaultMessage: 'Passwords do not match.'}));
setPasswordError(''); setPasswordError('');
setLdapPasswordError(''); setLdapPasswordError('');
setServerError(''); setServerError('');

Просмотреть файл

@@ -36,7 +36,7 @@ const OAuthToEmail = (props: Props) => {
const password = passwordInput.current?.value; const password = passwordInput.current?.value;
if (!password) { if (!password) {
setError(localizeMessage('claim.oauth_to_email.enterPwd', 'Please enter a password.')); setError(localizeMessage({id: 'claim.oauth_to_email.enterPwd', defaultMessage: 'Please enter a password.'}));
return; return;
} }
@@ -50,7 +50,7 @@ const OAuthToEmail = (props: Props) => {
const confirmPassword = passwordConfirmInput.current?.value; const confirmPassword = passwordConfirmInput.current?.value;
if (!confirmPassword || password !== confirmPassword) { if (!confirmPassword || password !== confirmPassword) {
setError(localizeMessage('claim.oauth_to_email.pwdNotMatch', 'Passwords do not match.')); setError(localizeMessage({id: 'claim.oauth_to_email.pwdNotMatch', defaultMessage: 'Passwords do not match.'}));
return; return;
} }

Просмотреть файл

@@ -107,7 +107,7 @@ export class CreateUserGroupsModal extends React.PureComponent<Props, State> {
const displayName = this.state.name; const displayName = this.state.name;
if (!displayName || !displayName.trim()) { if (!displayName || !displayName.trim()) {
this.setState({nameInputErrorText: Utils.localizeMessage('user_groups_modal.nameIsEmpty', 'Name is a required field.'), saving: false}); this.setState({nameInputErrorText: Utils.localizeMessage({id: 'user_groups_modal.nameIsEmpty', defaultMessage: 'Name is a required field.'}), saving: false});
return; return;
} }
@@ -120,18 +120,18 @@ export class CreateUserGroupsModal extends React.PureComponent<Props, State> {
} }
if (mention.length < 1) { if (mention.length < 1) {
this.setState({mentionInputErrorText: Utils.localizeMessage('user_groups_modal.mentionIsEmpty', 'Mention is a required field.'), saving: false}); this.setState({mentionInputErrorText: Utils.localizeMessage({id: 'user_groups_modal.mentionIsEmpty', defaultMessage: 'Mention is a required field.'}), saving: false});
return; return;
} }
if (Constants.SPECIAL_MENTIONS.includes(mention.toLowerCase())) { if (Constants.SPECIAL_MENTIONS.includes(mention.toLowerCase())) {
this.setState({mentionInputErrorText: Utils.localizeMessage('user_groups_modal.mentionReservedWord', 'Mention contains a reserved word.'), saving: false}); this.setState({mentionInputErrorText: Utils.localizeMessage({id: 'user_groups_modal.mentionReservedWord', defaultMessage: 'Mention contains a reserved word.'}), saving: false});
return; return;
} }
const mentionRegEx = new RegExp(/^[a-z0-9.\-_]+$/); const mentionRegEx = new RegExp(/^[a-z0-9.\-_]+$/);
if (!mentionRegEx.test(mention)) { if (!mentionRegEx.test(mention)) {
this.setState({mentionInputErrorText: Utils.localizeMessage('user_groups_modal.mentionInvalidError', 'Invalid character in mention.'), saving: false}); this.setState({mentionInputErrorText: Utils.localizeMessage({id: 'user_groups_modal.mentionInvalidError', defaultMessage: 'Invalid character in mention.'}), saving: false});
return; return;
} }
@@ -149,9 +149,9 @@ export class CreateUserGroupsModal extends React.PureComponent<Props, State> {
if (data?.error) { if (data?.error) {
if (data.error?.server_error_id === 'app.custom_group.unique_name') { if (data.error?.server_error_id === 'app.custom_group.unique_name') {
this.setState({mentionInputErrorText: Utils.localizeMessage('user_groups_modal.mentionNotUnique', 'Mention needs to be unique.')}); this.setState({mentionInputErrorText: Utils.localizeMessage({id: 'user_groups_modal.mentionNotUnique', defaultMessage: 'Mention needs to be unique.'})});
} else if (data.error?.server_error_id === 'app.group.username_conflict') { } else if (data.error?.server_error_id === 'app.group.username_conflict') {
this.setState({mentionInputErrorText: Utils.localizeMessage('user_groups_modal.mentionUsernameConflict', 'A username already exists with this name. Mention must be unique.')}); this.setState({mentionInputErrorText: Utils.localizeMessage({id: 'user_groups_modal.mentionUsernameConflict', defaultMessage: 'A username already exists with this name. Mention must be unique.'})});
} else { } else {
this.setState({showUnknownError: true}); this.setState({showUnknownError: true});
} }
@@ -217,7 +217,7 @@ export class CreateUserGroupsModal extends React.PureComponent<Props, State> {
<div className='group-name-input-wrapper'> <div className='group-name-input-wrapper'>
<Input <Input
type='text' type='text'
placeholder={Utils.localizeMessage('user_groups_modal.name', 'Name')} placeholder={Utils.localizeMessage({id: 'user_groups_modal.name', defaultMessage: 'Name'})}
onChange={this.updateNameState} onChange={this.updateNameState}
value={this.state.name} value={this.state.name}
data-testid='nameInput' data-testid='nameInput'
@@ -229,7 +229,7 @@ export class CreateUserGroupsModal extends React.PureComponent<Props, State> {
<div className='group-mention-input-wrapper'> <div className='group-mention-input-wrapper'>
<Input <Input
type='text' type='text'
placeholder={Utils.localizeMessage('user_groups_modal.mention', 'Mention')} placeholder={Utils.localizeMessage({id: 'user_groups_modal.mention', defaultMessage: 'Mention'})}
onChange={this.updateMentionState} onChange={this.updateMentionState}
value={this.state.mention} value={this.state.mention}
maxLength={64} maxLength={64}
@@ -251,7 +251,7 @@ export class CreateUserGroupsModal extends React.PureComponent<Props, State> {
savingEnabled={this.isSaveEnabled()} savingEnabled={this.isSaveEnabled()}
addUserCallback={this.addUserCallback} addUserCallback={this.addUserCallback}
deleteUserCallback={this.deleteUserCallback} deleteUserCallback={this.deleteUserCallback}
backButtonText={localizeMessage('multiselect.cancelButton', 'Cancel')} backButtonText={localizeMessage({id: 'multiselect.cancelButton', defaultMessage: 'Cancel'})}
backButtonClick={ backButtonClick={
typeof this.props.backButtonCallback === 'function' ? this.goBack : this.doHide typeof this.props.backButtonCallback === 'function' ? this.goBack : this.doHide
} }

Просмотреть файл

@@ -237,7 +237,7 @@ export default class DndCustomTimePicker extends React.PureComponent<Props, Stat
<CompassThemeProvider theme={this.props.theme}> <CompassThemeProvider theme={this.props.theme}>
<GenericModal <GenericModal
compassDesign={true} compassDesign={true}
ariaLabel={localizeMessage('dnd_custom_time_picker_modal.defaultMsg', 'Disable notifications until')} ariaLabel={localizeMessage({id: 'dnd_custom_time_picker_modal.defaultMsg', defaultMessage: 'Disable notifications until'})}
onExited={this.props.onExited} onExited={this.props.onExited}
modalHeaderText={modalHeaderText} modalHeaderText={modalHeaderText}
confirmButtonText={confirmButtonText} confirmButtonText={confirmButtonText}
@@ -260,7 +260,7 @@ export default class DndCustomTimePicker extends React.PureComponent<Props, Stat
readOnly={true} readOnly={true}
id='DndModal__calendar-input' id='DndModal__calendar-input'
className={classNames('DndModal__calendar-input', {'popper-open': isPopperOpen})} className={classNames('DndModal__calendar-input', {'popper-open': isPopperOpen})}
label={localizeMessage('dnd_custom_time_picker_modal.date', 'Date')} label={localizeMessage({id: 'dnd_custom_time_picker_modal.date', defaultMessage: 'Date'})}
onClick={() => this.handlePopperOpenState(true)} onClick={() => this.handlePopperOpenState(true)}
tabIndex={-1} tabIndex={-1}
inputPrefix={inputIcon} inputPrefix={inputIcon}

Просмотреть файл

@@ -297,7 +297,7 @@ export class DotMenuClass extends React.PureComponent<Props, State> {
this.props.actions.setEditingPost( this.props.actions.setEditingPost(
this.props.post.id, this.props.post.id,
this.props.location === Locations.CENTER ? 'post_textbox' : 'reply_textbox', this.props.location === Locations.CENTER ? 'post_textbox' : 'reply_textbox',
this.props.post.root_id ? Utils.localizeMessage('rhs_comment.comment', 'Comment') : Utils.localizeMessage('create_post.post', 'Post'), this.props.post.root_id ? Utils.localizeMessage({id: 'rhs_comment.comment', defaultMessage: 'Comment'}) : Utils.localizeMessage({id: 'create_post.post', defaultMessage: 'Post'}),
this.props.location === Locations.RHS_ROOT || this.props.location === Locations.RHS_COMMENT || this.props.location === Locations.SEARCH, this.props.location === Locations.RHS_ROOT || this.props.location === Locations.RHS_COMMENT || this.props.location === Locations.SEARCH,
); );
trackDotMenuEvent(e, TELEMETRY_LABELS.EDIT); trackDotMenuEvent(e, TELEMETRY_LABELS.EDIT);

Просмотреть файл

@@ -140,7 +140,7 @@ export default class EditCategoryModal extends React.PureComponent<Props, State>
return ( return (
<GenericModal <GenericModal
id='editCategoryModal' id='editCategoryModal'
ariaLabel={localizeMessage('rename_category_modal.renameCategory', 'Rename Category')} ariaLabel={localizeMessage({id: 'rename_category_modal.renameCategory', defaultMessage: 'Rename Category'})}
modalHeaderText={modalHeaderText} modalHeaderText={modalHeaderText}
confirmButtonText={editButtonText} confirmButtonText={editButtonText}
compassDesign={true} compassDesign={true}
@@ -156,7 +156,7 @@ export default class EditCategoryModal extends React.PureComponent<Props, State>
className='form-control filter-textbox' className='form-control filter-textbox'
type='text' type='text'
value={this.state.categoryName} value={this.state.categoryName}
placeholder={localizeMessage('edit_category_modal.placeholder', 'Name your category')} placeholder={localizeMessage({id: 'edit_category_modal.placeholder', defaultMessage: 'Name your category'})}
clearable={true} clearable={true}
onClear={this.handleClear} onClear={this.handleClear}
onChange={this.handleChange} onChange={this.handleChange}

Просмотреть файл

@@ -389,7 +389,7 @@ export default class AddEmoji extends React.PureComponent<AddEmojiProps, AddEmoj
className='btn btn-primary' className='btn btn-primary'
type='submit' type='submit'
spinning={this.state.saving} spinning={this.state.saving}
spinningText={localizeMessage('add_emoji.saving', 'Saving...')} spinningText={localizeMessage({id: 'add_emoji.saving', defaultMessage: 'Saving...'})}
onClick={this.handleSaveButtonClick} onClick={this.handleSaveButtonClick}
> >
<FormattedMessage <FormattedMessage

Просмотреть файл

@@ -93,7 +93,7 @@ const ErrorTitle: React.FC<Props> = ({type, title}: Props) => {
} else if (title) { } else if (title) {
errorTitle = <>{title}</>; errorTitle = <>{title}</>;
} else { } else {
errorTitle = <>{Utils.localizeMessage('error.generic.title', 'Error')}</>; errorTitle = <>{Utils.localizeMessage({id: 'error.generic.title', defaultMessage: 'Error'})}</>;
} }
return errorTitle; return errorTitle;

Просмотреть файл

@@ -85,12 +85,12 @@ export default class FilenameOverlay extends React.PureComponent<Props> {
<div className={iconClass || 'post-image__name'}> <div className={iconClass || 'post-image__name'}>
<WithTooltip <WithTooltip
id='file-name__tooltip' id='file-name__tooltip'
title={localizeMessage('view_image_popover.download', 'Download')} title={localizeMessage({id: 'view_image_popover.download', defaultMessage: 'Download'})}
placement='top' placement='top'
> >
<ExternalLink <ExternalLink
href={getFileDownloadUrl(fileInfo.id)} href={getFileDownloadUrl(fileInfo.id)}
aria-label={localizeMessage('view_image_popover.download', 'Download').toLowerCase()} aria-label={localizeMessage({id: 'view_image_popover.download', defaultMessage: 'Download'}).toLowerCase()}
download={fileName} download={fileName}
location='filename_overlay' location='filename_overlay'
> >

Просмотреть файл

@@ -23,14 +23,14 @@ const FileInfoPreview = ({
if (fileInfo.extension !== '') { if (fileInfo.extension !== '') {
infoParts.push( infoParts.push(
Utils.localizeMessage('file_info_preview.type', 'File type ') + Utils.localizeMessage({id: 'file_info_preview.type', defaultMessage: 'File type '}) +
fileInfo.extension.toUpperCase(), fileInfo.extension.toUpperCase(),
); );
} }
if (fileInfo.size) { if (fileInfo.size) {
infoParts.push( infoParts.push(
Utils.localizeMessage('file_info_preview.size', 'Size ') + Utils.localizeMessage({id: 'file_info_preview.size', defaultMessage: 'Size '}) +
Utils.fileSizeToString(fileInfo.size), Utils.fileSizeToString(fileInfo.size),
); );
} }

Просмотреть файл

@@ -365,7 +365,7 @@ export default class FilePreviewModal extends React.PureComponent<Props, State>
} }
} else { } else {
// display a progress indicator when the preview for an image is still loading // display a progress indicator when the preview for an image is still loading
const loading = Utils.localizeMessage('view_image.loading', 'Loading'); const loading = Utils.localizeMessage({id: 'view_image.loading', defaultMessage: 'Loading'});
const progress = Math.floor(this.state.progress[this.state.imageIndex]); const progress = Math.floor(this.state.progress[this.state.imageIndex]);
content = ( content = (

Просмотреть файл

@@ -147,7 +147,7 @@ export default class FileSearchResultItem extends React.PureComponent<Props, Sta
{this.props.fileInfo.post_id && ( {this.props.fileInfo.post_id && (
<WithTooltip <WithTooltip
id='file-name__tooltip' id='file-name__tooltip'
title={localizeMessage('file_search_result_item.more_actions', 'More Actions')} title={localizeMessage({id: 'file_search_result_item.more_actions', defaultMessage: 'More Actions'})}
placement={'top'} placement={'top'}
> >
<MenuWrapper <MenuWrapper
@@ -166,13 +166,13 @@ export default class FileSearchResultItem extends React.PureComponent<Props, Sta
> >
<Menu.ItemAction <Menu.ItemAction
onClick={this.jumpToConv} onClick={this.jumpToConv}
ariaLabel={localizeMessage('file_search_result_item.open_in_channel', 'Open in channel')} ariaLabel={localizeMessage({id: 'file_search_result_item.open_in_channel', defaultMessage: 'Open in channel'})}
text={localizeMessage('file_search_result_item.open_in_channel', 'Open in channel')} text={localizeMessage({id: 'file_search_result_item.open_in_channel', defaultMessage: 'Open in channel'})}
/> />
<Menu.ItemAction <Menu.ItemAction
onClick={this.copyLink} onClick={this.copyLink}
ariaLabel={localizeMessage('file_search_result_item.copy_link', 'Copy link')} ariaLabel={localizeMessage({id: 'file_search_result_item.copy_link', defaultMessage: 'Copy link'})}
text={localizeMessage('file_search_result_item.copy_link', 'Copy link')} text={localizeMessage({id: 'file_search_result_item.copy_link', defaultMessage: 'Copy link'})}
/> />
{this.renderPluginItems()} {this.renderPluginItems()}
</Menu> </Menu>
@@ -181,7 +181,7 @@ export default class FileSearchResultItem extends React.PureComponent<Props, Sta
)} )}
<WithTooltip <WithTooltip
id='file-name__tooltip' id='file-name__tooltip'
title={localizeMessage('file_search_result_item.download', 'Download')} title={localizeMessage({id: 'file_search_result_item.download', defaultMessage: 'Download'})}
placement={'top'} placement={'top'}
> >
<a <a

Просмотреть файл

@@ -326,7 +326,7 @@ export class FileUpload extends PureComponent<Props, State> {
handleDrop = (e: DragEvent<HTMLInputElement>) => { handleDrop = (e: DragEvent<HTMLInputElement>) => {
if (!this.props.canUploadFiles) { if (!this.props.canUploadFiles) {
this.props.onUploadError(localizeMessage('file_upload.disabled', 'File attachments are disabled.')); this.props.onUploadError(localizeMessage({id: 'file_upload.disabled', defaultMessage: 'File attachments are disabled.'}));
return; return;
} }
@@ -356,7 +356,7 @@ export class FileUpload extends PureComponent<Props, State> {
} }
if (files.length === 0) { if (files.length === 0) {
this.props.onUploadError(localizeMessage('file_upload.drag_folder', 'This attachment cannot be uploaded.')); this.props.onUploadError(localizeMessage({id: 'file_upload.drag_folder', defaultMessage: 'This attachment cannot be uploaded.'}));
return; return;
} }
@@ -491,7 +491,7 @@ export class FileUpload extends PureComponent<Props, State> {
e.preventDefault(); e.preventDefault();
if (!this.props.canUploadFiles) { if (!this.props.canUploadFiles) {
this.props.onUploadError(localizeMessage('file_upload.disabled', 'File attachments are disabled.')); this.props.onUploadError(localizeMessage({id: 'file_upload.disabled', defaultMessage: 'File attachments are disabled.'}));
return; return;
} }
const postTextbox = this.props.postType === 'post' && document.activeElement?.id === 'post_textbox'; const postTextbox = this.props.postType === 'post' && document.activeElement?.id === 'post_textbox';

Просмотреть файл

@@ -83,7 +83,7 @@ const HistoryButtons = (): JSX.Element => {
compact={true} compact={true}
inverted={true} inverted={true}
disabled={!canGoBack} disabled={!canGoBack}
aria-label={Utils.localizeMessage('sidebar_left.channel_navigator.goBackLabel', 'Back')} aria-label={Utils.localizeMessage({id: 'sidebar_left.channel_navigator.goBackLabel', defaultMessage: 'Back'})}
/> />
</WithTooltip> </WithTooltip>
<WithTooltip <WithTooltip
@@ -98,7 +98,7 @@ const HistoryButtons = (): JSX.Element => {
compact={true} compact={true}
inverted={true} inverted={true}
disabled={!canGoForward} disabled={!canGoForward}
aria-label={Utils.localizeMessage('sidebar_left.channel_navigator.goForwardLabel', 'Forward')} aria-label={Utils.localizeMessage({id: 'sidebar_left.channel_navigator.goForwardLabel', defaultMessage: 'Forward'})}
/> />
</WithTooltip> </WithTooltip>
</HistoryButtonsContainer> </HistoryButtonsContainer>

Просмотреть файл

@@ -570,10 +570,10 @@ export class AbstractCommand extends React.PureComponent<Props, State> {
onChange={this.updateMethod} onChange={this.updateMethod}
> >
<option value={REQUEST_POST}> <option value={REQUEST_POST}>
{Utils.localizeMessage('add_command.method.post', 'POST')} {Utils.localizeMessage({id: 'add_command.method.post', defaultMessage: 'POST'})}
</option> </option>
<option value={REQUEST_GET}> <option value={REQUEST_GET}>
{Utils.localizeMessage('add_command.method.get', 'GET')} {Utils.localizeMessage({id: 'add_command.method.get', defaultMessage: 'GET'})}
</option> </option>
</select> </select>
<div className='form__help'> <div className='form__help'>
@@ -691,7 +691,7 @@ export class AbstractCommand extends React.PureComponent<Props, State> {
className='btn btn-primary' className='btn btn-primary'
type='submit' type='submit'
spinning={this.state.saving} spinning={this.state.saving}
spinningText={typeof this.props.loading === 'string' ? this.props.loading : Utils.localizeMessage(this.props.loading?.id ?? '', this.props.loading?.defaultMessage as string)} spinningText={typeof this.props.loading === 'string' ? this.props.loading : Utils.localizeMessage({id: this.props.loading?.id ?? '', defaultMessage: this.props.loading?.defaultMessage as string})}
onClick={this.handleSubmit} onClick={this.handleSubmit}
id='saveCommand' id='saveCommand'
> >

Просмотреть файл

@@ -383,7 +383,7 @@ export default class AbstractIncomingWebhook extends PureComponent<Props, State>
className='btn btn-primary' className='btn btn-primary'
type='submit' type='submit'
spinning={this.state.saving} spinning={this.state.saving}
spinningText={localizeMessage(this.props.loading.id as string, this.props.loading.defaultMessage as string)} spinningText={localizeMessage({id: this.props.loading.id as string, defaultMessage: this.props.loading.defaultMessage as string})}
onClick={(e) => this.handleSubmit(e)} onClick={(e) => this.handleSubmit(e)}
id='saveWebhook' id='saveWebhook'
> >

Просмотреть файл

@@ -477,7 +477,7 @@ export default class AbstractOAuthApp extends React.PureComponent<Props, State>
className='btn btn-primary' className='btn btn-primary'
type='submit' type='submit'
spinning={this.state.saving} spinning={this.state.saving}
spinningText={localizeMessage(this.props.loading?.id || '', (this.props.loading?.defaultMessage || '') as string)} spinningText={localizeMessage({id: this.props.loading?.id || '', defaultMessage: (this.props.loading?.defaultMessage || '') as string})}
onClick={this.handleSubmit} onClick={this.handleSubmit}
id='saveOauthApp' id='saveOauthApp'
> >

Просмотреть файл

@@ -462,12 +462,12 @@ export default class AbstractOutgoingWebhook extends React.PureComponent<Props,
<option <option
value='0' value='0'
> >
{localizeMessage('add_outgoing_webhook.triggerWordsTriggerWhenFullWord', 'First word matches a trigger word exactly')} {localizeMessage({id: 'add_outgoing_webhook.triggerWordsTriggerWhenFullWord', defaultMessage: 'First word matches a trigger word exactly'})}
</option> </option>
<option <option
value='1' value='1'
> >
{localizeMessage('add_outgoing_webhook.triggerWordsTriggerWhenStartsWith', 'First word starts with a trigger word')} {localizeMessage({id: 'add_outgoing_webhook.triggerWordsTriggerWhenStartsWith', defaultMessage: 'First word starts with a trigger word'})}
</option> </option>
</select> </select>
<div className='form__help'> <div className='form__help'>
@@ -594,7 +594,7 @@ export default class AbstractOutgoingWebhook extends React.PureComponent<Props,
className='btn btn-primary' className='btn btn-primary'
type='submit' type='submit'
spinning={this.state.saving} spinning={this.state.saving}
spinningText={localizeMessage(this.props.loading.id as string, this.props.loading.defaultMessage as string)} spinningText={localizeMessage({id: this.props.loading.id as string, defaultMessage: this.props.loading.defaultMessage as string})}
onClick={this.handleSubmit} onClick={this.handleSubmit}
id='saveWebhook' id='saveWebhook'
> >

Просмотреть файл

@@ -280,7 +280,7 @@ export default class AddBot extends React.PureComponent<Props, State> {
data = result.data; data = result.data;
error = result.error; error = result.error;
} else { } else {
error = Utils.localizeMessage('bot.edit_failed', 'Failed to edit bot'); error = Utils.localizeMessage({id: 'bot.edit_failed', defaultMessage: 'Failed to edit bot'});
} }
if (!error && data) { if (!error && data) {
@@ -334,7 +334,7 @@ export default class AddBot extends React.PureComponent<Props, State> {
data = result.data; data = result.data;
error = result.error; error = result.error;
} else { } else {
error = Utils.localizeMessage('bot.create_failed', 'Failed to create bot'); error = Utils.localizeMessage({id: 'bot.create_failed', defaultMessage: 'Failed to create bot'});
} }
let token = ''; let token = '';
@@ -345,7 +345,7 @@ export default class AddBot extends React.PureComponent<Props, State> {
await this.props.actions.setDefaultProfileImage(data.user_id); await this.props.actions.setDefaultProfileImage(data.user_id);
} }
const tokenResult = await this.props.actions.createUserAccessToken(data.user_id, const tokenResult = await this.props.actions.createUserAccessToken(data.user_id,
Utils.localizeMessage('bot.token.default.description', 'Default Token'), Utils.localizeMessage({id: 'bot.token.default.description', defaultMessage: 'Default Token'}),
); );
// On error just skip the confirmation because we have a bot without a token. // On error just skip the confirmation because we have a bot without a token.
@@ -608,12 +608,12 @@ export default class AddBot extends React.PureComponent<Props, State> {
<option <option
value={roleOptionMember} value={roleOptionMember}
> >
{Utils.localizeMessage('bot.add.role.member', 'Member')} {Utils.localizeMessage({id: 'bot.add.role.member', defaultMessage: 'Member'})}
</option> </option>
<option <option
value={roleOptionSystemAdmin} value={roleOptionSystemAdmin}
> >
{Utils.localizeMessage('bot.add.role.admin', 'System Admin')} {Utils.localizeMessage({id: 'bot.add.role.admin', defaultMessage: 'System Admin'})}
</option> </option>
</select> </select>
<div className='form__help'> <div className='form__help'>

Просмотреть файл

@@ -269,7 +269,7 @@ export default class Bots extends React.PureComponent<Props, State> {
/> />
</React.Fragment> </React.Fragment>
} }
searchPlaceholder={Utils.localizeMessage('bots.manage.search', 'Search Bot Accounts')} searchPlaceholder={Utils.localizeMessage({id: 'bots.manage.search', defaultMessage: 'Search Bot Accounts'})}
loading={this.state.loading} loading={this.state.loading}
> >
{this.bots} {this.bots}

Просмотреть файл

@@ -53,12 +53,12 @@ export default class InstalledCommands extends React.PureComponent<Props> {
private commandCompare(a: Command, b: Command) { private commandCompare(a: Command, b: Command) {
let nameA = a.display_name; let nameA = a.display_name;
if (!nameA) { if (!nameA) {
nameA = Utils.localizeMessage('installed_commands.unnamed_command', 'Unnamed Slash Command'); nameA = Utils.localizeMessage({id: 'installed_commands.unnamed_command', defaultMessage: 'Unnamed Slash Command'});
} }
let nameB = b.display_name; let nameB = b.display_name;
if (!nameB) { if (!nameB) {
nameB = Utils.localizeMessage('installed_commands.unnamed_command', 'Unnamed Slash Command'); nameB = Utils.localizeMessage({id: 'installed_commands.unnamed_command', defaultMessage: 'Unnamed Slash Command'});
} }
return nameA.localeCompare(nameB); return nameA.localeCompare(nameB);
@@ -142,7 +142,7 @@ export default class InstalledCommands extends React.PureComponent<Props> {
}} }}
/> />
} }
searchPlaceholder={Utils.localizeMessage('installed_commands.search', 'Search Slash Commands')} searchPlaceholder={Utils.localizeMessage({id: 'installed_commands.search', defaultMessage: 'Search Slash Commands'})}
loading={this.props.loading} loading={this.props.loading}
> >
{(filter: string) => { {(filter: string) => {

Просмотреть файл

@@ -92,7 +92,7 @@ export default class InstalledIncomingWebhooks extends React.PureComponent<Props
if (channelA) { if (channelA) {
displayNameA = channelA.display_name; displayNameA = channelA.display_name;
} else { } else {
displayNameA = Utils.localizeMessage('installed_incoming_webhooks.unknown_channel', 'A Private Webhook'); displayNameA = Utils.localizeMessage({id: 'installed_incoming_webhooks.unknown_channel', defaultMessage: 'A Private Webhook'});
} }
} }
@@ -178,7 +178,7 @@ export default class InstalledIncomingWebhooks extends React.PureComponent<Props
}} }}
/> />
} }
searchPlaceholder={Utils.localizeMessage('installed_incoming_webhooks.search', 'Search Incoming Webhooks')} searchPlaceholder={Utils.localizeMessage({id: 'installed_incoming_webhooks.search', defaultMessage: 'Search Incoming Webhooks'})}
loading={this.state.loading} loading={this.state.loading}
nextPage={this.nextPage} nextPage={this.nextPage}
previousPage={this.previousPage} previousPage={this.previousPage}

Просмотреть файл

@@ -160,9 +160,9 @@ export default class InstalledOAuthApp extends React.PureComponent<InstalledOAut
let isTrusted; let isTrusted;
if (oauthApp.is_trusted) { if (oauthApp.is_trusted) {
isTrusted = Utils.localizeMessage('installed_oauth_apps.trusted.yes', 'Yes'); isTrusted = Utils.localizeMessage({id: 'installed_oauth_apps.trusted.yes', defaultMessage: 'Yes'});
} else { } else {
isTrusted = Utils.localizeMessage('installed_oauth_apps.trusted.no', 'No'); isTrusted = Utils.localizeMessage({id: 'installed_oauth_apps.trusted.no', defaultMessage: 'No'});
} }
let showHide; let showHide;

Просмотреть файл

@@ -96,12 +96,12 @@ export default class InstalledOAuthApps extends React.PureComponent<Props, State
oauthAppCompare(a: OAuthApp, b: OAuthApp): number { oauthAppCompare(a: OAuthApp, b: OAuthApp): number {
let nameA = a.name.toString(); let nameA = a.name.toString();
if (!nameA) { if (!nameA) {
nameA = localizeMessage('installed_integrations.unnamed_oauth_app', 'Unnamed OAuth 2.0 Application'); nameA = localizeMessage({id: 'installed_integrations.unnamed_oauth_app', defaultMessage: 'Unnamed OAuth 2.0 Application'});
} }
let nameB = b.name.toString(); let nameB = b.name.toString();
if (!nameB) { if (!nameB) {
nameB = localizeMessage('installed_integrations.unnamed_oauth_app', 'Unnamed OAuth 2.0 Application'); nameB = localizeMessage({id: 'installed_integrations.unnamed_oauth_app', defaultMessage: 'Unnamed OAuth 2.0 Application'});
} }
return nameA.localeCompare(nameB); return nameA.localeCompare(nameB);
@@ -133,7 +133,7 @@ export default class InstalledOAuthApps extends React.PureComponent<Props, State
if (integrationsEnabled) { if (integrationsEnabled) {
props = { props = {
addLink: '/' + this.props.team.name + '/integrations/oauth2-apps/add', addLink: '/' + this.props.team.name + '/integrations/oauth2-apps/add',
addText: localizeMessage('installed_oauth_apps.add', 'Add OAuth 2.0 Application'), addText: localizeMessage({id: 'installed_oauth_apps.add', defaultMessage: 'Add OAuth 2.0 Application'}),
addButtonId: 'addOauthApp', addButtonId: 'addOauthApp',
}; };
} }
@@ -188,7 +188,7 @@ export default class InstalledOAuthApps extends React.PureComponent<Props, State
defaultMessage='No OAuth 2.0 Applications match {searchTerm}' defaultMessage='No OAuth 2.0 Applications match {searchTerm}'
/> />
} }
searchPlaceholder={localizeMessage('installed_oauth_apps.search', 'Search OAuth 2.0 Applications')} searchPlaceholder={localizeMessage({id: 'installed_oauth_apps.search', defaultMessage: 'Search OAuth 2.0 Applications'})}
loading={this.state.loading} loading={this.state.loading}
{...props} {...props}
> >

Просмотреть файл

@@ -121,7 +121,7 @@ export default class InstalledOutgoingWebhooks extends React.PureComponent<Props
if (channelA) { if (channelA) {
displayNameA = channelA.display_name; displayNameA = channelA.display_name;
} else { } else {
displayNameA = localizeMessage('installed_outgoing_webhooks.unknown_channel', 'A Private Webhook'); displayNameA = localizeMessage({id: 'installed_outgoing_webhooks.unknown_channel', defaultMessage: 'A Private Webhook'});
} }
} }
@@ -131,7 +131,7 @@ export default class InstalledOutgoingWebhooks extends React.PureComponent<Props
if (channelB) { if (channelB) {
displayNameB = channelB.display_name; displayNameB = channelB.display_name;
} else { } else {
displayNameB = localizeMessage('installed_outgoing_webhooks.unknown_channel', 'A Private Webhook'); displayNameB = localizeMessage({id: 'installed_outgoing_webhooks.unknown_channel', defaultMessage: 'A Private Webhook'});
} }
} }
return displayNameA.localeCompare(displayNameB); return displayNameA.localeCompare(displayNameB);
@@ -220,10 +220,10 @@ export default class InstalledOutgoingWebhooks extends React.PureComponent<Props
}} }}
/> />
} }
searchPlaceholder={localizeMessage( searchPlaceholder={localizeMessage({
'installed_outgoing_webhooks.search', id: 'installed_outgoing_webhooks.search',
'Search Outgoing Webhooks', defaultMessage: 'Search Outgoing Webhooks',
)} })}
loading={this.state.loading} loading={this.state.loading}
> >
{(filter: string) => { {(filter: string) => {

Просмотреть файл

@@ -39,7 +39,7 @@ export default class Integrations extends React.PureComponent <Props> {
updateTitle = () => { updateTitle = () => {
const currentSiteName = this.props.siteName || ''; const currentSiteName = this.props.siteName || '';
document.title = Utils.localizeMessage('admin.sidebar.integrations', 'Integrations') + ' - ' + this.props.team.display_name + ' ' + currentSiteName; document.title = Utils.localizeMessage({id: 'admin.sidebar.integrations', defaultMessage: 'Integrations'}) + ' - ' + this.props.team.display_name + ' ' + currentSiteName;
}; };
render() { render() {

Просмотреть файл

@@ -10,6 +10,7 @@ import IntlProvider from 'components/intl_provider/intl_provider';
import {getLanguageInfo} from 'i18n/i18n'; import {getLanguageInfo} from 'i18n/i18n';
describe('components/IntlProvider', () => { describe('components/IntlProvider', () => {
const messageId = 'test.hello_world';
const baseProps = { const baseProps = {
locale: 'en', locale: 'en',
translations: { translations: {
@@ -20,7 +21,7 @@ describe('components/IntlProvider', () => {
}, },
children: ( children: (
<FormattedMessage <FormattedMessage
id='test.hello_world' id={messageId}
defaultMessage='Hello, World!' defaultMessage='Hello, World!'
/> />
), ),

Просмотреть файл

@@ -97,7 +97,7 @@ class Setup extends React.PureComponent<Props, State> {
e.preventDefault(); e.preventDefault();
const code = this.input?.current?.value.replace(/\s/g, ''); const code = this.input?.current?.value.replace(/\s/g, '');
if (!code || code.length === 0) { if (!code || code.length === 0) {
this.setState({error: Utils.localizeMessage('mfa.setup.codeError', 'Please enter the code from Google Authenticator.')}); this.setState({error: Utils.localizeMessage({id: 'mfa.setup.codeError', defaultMessage: 'Please enter the code from Google Authenticator.'})});
return; return;
} }
@@ -107,7 +107,7 @@ class Setup extends React.PureComponent<Props, State> {
if (error) { if (error) {
if (error.server_error_id === 'ent.mfa.activate.authenticate.app_error') { if (error.server_error_id === 'ent.mfa.activate.authenticate.app_error') {
this.setState({ this.setState({
error: Utils.localizeMessage('mfa.setup.badCode', 'Invalid code. If this issue persists, contact your System Administrator.'), error: Utils.localizeMessage({id: 'mfa.setup.badCode', defaultMessage: 'Invalid code. If this issue persists, contact your System Administrator.'}),
}); });
} else { } else {
this.setState({ this.setState({

Просмотреть файл

@@ -526,7 +526,7 @@ export class MultiSelect<T extends Value> extends React.PureComponent<Props<T>,
}} }}
className={classNames('btn btn-tertiary', this.props.backButtonClass)} className={classNames('btn btn-tertiary', this.props.backButtonClass)}
> >
{this.props.backButtonText || localizeMessage('multiselect.backButton', 'Back')} {this.props.backButtonText || localizeMessage({id: 'multiselect.backButton', defaultMessage: 'Back'})}
</button> </button>
} }
<SaveButton <SaveButton

Просмотреть файл

@@ -86,7 +86,7 @@ export default class MarketplaceItemApp extends React.PureComponent <Marketplace
> >
<LoadingWrapper <LoadingWrapper
loading={this.props.installing} loading={this.props.installing}
text={localizeMessage('marketplace_modal.installing', 'Installing...')} text={localizeMessage({id: 'marketplace_modal.installing', defaultMessage: 'Installing...'})}
> >
{actionButton} {actionButton}
</LoadingWrapper> </LoadingWrapper>

Просмотреть файл

@@ -328,7 +328,7 @@ export default class MarketplaceItemPlugin extends React.PureComponent <Marketpl
> >
<LoadingWrapper <LoadingWrapper
loading={this.props.installing} loading={this.props.installing}
text={localizeMessage('marketplace_modal.installing', 'Installing...')} text={localizeMessage({id: 'marketplace_modal.installing', defaultMessage: 'Installing...'})}
> >
{actionButton} {actionButton}
</LoadingWrapper> </LoadingWrapper>

Просмотреть файл

@@ -707,7 +707,7 @@ function createSetHeaderButton(channel: Channel) {
return ( return (
<ToggleModalButton <ToggleModalButton
modalId={ModalIdentifiers.EDIT_CHANNEL_HEADER} modalId={ModalIdentifiers.EDIT_CHANNEL_HEADER}
ariaLabel={Utils.localizeMessage('intro_messages.setHeader', 'Set header')} ariaLabel={Utils.localizeMessage({id: 'intro_messages.setHeader', defaultMessage: 'Set header'})}
className={'action-button'} className={'action-button'}
dialogType={EditChannelHeaderModal} dialogType={EditChannelHeaderModal}
dialogProps={{channel}} dialogProps={{channel}}
@@ -755,7 +755,7 @@ function createNotificationPreferencesButton(channel: Channel, currentUser: User
return ( return (
<ToggleModalButton <ToggleModalButton
modalId={ModalIdentifiers.CHANNEL_NOTIFICATIONS} modalId={ModalIdentifiers.CHANNEL_NOTIFICATIONS}
ariaLabel={Utils.localizeMessage('intro_messages.notificationPreferences', 'Notification Preferences')} ariaLabel={Utils.localizeMessage({id: 'intro_messages.notificationPreferences', defaultMessage: 'Notification Preferences'})}
className={'action-button'} className={'action-button'}
dialogType={ChannelNotificationsModal} dialogType={ChannelNotificationsModal}
dialogProps={{channel, currentUser}} dialogProps={{channel, currentUser}}

Просмотреть файл

@@ -680,7 +680,7 @@ export default class PostList extends React.PureComponent<Props, State> {
data-a11y-focus-child={true} data-a11y-focus-child={true}
data-a11y-order-reversed={true} data-a11y-order-reversed={true}
data-a11y-loop-navigation={false} data-a11y-loop-navigation={false}
aria-label={Utils.localizeMessage('accessibility.sections.centerContent', 'message list main region')} aria-label={Utils.localizeMessage({id: 'accessibility.sections.centerContent', defaultMessage: 'message list main region'})}
> >
{this.props.isMobileView && ( {this.props.isMobileView && (
<React.Fragment> <React.Fragment>

Просмотреть файл

@@ -132,7 +132,7 @@ export default class PostMessageView extends React.PureComponent<Props, State> {
let message = post.message; let message = post.message;
const isEphemeral = isPostEphemeral(post); const isEphemeral = isPostEphemeral(post);
if (compactDisplay && isEphemeral) { if (compactDisplay && isEphemeral) {
const visibleMessage = Utils.localizeMessage('post_info.message.visible.compact', ' (Only visible to you)'); const visibleMessage = Utils.localizeMessage({id: 'post_info.message.visible.compact', defaultMessage: ' (Only visible to you)'});
message = message.concat(visibleMessage); message = message.concat(visibleMessage);
} }

Просмотреть файл

@@ -98,7 +98,7 @@ export default class PostReaction extends React.PureComponent<Props, State> {
<button <button
data-testid='post-reaction-emoji-icon' data-testid='post-reaction-emoji-icon'
id={`${location}_reaction_${postId}`} id={`${location}_reaction_${postId}`}
aria-label={localizeMessage('post_info.tooltip.add_reactions', 'Add Reaction').toLowerCase()} aria-label={localizeMessage({id: 'post_info.tooltip.add_reactions', defaultMessage: 'Add Reaction'}).toLowerCase()}
className={classNames('post-menu__item', 'post-menu__item--reactions', { className={classNames('post-menu__item', 'post-menu__item--reactions', {
'post-menu__item--active': showEmojiPicker, 'post-menu__item--active': showEmojiPicker,
})} })}

Просмотреть файл

@@ -196,9 +196,9 @@ export default class Reaction extends React.PureComponent<Props, State> {
const readOnlyClass = (canAddReactions && canRemoveReactions) ? '' : 'Reaction--read-only'; const readOnlyClass = (canAddReactions && canRemoveReactions) ? '' : 'Reaction--read-only';
const emojiNameWithSpaces = this.props.emojiName.replace(/_/g, ' '); const emojiNameWithSpaces = this.props.emojiName.replace(/_/g, ' ');
let ariaLabelEmoji = `${Utils.localizeMessage('reaction.reactWidth.ariaLabel', 'react with')} ${emojiNameWithSpaces}`; let ariaLabelEmoji = `${Utils.localizeMessage({id: 'reaction.reactWidth.ariaLabel', defaultMessage: 'react with'})} ${emojiNameWithSpaces}`;
if (currentUserReacted && canRemoveReactions) { if (currentUserReacted && canRemoveReactions) {
ariaLabelEmoji = `${Utils.localizeMessage('reaction.removeReact.ariaLabel', 'remove reaction')} ${emojiNameWithSpaces}`; ariaLabelEmoji = `${Utils.localizeMessage({id: 'reaction.removeReact.ariaLabel', defaultMessage: 'remove reaction'})} ${emojiNameWithSpaces}`;
} }
const emojiIcon = ( const emojiIcon = (

Просмотреть файл

@@ -44,7 +44,7 @@ export const makeGetNamesOfUsers = () => createSelector(
}, [] as string[]); }, [] as string[]);
if (currentUserReacted) { if (currentUserReacted) {
users.unshift(Utils.localizeMessage('reaction.you', 'You')); users.unshift(Utils.localizeMessage({id: 'reaction.you', defaultMessage: 'You'}));
} }
return users; return users;

Просмотреть файл

@@ -174,7 +174,7 @@ export default class ReactionList extends React.PureComponent<Props, State> {
placement='top' placement='top'
> >
<button <button
aria-label={localizeMessage('reaction.add.ariaLabel', 'Add a reaction')} aria-label={localizeMessage({id: 'reaction.add.ariaLabel', defaultMessage: 'Add a reaction'})}
className='Reaction' className='Reaction'
onClick={this.toggleEmojiPicker} onClick={this.toggleEmojiPicker}
> >
@@ -199,7 +199,7 @@ export default class ReactionList extends React.PureComponent<Props, State> {
return ( return (
<div <div
aria-label={localizeMessage('reaction.container.ariaLabel', 'reactions')} aria-label={localizeMessage({id: 'reaction.container.ariaLabel', defaultMessage: 'reactions'})}
className='post-reaction-list' className='post-reaction-list'
> >
{reactions} {reactions}

Просмотреть файл

@@ -132,10 +132,10 @@ export default class ShowMore extends React.PureComponent<Props, State> {
} }
let showIcon = 'fa fa-angle-up'; let showIcon = 'fa fa-angle-up';
let showText = localizeMessage('post_info.message.show_less', 'Show less'); let showText = localizeMessage({id: 'post_info.message.show_less', defaultMessage: 'Show less'});
if (isCollapsed) { if (isCollapsed) {
showIcon = 'fa fa-angle-down'; showIcon = 'fa fa-angle-down';
showText = localizeMessage('post_info.message.show_more', 'Show more'); showText = localizeMessage({id: 'post_info.message.show_more', defaultMessage: 'Show more'});
} }
switch (overflowType) { switch (overflowType) {
case 'ellipsis': case 'ellipsis':

Просмотреть файл

@@ -232,7 +232,7 @@ export default class QuickSwitchModal extends React.PureComponent<Props, State>
// @ts-ignore // @ts-ignore
ref={this.setSwitchBoxRef} ref={this.setSwitchBoxRef}
id='quickSwitchInput' id='quickSwitchInput'
aria-label={Utils.localizeMessage('quick_switch_modal.input', 'quick switch input')} aria-label={Utils.localizeMessage({id: 'quick_switch_modal.input', defaultMessage: 'quick switch input'})}
className='form-control focused' className='form-control focused'
onChange={this.onChange} onChange={this.onChange}
value={this.state.text} value={this.state.text}

Просмотреть файл

@@ -263,7 +263,7 @@ const SearchResults: React.FC<Props> = (props: Props): JSX.Element => {
contentItems = ( contentItems = (
<div className='sidebar--right__subheader a11y__section'> <div className='sidebar--right__subheader a11y__section'>
<div className='sidebar--right__loading'> <div className='sidebar--right__loading'>
<LoadingSpinner text={Utils.localizeMessage('search_header.loading', 'Searching')}/> <LoadingSpinner text={Utils.localizeMessage({id: 'search_header.loading', defaultMessage: 'Searching'})}/>
</div> </div>
</div> </div>
); );

Просмотреть файл

@@ -142,7 +142,7 @@ export class SearchableChannelList extends React.PureComponent<Props, State> {
const membershipIndicator = this.isMemberOfChannel(channel.id) ? ( const membershipIndicator = this.isMemberOfChannel(channel.id) ? (
<div <div
id='membershipIndicatorContainer' id='membershipIndicatorContainer'
aria-label={localizeMessage('more_channels.membership_indicator', 'Membership Indicator: Joined')} aria-label={localizeMessage({id: 'more_channels.membership_indicator', defaultMessage: 'Membership Indicator: Joined'})}
> >
<CheckIcon size={14}/> <CheckIcon size={14}/>
<FormattedMessage <FormattedMessage
@@ -153,8 +153,7 @@ export class SearchableChannelList extends React.PureComponent<Props, State> {
) : null; ) : null;
const channelPurposeContainerAriaLabel = localizeAndFormatMessage( const channelPurposeContainerAriaLabel = localizeAndFormatMessage(
messages.channelPurpose.id, messages.channelPurpose,
messages.channelPurpose.defaultMessage,
{memberCount, channelPurpose: channel.purpose || ''}, {memberCount, channelPurpose: channel.purpose || ''},
); );
@@ -184,11 +183,11 @@ export class SearchableChannelList extends React.PureComponent<Props, State> {
className={joinViewChannelButtonClass} className={joinViewChannelButtonClass}
disabled={Boolean(this.state.joiningChannel)} disabled={Boolean(this.state.joiningChannel)}
tabIndex={-1} tabIndex={-1}
aria-label={this.isMemberOfChannel(channel.id) ? localizeMessage('more_channels.view', 'View') : localizeMessage('joinChannel.JoinButton', 'Join')} aria-label={this.isMemberOfChannel(channel.id) ? localizeMessage({id: 'more_channels.view', defaultMessage: 'View'}) : localizeMessage({id: 'joinChannel.JoinButton', defaultMessage: 'Join'})}
> >
<LoadingWrapper <LoadingWrapper
loading={this.state.joiningChannel === channel.id} loading={this.state.joiningChannel === channel.id}
text={localizeMessage('joinChannel.joiningButton', 'Joining...')} text={localizeMessage({id: 'joinChannel.joiningButton', defaultMessage: 'Joining...'})}
> >
<FormattedMessage <FormattedMessage
id={this.isMemberOfChannel(channel.id) ? 'more_channels.view' : 'joinChannel.JoinButton'} id={this.isMemberOfChannel(channel.id) ? 'more_channels.view' : 'joinChannel.JoinButton'}
@@ -357,7 +356,7 @@ export class SearchableChannelList extends React.PureComponent<Props, State> {
listContent = ( listContent = (
<div <div
className='no-channel-message' className='no-channel-message'
aria-label={this.state.channelSearchValue.length > 0 ? localizeAndFormatMessage(messages.noMore.id, messages.noMore.defaultMessage, {text: this.state.channelSearchValue}) : localizeMessage('widgets.channels_input.empty', 'No channels found') aria-label={this.state.channelSearchValue.length > 0 ? localizeAndFormatMessage(messages.noMore, {text: this.state.channelSearchValue}) : localizeMessage({id: 'widgets.channels_input.empty', defaultMessage: 'No channels found'})
} }
> >
<MagnifyingGlassSVG/> <MagnifyingGlassSVG/>
@@ -379,7 +378,7 @@ export class SearchableChannelList extends React.PureComponent<Props, State> {
className='btn btn-sm btn-tertiary filter-control filter-control__next' className='btn btn-sm btn-tertiary filter-control filter-control__next'
onClick={this.nextPage} onClick={this.nextPage}
disabled={this.state.nextDisabled} disabled={this.state.nextDisabled}
aria-label={localizeMessage('more_channels.next', 'Next')} aria-label={localizeMessage({id: 'more_channels.next', defaultMessage: 'Next'})}
> >
<FormattedMessage <FormattedMessage
id='more_channels.next' id='more_channels.next'
@@ -394,7 +393,7 @@ export class SearchableChannelList extends React.PureComponent<Props, State> {
<button <button
className='btn btn-sm btn-tertiary filter-control filter-control__prev' className='btn btn-sm btn-tertiary filter-control filter-control__prev'
onClick={this.previousPage} onClick={this.previousPage}
aria-label={localizeMessage('more_channels.prev', 'Previous')} aria-label={localizeMessage({id: 'more_channels.prev', defaultMessage: 'Previous'})}
> >
<FormattedMessage <FormattedMessage
id='more_channels.prev' id='more_channels.prev'
@@ -422,7 +421,7 @@ export class SearchableChannelList extends React.PureComponent<Props, State> {
clearable={true} clearable={true}
onClear={this.handleClear} onClear={this.handleClear}
value={this.state.channelSearchValue} value={this.state.channelSearchValue}
aria-label={localizeMessage('filtered_channels_list.search', 'Search Channels')} aria-label={localizeMessage({id: 'filtered_channels_list.search', defaultMessage: 'Search Channels'})}
/> />
</div> </div>
); );
@@ -446,7 +445,7 @@ export class SearchableChannelList extends React.PureComponent<Props, State> {
/> />
} }
trailingElements={this.props.filter === Filter.All ? checkIcon : null} trailingElements={this.props.filter === Filter.All ? checkIcon : null}
aria-label={localizeMessage('suggestion.all', 'All channel types')} aria-label={localizeMessage({id: 'suggestion.all', defaultMessage: 'All channel types'})}
/>, />,
<Menu.Item <Menu.Item
key='channelsMoreDropdownPublic' key='channelsMoreDropdownPublic'
@@ -460,7 +459,7 @@ export class SearchableChannelList extends React.PureComponent<Props, State> {
/> />
} }
trailingElements={this.props.filter === Filter.Public ? checkIcon : null} trailingElements={this.props.filter === Filter.Public ? checkIcon : null}
aria-label={localizeMessage('suggestion.public', 'Public channels')} aria-label={localizeMessage({id: 'suggestion.public', defaultMessage: 'Public channels'})}
/>, />,
<Menu.Item <Menu.Item
key='channelsMoreDropdownPrivate' key='channelsMoreDropdownPrivate'
@@ -474,7 +473,7 @@ export class SearchableChannelList extends React.PureComponent<Props, State> {
/> />
} }
trailingElements={this.props.filter === Filter.Private ? checkIcon : null} trailingElements={this.props.filter === Filter.Private ? checkIcon : null}
aria-label={localizeMessage('suggestion.private', 'Private channels')} aria-label={localizeMessage({id: 'suggestion.private', defaultMessage: 'Private channels'})}
/>, />,
]; ];
@@ -493,7 +492,7 @@ export class SearchableChannelList extends React.PureComponent<Props, State> {
/> />
} }
trailingElements={this.props.filter === Filter.Archived ? checkIcon : null} trailingElements={this.props.filter === Filter.Archived ? checkIcon : null}
aria-label={localizeMessage('suggestion.archive', 'Archived channels')} aria-label={localizeMessage({id: 'suggestion.archive', defaultMessage: 'Archived channels'})}
/>, />,
); );
} }
@@ -514,7 +513,7 @@ export class SearchableChannelList extends React.PureComponent<Props, State> {
}} }}
menu={{ menu={{
id: 'browseChannelsDropdown', id: 'browseChannelsDropdown',
'aria-label': localizeMessage('more_channels.title', 'Browse channels'), 'aria-label': localizeMessage({id: 'more_channels.title', defaultMessage: 'Browse channels'}),
}} }}
> >
{channelDropdownItems.map((item) => item)} {channelDropdownItems.map((item) => item)}
@@ -529,7 +528,7 @@ export class SearchableChannelList extends React.PureComponent<Props, State> {
> >
<button <button
className={hideJoinedButtonClass} className={hideJoinedButtonClass}
aria-label={this.props.rememberHideJoinedChannelsChecked ? localizeMessage('more_channels.hide_joined_checked', 'Hide joined channels checkbox, checked') : localizeMessage('more_channels.hide_joined_not_checked', 'Hide joined channels checkbox, not checked')} aria-label={this.props.rememberHideJoinedChannelsChecked ? localizeMessage({id: 'more_channels.hide_joined_checked', defaultMessage: 'Hide joined channels checkbox, checked'}) : localizeMessage({id: 'more_channels.hide_joined_not_checked', defaultMessage: 'Hide joined channels checkbox, not checked'})}
> >
{this.props.rememberHideJoinedChannelsChecked ? <CheckboxCheckedIcon/> : null} {this.props.rememberHideJoinedChannelsChecked ? <CheckboxCheckedIcon/> : null}
</button> </button>
@@ -542,13 +541,13 @@ export class SearchableChannelList extends React.PureComponent<Props, State> {
let channelCountLabel; let channelCountLabel;
if (channels.length === 0) { if (channels.length === 0) {
channelCountLabel = localizeMessage('more_channels.count_zero', '0 Results'); channelCountLabel = localizeMessage({id: 'more_channels.count_zero', defaultMessage: '0 Results'});
} else if (channels.length === 1) { } else if (channels.length === 1) {
channelCountLabel = localizeMessage('more_channels.count_one', '1 Result'); channelCountLabel = localizeMessage({id: 'more_channels.count_one', defaultMessage: '1 Result'});
} else if (channels.length > 1) { } else if (channels.length > 1) {
channelCountLabel = localizeAndFormatMessage(messages.channelCount.id, messages.channelCount.defaultMessage, {count: channels.length}); channelCountLabel = localizeAndFormatMessage(messages.channelCount, {count: channels.length});
} else { } else {
channelCountLabel = localizeMessage('more_channels.count_zero', '0 Results'); channelCountLabel = localizeMessage({id: 'more_channels.count_zero', defaultMessage: '0 Results'});
} }
const dropDownContainer = ( const dropDownContainer = (

Просмотреть файл

@@ -296,7 +296,7 @@ export default class SettingPicture extends Component<Props, State> {
className='btn btn-primary btn-file' className='btn btn-primary btn-file'
disabled={this.props.loadingPicture} disabled={this.props.loadingPicture}
onClick={this.handleInputFile} onClick={this.handleInputFile}
aria-label={localizeMessage('setting_picture.select', 'Select')} aria-label={localizeMessage({id: 'setting_picture.select', defaultMessage: 'Select'})}
> >
<FormattedMessage <FormattedMessage
id='setting_picture.select' id='setting_picture.select'
@@ -310,11 +310,11 @@ export default class SettingPicture extends Component<Props, State> {
ref={this.confirmButton} ref={this.confirmButton}
className={confirmButtonClass} className={confirmButtonClass}
onClick={this.handleSave} onClick={this.handleSave}
aria-label={this.props.loadingPicture ? localizeMessage('setting_picture.uploading', 'Uploading...') : localizeMessage('setting_picture.save', 'Save')} aria-label={this.props.loadingPicture ? localizeMessage({id: 'setting_picture.uploading', defaultMessage: 'Uploading...'}) : localizeMessage({id: 'setting_picture.save', defaultMessage: 'Save'})}
> >
<LoadingWrapper <LoadingWrapper
loading={this.props.loadingPicture} loading={this.props.loadingPicture}
text={localizeMessage('setting_picture.uploading', 'Uploading...')} text={localizeMessage({id: 'setting_picture.uploading', defaultMessage: 'Uploading...'})}
> >
<FormattedMessage <FormattedMessage
id='setting_picture.save' id='setting_picture.save'
@@ -358,7 +358,7 @@ export default class SettingPicture extends Component<Props, State> {
data-testid='cancelSettingPicture' data-testid='cancelSettingPicture'
className='btn btn-tertiary theme ml-2' className='btn btn-tertiary theme ml-2'
onClick={this.handleCancel} onClick={this.handleCancel}
aria-label={localizeMessage('setting_picture.cancel', 'Cancel')} aria-label={localizeMessage({id: 'setting_picture.cancel', defaultMessage: 'Cancel'})}
> >
<FormattedMessage <FormattedMessage
id='setting_picture.cancel' id='setting_picture.cancel'

Просмотреть файл

@@ -92,7 +92,7 @@ export default class ChannelNavigator extends React.PureComponent<Props> {
<button <button
className={'SidebarChannelNavigator_jumpToButton'} className={'SidebarChannelNavigator_jumpToButton'}
onClick={this.openQuickSwitcher} onClick={this.openQuickSwitcher}
aria-label={Utils.localizeMessage('sidebar_left.channel_navigator.channelSwitcherLabel', 'Channel Switcher')} aria-label={Utils.localizeMessage({id: 'sidebar_left.channel_navigator.channelSwitcherLabel', defaultMessage: 'Channel Switcher'})}
aria-haspopup='dialog' aria-haspopup='dialog'
data-testid='SidebarChannelNavigatorButton' data-testid='SidebarChannelNavigatorButton'
> >

Просмотреть файл

@@ -227,7 +227,7 @@ export default class Sidebar extends React.PureComponent<Props, State> {
return (<div/>); return (<div/>);
} }
const ariaLabel = localizeMessage('accessibility.sections.lhsNavigator', 'channel navigator region'); const ariaLabel = localizeMessage({id: 'accessibility.sections.lhsNavigator', defaultMessage: 'channel navigator region'});
return ( return (
<ResizableLhs <ResizableLhs

Просмотреть файл

@@ -267,7 +267,7 @@ export default class SidebarCategory extends React.PureComponent<Props, State> {
categoryMenu = <SidebarCategoryMenu category={category}/>; categoryMenu = <SidebarCategoryMenu category={category}/>;
} else if (category.type === CategoryTypes.DIRECT_MESSAGES) { } else if (category.type === CategoryTypes.DIRECT_MESSAGES) {
const addHelpLabel = localizeMessage('sidebar.createDirectMessage', 'Create new direct message'); const addHelpLabel = localizeMessage({id: 'sidebar.createDirectMessage', defaultMessage: 'Create new direct message'});
categoryMenu = ( categoryMenu = (
<React.Fragment> <React.Fragment>
@@ -310,7 +310,7 @@ export default class SidebarCategory extends React.PureComponent<Props, State> {
let displayName = category.display_name; let displayName = category.display_name;
if (category.type !== CategoryTypes.CUSTOM) { if (category.type !== CategoryTypes.CUSTOM) {
const message = categoryNames[category.type as keyof typeof categoryNames]; const message = categoryNames[category.type as keyof typeof categoryNames];
displayName = localizeMessage(message.id, message.defaultMessage); displayName = localizeMessage({id: message.id, defaultMessage: message.defaultMessage});
} }
return ( return (

Просмотреть файл

@@ -119,13 +119,13 @@ export default class SidebarChannelLink extends React.PureComponent<Props, State
} }
if (unreadMentions === 1) { if (unreadMentions === 1) {
ariaLabel += ` ${unreadMentions} ${localizeMessage('accessibility.sidebar.types.mention', 'mention')}`; ariaLabel += ` ${unreadMentions} ${localizeMessage({id: 'accessibility.sidebar.types.mention', defaultMessage: 'mention'})}`;
} else if (unreadMentions > 1) { } else if (unreadMentions > 1) {
ariaLabel += ` ${unreadMentions} ${localizeMessage('accessibility.sidebar.types.mentions', 'mentions')}`; ariaLabel += ` ${unreadMentions} ${localizeMessage({id: 'accessibility.sidebar.types.mentions', defaultMessage: 'mentions'})}`;
} }
if (this.props.isUnread && unreadMentions === 0) { if (this.props.isUnread && unreadMentions === 0) {
ariaLabel += ` ${localizeMessage('accessibility.sidebar.types.unread', 'unread')}`; ariaLabel += ` ${localizeMessage({id: 'accessibility.sidebar.types.unread', defaultMessage: 'unread'})}`;
} }
return ariaLabel.toLowerCase(); return ariaLabel.toLowerCase();

Просмотреть файл

@@ -547,7 +547,7 @@ export default class SidebarList extends React.PureComponent<Props, State> {
/> />
); );
const ariaLabel = localizeMessage('accessibility.sections.lhsList', 'channel sidebar region'); const ariaLabel = localizeMessage({id: 'accessibility.sections.lhsList', defaultMessage: 'channel sidebar region'});
return ( return (

Просмотреть файл

@@ -209,7 +209,7 @@ export default class SizeAwareImage extends React.PureComponent<Props, State> {
Reflect.deleteProperty(props, 'hideUtilities'); Reflect.deleteProperty(props, 'hideUtilities');
Reflect.deleteProperty(props, 'getFilePublicLink'); Reflect.deleteProperty(props, 'getFilePublicLink');
let ariaLabelImage = localizeMessage('file_attachment.thumbnail', 'file thumbnail'); let ariaLabelImage = localizeMessage({id: 'file_attachment.thumbnail', defaultMessage: 'file thumbnail'});
if (fileInfo) { if (fileInfo) {
ariaLabelImage += ` ${fileInfo.name}`.toLowerCase(); ariaLabelImage += ` ${fileInfo.name}`.toLowerCase();
} }
@@ -256,7 +256,7 @@ export default class SizeAwareImage extends React.PureComponent<Props, State> {
className={classNames('style--none', 'size-aware-image__copy_link', { className={classNames('style--none', 'size-aware-image__copy_link', {
'size-aware-image__copy_link--recently_copied': this.state.linkCopiedRecently, 'size-aware-image__copy_link--recently_copied': this.state.linkCopiedRecently,
})} })}
aria-label={localizeMessage('single_image_view.copy_link_tooltip', 'Copy link')} aria-label={localizeMessage({id: 'single_image_view.copy_link_tooltip', defaultMessage: 'Copy link'})}
onClick={this.copyLinkToAsset} onClick={this.copyLinkToAsset}
> >
{this.state.linkCopiedRecently ? ( {this.state.linkCopiedRecently ? (
@@ -293,7 +293,7 @@ export default class SizeAwareImage extends React.PureComponent<Props, State> {
className='style--none size-aware-image__download' className='style--none size-aware-image__download'
download={true} download={true}
role={this.isInternalImage ? 'button' : undefined} role={this.isInternalImage ? 'button' : undefined}
aria-label={localizeMessage('single_image_view.download_tooltip', 'Download')} aria-label={localizeMessage({id: 'single_image_view.download_tooltip', defaultMessage: 'Download'})}
> >
<DownloadOutlineIcon <DownloadOutlineIcon
className={'style--none'} className={'style--none'}
@@ -383,7 +383,7 @@ export default class SizeAwareImage extends React.PureComponent<Props, State> {
fileInfo, fileInfo,
} = this.props; } = this.props;
let ariaLabelImage = localizeMessage('file_attachment.thumbnail', 'file thumbnail'); let ariaLabelImage = localizeMessage({id: 'file_attachment.thumbnail', defaultMessage: 'file thumbnail'});
if (fileInfo) { if (fileInfo) {
ariaLabelImage += ` ${fileInfo.name}`.toLowerCase(); ariaLabelImage += ` ${fileInfo.name}`.toLowerCase();
} }

Просмотреть файл

@@ -58,8 +58,8 @@ describe('AppCommandParser', () => {
}; };
const intl = { const intl = {
formatMessage: (message: {id: string; defaultMessage: string}) => { formatMessage: (message: {id: string; defaultMessage?: string}) => {
return message.defaultMessage; return message.defaultMessage ?? '';
}, },
}; };

Просмотреть файл

@@ -58,7 +58,8 @@ import type {
AutocompleteSuggestion, AutocompleteSuggestion,
AutocompleteStaticSelect, AutocompleteStaticSelect,
Channel, Channel,
ExtendedAutocompleteSuggestion} from './app_command_parser_dependencies'; ExtendedAutocompleteSuggestion,
intlShim} from './app_command_parser_dependencies';
export enum ParseState { export enum ParseState {
Start = 'Start', Start = 'Start',
@@ -95,9 +96,7 @@ interface FormsCache {
getSubmittableForm: (location: string, binding: AppBinding) => Promise<{form?: AppForm; error?: string} | undefined>; getSubmittableForm: (location: string, binding: AppBinding) => Promise<{form?: AppForm; error?: string} | undefined>;
} }
interface Intl { type Intl = typeof intlShim;
formatMessage(config: {id: string; defaultMessage: string}, values?: {[name: string]: any}): string;
}
const getCommandBindings = makeAppBindingsSelector(AppBindingLocations.COMMAND); const getCommandBindings = makeAppBindingsSelector(AppBindingLocations.COMMAND);
const getRHSCommandBindings = makeRHSAppBindingSelector(AppBindingLocations.COMMAND); const getRHSCommandBindings = makeRHSAppBindingSelector(AppBindingLocations.COMMAND);

Просмотреть файл

@@ -115,8 +115,8 @@ export const displayError = (err: string, channelID: string, rootID?: string) =>
// Shim of mobile-version intl // Shim of mobile-version intl
export const intlShim = { export const intlShim = {
formatMessage: (config: {id: string; defaultMessage: string}, values?: {[name: string]: any}) => { formatMessage: (config: {id: string; defaultMessage?: string}, values?: {[name: string]: any}) => {
return localizeAndFormatMessage(config.id, config.defaultMessage, values); return localizeAndFormatMessage(config, values);
}, },
}; };

Просмотреть файл

@@ -220,7 +220,7 @@ const SwitchChannelSuggestion = React.forwardRef<HTMLDivElement, Props>((props,
let deactivated = ''; let deactivated = '';
if (teammate.delete_at) { if (teammate.delete_at) {
deactivated = (' - ' + Utils.localizeMessage('channel_switch_modal.deactivated', 'Deactivated')); deactivated = (' - ' + Utils.localizeMessage({id: 'channel_switch_modal.deactivated', defaultMessage: 'Deactivated'}));
} }
if (channel.display_name && !(teammate && teammate.is_bot)) { if (channel.display_name && !(teammate && teammate.is_bot)) {
@@ -228,7 +228,7 @@ const SwitchChannelSuggestion = React.forwardRef<HTMLDivElement, Props>((props,
} else { } else {
name = teammate.username; name = teammate.username;
if (teammate.id === currentUserId) { if (teammate.id === currentUserId) {
name += (' ' + Utils.localizeMessage('suggestion.user.isCurrent', '(you)')); name += (' ' + Utils.localizeMessage({id: 'suggestion.user.isCurrent', defaultMessage: '(you)'}));
} }
description = deactivated; description = deactivated;
} }
@@ -545,7 +545,7 @@ export default class SwitchChannelProvider extends Provider {
} }
if (user.id === currentUserId && displayName) { if (user.id === currentUserId && displayName) {
displayName += (' ' + Utils.localizeMessage('suggestion.user.isCurrent', '(you)')); displayName += (' ' + Utils.localizeMessage({id: 'suggestion.user.isCurrent', defaultMessage: '(you)'}));
} }
return { return {

Просмотреть файл

@@ -111,9 +111,9 @@ class TeamGroupsManageModal extends React.PureComponent<Props, State> {
renderRow = (item: Group, listModal: ListModal) => { renderRow = (item: Group, listModal: ListModal) => {
let title; let title;
if (item.scheme_admin) { if (item.scheme_admin) {
title = Utils.localizeMessage('team_members_dropdown.teamAdmins', 'Team Admins'); title = Utils.localizeMessage({id: 'team_members_dropdown.teamAdmins', defaultMessage: 'Team Admins'});
} else { } else {
title = Utils.localizeMessage('team_members_dropdown.teamMembers', 'Team Members'); title = Utils.localizeMessage({id: 'team_members_dropdown.teamMembers', defaultMessage: 'Team Members'});
} }
return ( return (
@@ -154,21 +154,21 @@ class TeamGroupsManageModal extends React.PureComponent<Props, State> {
</button> </button>
<Menu <Menu
openLeft={true} openLeft={true}
ariaLabel={Utils.localizeMessage('team_members_dropdown.menuAriaLabel', 'Change the role of a team member')} ariaLabel={Utils.localizeMessage({id: 'team_members_dropdown.menuAriaLabel', defaultMessage: 'Change the role of a team member'})}
> >
<Menu.ItemAction <Menu.ItemAction
show={!item.scheme_admin} show={!item.scheme_admin}
onClick={() => this.setTeamMemberStatus(item, listModal, true)} onClick={() => this.setTeamMemberStatus(item, listModal, true)}
text={Utils.localizeMessage('team_members_dropdown.makeTeamAdmins', 'Make Team Admins')} text={Utils.localizeMessage({id: 'team_members_dropdown.makeTeamAdmins', defaultMessage: 'Make Team Admins'})}
/> />
<Menu.ItemAction <Menu.ItemAction
show={Boolean(item.scheme_admin)} show={Boolean(item.scheme_admin)}
onClick={() => this.setTeamMemberStatus(item, listModal, false)} onClick={() => this.setTeamMemberStatus(item, listModal, false)}
text={Utils.localizeMessage('team_members_dropdown.makeTeamMembers', 'Make Team Members')} text={Utils.localizeMessage({id: 'team_members_dropdown.makeTeamMembers', defaultMessage: 'Make Team Members'})}
/> />
<Menu.ItemAction <Menu.ItemAction
onClick={() => this.onClickRemoveGroup(item, listModal)} onClick={() => this.onClickRemoveGroup(item, listModal)}
text={Utils.localizeMessage('group_list_modal.removeGroupButton', 'Remove Group')} text={Utils.localizeMessage({id: 'group_list_modal.removeGroupButton', defaultMessage: 'Remove Group'})}
/> />
</Menu> </Menu>
</MenuWrapper> </MenuWrapper>

Просмотреть файл

@@ -253,19 +253,19 @@ export default class TeamMembersDropdown extends React.PureComponent<Props, Stat
<Menu.ItemAction <Menu.ItemAction
id='removeFromTeam' id='removeFromTeam'
onClick={this.handleRemoveFromTeam} onClick={this.handleRemoveFromTeam}
text={Utils.localizeMessage('team_members_dropdown.leave_team', 'Remove From Team')} text={Utils.localizeMessage({id: 'team_members_dropdown.leave_team', defaultMessage: 'Remove From Team'})}
/> />
); );
const menuMakeAdmin = ( const menuMakeAdmin = (
<Menu.ItemAction <Menu.ItemAction
onClick={this.handleMakeAdmin} onClick={this.handleMakeAdmin}
text={Utils.localizeMessage('team_members_dropdown.makeAdmin', 'Make Team Admin')} text={Utils.localizeMessage({id: 'team_members_dropdown.makeAdmin', defaultMessage: 'Make Team Admin'})}
/> />
); );
const menuMakeMember = ( const menuMakeMember = (
<Menu.ItemAction <Menu.ItemAction
onClick={this.handleMakeMember} onClick={this.handleMakeMember}
text={Utils.localizeMessage('team_members_dropdown.makeMember', 'Make Member')} text={Utils.localizeMessage({id: 'team_members_dropdown.makeMember', defaultMessage: 'Make Member'})}
/> />
); );
return ( return (
@@ -283,7 +283,7 @@ export default class TeamMembersDropdown extends React.PureComponent<Props, Stat
<Menu <Menu
openLeft={true} openLeft={true}
openUp={openUp} openUp={openUp}
ariaLabel={Utils.localizeMessage('team_members_dropdown.menuAriaLabel', 'Change the role of a team member')} ariaLabel={Utils.localizeMessage({id: 'team_members_dropdown.menuAriaLabel', defaultMessage: 'Change the role of a team member'})}
> >
{canRemoveFromTeam ? menuRemove : null} {canRemoveFromTeam ? menuRemove : null}
{showMakeAdmin ? menuMakeAdmin : null} {showMakeAdmin ? menuMakeAdmin : null}

Просмотреть файл

@@ -243,7 +243,7 @@ export class TeamSelectorModal extends React.PureComponent<Props, State> {
/> />
); );
const buttonSubmitText = localizeMessage('multiselect.add', 'Add'); const buttonSubmitText = localizeMessage({id: 'multiselect.add', defaultMessage: 'Add'});
let teams = [] as Team[]; let teams = [] as Team[];
if (this.props.teams) { if (this.props.teams) {
@@ -313,7 +313,7 @@ export class TeamSelectorModal extends React.PureComponent<Props, State> {
buttonSubmitText={buttonSubmitText} buttonSubmitText={buttonSubmitText}
saving={false} saving={false}
loading={this.state.loadingTeams} loading={this.state.loadingTeams}
placeholderText={localizeMessage('multiselect.addTeamsPlaceholder', 'Search and add teams')} placeholderText={localizeMessage({id: 'multiselect.addTeamsPlaceholder', defaultMessage: 'Search and add teams'})}
/> />
</Modal.Body> </Modal.Body>
</Modal> </Modal>

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше