Add t() translation mark to i18nable strings and update translations (#2026)

* Add t() translation mark to i18nable strings and update translations

* Small fixes

* Adding  to the packager

* Rebase fixes

* Added missed texts
This commit is contained in:
Jesús Espino 2018-09-21 16:25:38 +02:00 committed by Elias Nahum
parent 5fb9b5427e
commit 8884293b18
53 changed files with 324 additions and 3344 deletions

View file

@ -17,6 +17,7 @@ import Permissions from 'react-native-permissions';
import {PermissionTypes} from 'app/constants';
import {changeOpacity} from 'app/utils/theme';
import {t} from 'app/utils/i18n';
const ShareExtension = NativeModules.MattermostShare;
@ -314,14 +315,14 @@ export default class AttachmentButton extends PureComponent {
items: [{
action: () => this.handleFileAttachmentOption(this.attachFileFromCamera),
text: {
id: 'mobile.file_upload.camera',
id: t('mobile.file_upload.camera'),
defaultMessage: 'Take Photo or Video',
},
icon: 'camera',
}, {
action: () => this.handleFileAttachmentOption(this.attachFileFromLibrary),
text: {
id: 'mobile.file_upload.library',
id: t('mobile.file_upload.library'),
defaultMessage: 'Photo Library',
},
icon: 'photo',
@ -332,7 +333,7 @@ export default class AttachmentButton extends PureComponent {
options.items.push({
action: () => this.handleFileAttachmentOption(this.attachVideoFromLibraryAndroid),
text: {
id: 'mobile.file_upload.video',
id: t('mobile.file_upload.video'),
defaultMessage: 'Video Library',
},
icon: 'file-video-o',
@ -342,7 +343,7 @@ export default class AttachmentButton extends PureComponent {
options.items.push({
action: () => this.handleFileAttachmentOption(this.attachFileFromFiles),
text: {
id: 'mobile.file_upload.browse',
id: t('mobile.file_upload.browse'),
defaultMessage: 'Browse Files',
},
icon: 'file',

View file

@ -13,6 +13,7 @@ import AutocompleteDivider from 'app/components/autocomplete/autocomplete_divide
import AutocompleteSectionHeader from 'app/components/autocomplete/autocomplete_section_header';
import SpecialMentionItem from 'app/components/autocomplete/special_mention_item';
import {makeStyleSheetFromTheme} from 'app/utils/theme';
import {t} from 'app/utils/i18n';
export default class AtMention extends PureComponent {
static propTypes = {
@ -81,7 +82,7 @@ export default class AtMention extends PureComponent {
const sections = [];
if (isSearch) {
sections.push({
id: 'mobile.suggestion.members',
id: t('mobile.suggestion.members'),
defaultMessage: 'Members',
data: teamMembers,
key: 'teamMembers',
@ -89,7 +90,7 @@ export default class AtMention extends PureComponent {
} else {
if (inChannel.length) {
sections.push({
id: 'suggestion.mention.members',
id: t('suggestion.mention.members'),
defaultMessage: 'Channel Members',
data: inChannel,
key: 'inChannel',
@ -98,7 +99,7 @@ export default class AtMention extends PureComponent {
if (this.checkSpecialMentions(matchTerm)) {
sections.push({
id: 'suggestion.mention.special',
id: t('suggestion.mention.special'),
defaultMessage: 'Special Mentions',
data: this.getSpecialMentions(),
key: 'special',
@ -108,7 +109,7 @@ export default class AtMention extends PureComponent {
if (outChannel.length) {
sections.push({
id: 'suggestion.mention.nonmembers',
id: t('suggestion.mention.nonmembers'),
defaultMessage: 'Not in Channel',
data: outChannel,
key: 'outChannel',
@ -131,18 +132,18 @@ export default class AtMention extends PureComponent {
getSpecialMentions = () => {
return [{
completeHandle: 'all',
id: 'suggestion.mention.all',
id: t('suggestion.mention.all'),
defaultMessage: 'Notifies everyone in the channel, use in {townsquare} to notify the whole team',
values: {
townsquare: this.props.defaultChannel.display_name,
},
}, {
completeHandle: 'channel',
id: 'suggestion.mention.channel',
id: t('suggestion.mention.channel'),
defaultMessage: 'Notifies everyone in the channel',
}, {
completeHandle: 'here',
id: 'suggestion.mention.here',
id: t('suggestion.mention.here'),
defaultMessage: 'Notifies everyone in the channel and online',
}];
};

View file

@ -14,6 +14,7 @@ import AutocompleteDivider from 'app/components/autocomplete/autocomplete_divide
import AutocompleteSectionHeader from 'app/components/autocomplete/autocomplete_section_header';
import ChannelMentionItem from 'app/components/autocomplete/channel_mention_item';
import {makeStyleSheetFromTheme} from 'app/utils/theme';
import {t} from 'app/utils/i18n';
export default class ChannelMention extends PureComponent {
static propTypes = {
@ -96,7 +97,7 @@ export default class ChannelMention extends PureComponent {
if (isSearch) {
if (publicChannels.length) {
sections.push({
id: 'suggestion.search.public',
id: t('suggestion.search.public'),
defaultMessage: 'Public Channels',
data: publicChannels.filter((cId) => myMembers[cId]),
key: 'publicChannels',
@ -105,7 +106,7 @@ export default class ChannelMention extends PureComponent {
if (privateChannels.length) {
sections.push({
id: 'suggestion.search.private',
id: t('suggestion.search.private'),
defaultMessage: 'Private Channels',
data: privateChannels,
key: 'privateChannels',
@ -114,7 +115,7 @@ export default class ChannelMention extends PureComponent {
} else {
if (myChannels.length) {
sections.push({
id: 'suggestion.mention.channels',
id: t('suggestion.mention.channels'),
defaultMessage: 'My Channels',
data: myChannels,
key: 'myChannels',
@ -123,7 +124,7 @@ export default class ChannelMention extends PureComponent {
if (otherChannels.length) {
sections.push({
id: 'suggestion.mention.morechannels',
id: t('suggestion.mention.morechannels'),
defaultMessage: 'Other Channels',
data: otherChannels,
key: 'otherChannels',

View file

@ -16,6 +16,7 @@ import {injectIntl, intlShape} from 'react-intl';
import ProfilePicture from 'app/components/profile_picture';
import {preventDoubleTap} from 'app/utils/tap';
import {changeOpacity, makeStyleSheetFromTheme} from 'app/utils/theme';
import {t} from 'app/utils/i18n';
class ChannelIntro extends PureComponent {
static propTypes = {
@ -166,7 +167,7 @@ class ChannelIntro extends PureComponent {
};
} else {
mainMessageIntl = {
id: 'intro_messages.noCreator',
id: t('intro_messages.noCreator'),
defaultMessage: 'This is the start of the {name} {type}, created on {date}.',
values: {
name: currentChannel.display_name,

View file

@ -8,6 +8,7 @@ import {intlShape} from 'react-intl';
import {Posts} from 'mattermost-redux/constants';
import {makeStyleSheetFromTheme} from 'app/utils/theme';
import {t} from 'app/utils/i18n';
import Markdown from 'app/components/markdown';
@ -21,129 +22,129 @@ const {
const postTypeMessage = {
[JOIN_CHANNEL]: {
one: {
id: 'combined_system_message.joined_channel.one',
id: t('combined_system_message.joined_channel.one'),
defaultMessage: '{firstUser} **joined the channel**.',
},
two: {
id: 'combined_system_message.joined_channel.two',
id: t('combined_system_message.joined_channel.two'),
defaultMessage: '{firstUser} and {secondUser} **joined the channel**.',
},
many_expanded: {
id: 'combined_system_message.joined_channel.many_expanded',
id: t('combined_system_message.joined_channel.many_expanded'),
defaultMessage: '{users} and {lastUser} **joined the channel**.',
},
},
[ADD_TO_CHANNEL]: {
one: {
id: 'combined_system_message.added_to_channel.one',
id: t('combined_system_message.added_to_channel.one'),
defaultMessage: '{firstUser} **added to the channel** by {actor}.',
},
one_you: {
id: 'combined_system_message.added_to_channel.one_you',
id: t('combined_system_message.added_to_channel.one_you'),
defaultMessage: 'You were **added to the channel** by {actor}.',
},
two: {
id: 'combined_system_message.added_to_channel.two',
id: t('combined_system_message.added_to_channel.two'),
defaultMessage: '{firstUser} and {secondUser} **added to the channel** by {actor}.',
},
many_expanded: {
id: 'combined_system_message.added_to_channel.many_expanded',
id: t('combined_system_message.added_to_channel.many_expanded'),
defaultMessage: '{users} and {lastUser} were **added to the channel** by {actor}.',
},
},
[REMOVE_FROM_CHANNEL]: {
one: {
id: 'combined_system_message.removed_from_channel.one',
id: t('combined_system_message.removed_from_channel.one'),
defaultMessage: '{firstUser} was **removed from the channel**.',
},
one_you: {
id: 'combined_system_message.removed_from_channel.one_you',
id: t('combined_system_message.removed_from_channel.one_you'),
defaultMessage: 'You were **removed from the channel**.',
},
two: {
id: 'combined_system_message.removed_from_channel.two',
id: t('combined_system_message.removed_from_channel.two'),
defaultMessage: '{firstUser} and {secondUser} were **removed from the channel**.',
},
many_expanded: {
id: 'combined_system_message.removed_from_channel.many_expanded',
id: t('combined_system_message.removed_from_channel.many_expanded'),
defaultMessage: '{users} and {lastUser} were **removed from the channel**.',
},
},
[LEAVE_CHANNEL]: {
one: {
id: 'combined_system_message.left_channel.one',
id: t('combined_system_message.left_channel.one'),
defaultMessage: '{firstUser} **left the channel**.',
},
two: {
id: 'combined_system_message.left_channel.two',
id: t('combined_system_message.left_channel.two'),
defaultMessage: '{firstUser} and {secondUser} **left the channel**.',
},
many_expanded: {
id: 'combined_system_message.left_channel.many_expanded',
id: t('combined_system_message.left_channel.many_expanded'),
defaultMessage: '{users} and {lastUser} **left the channel**.',
},
},
[JOIN_TEAM]: {
one: {
id: 'combined_system_message.joined_team.one',
id: t('combined_system_message.joined_team.one'),
defaultMessage: '{firstUser} **joined the team**.',
},
two: {
id: 'combined_system_message.joined_team.two',
id: t('combined_system_message.joined_team.two'),
defaultMessage: '{firstUser} and {secondUser} **joined the team**.',
},
many_expanded: {
id: 'combined_system_message.joined_team.many_expanded',
id: t('combined_system_message.joined_team.many_expanded'),
defaultMessage: '{users} and {lastUser} **joined the team**.',
},
},
[ADD_TO_TEAM]: {
one: {
id: 'combined_system_message.added_to_team.one',
id: t('combined_system_message.added_to_team.one'),
defaultMessage: '{firstUser} **added to the team** by {actor}.',
},
one_you: {
id: 'combined_system_message.added_to_team.one_you',
id: t('combined_system_message.added_to_team.one_you'),
defaultMessage: 'You were **added to the team** by {actor}.',
},
two: {
id: 'combined_system_message.added_to_team.two',
id: t('combined_system_message.added_to_team.two'),
defaultMessage: '{firstUser} and {secondUser} **added to the team** by {actor}.',
},
many_expanded: {
id: 'combined_system_message.added_to_team.many_expanded',
id: t('combined_system_message.added_to_team.many_expanded'),
defaultMessage: '{users} and {lastUser} were **added to the team** by {actor}.',
},
},
[REMOVE_FROM_TEAM]: {
one: {
id: 'combined_system_message.removed_from_team.one',
id: t('combined_system_message.removed_from_team.one'),
defaultMessage: '{firstUser} was **removed from the team**.',
},
one_you: {
id: 'combined_system_message.removed_from_team.one_you',
id: t('combined_system_message.removed_from_team.one_you'),
defaultMessage: 'You were **removed from the team**.',
},
two: {
id: 'combined_system_message.removed_from_team.two',
id: t('combined_system_message.removed_from_team.two'),
defaultMessage: '{firstUser} and {secondUser} were **removed from the team**.',
},
many_expanded: {
id: 'combined_system_message.removed_from_team.many_expanded',
id: t('combined_system_message.removed_from_team.many_expanded'),
defaultMessage: '{users} and {lastUser} were **removed from the team**.',
},
},
[LEAVE_TEAM]: {
one: {
id: 'combined_system_message.left_team.one',
id: t('combined_system_message.left_team.one'),
defaultMessage: '{firstUser} **left the team**.',
},
two: {
id: 'combined_system_message.left_team.two',
id: t('combined_system_message.left_team.two'),
defaultMessage: '{firstUser} and {secondUser} **left the team**.',
},
many_expanded: {
id: 'combined_system_message.left_team.many_expanded',
id: t('combined_system_message.left_team.many_expanded'),
defaultMessage: '{users} and {lastUser} **left the team**.',
},
},

View file

@ -12,37 +12,39 @@ import FormattedMarkdownText from 'app/components/formatted_markdown_text';
import FormattedText from 'app/components/formatted_text';
import Markdown from 'app/components/markdown';
import {t} from 'app/utils/i18n';
const typeMessage = {
[Posts.POST_TYPES.ADD_TO_CHANNEL]: {
id: 'last_users_message.added_to_channel.type',
id: t('last_users_message.added_to_channel.type'),
defaultMessage: 'were **added to the channel** by {actor}.',
},
[Posts.POST_TYPES.JOIN_CHANNEL]: {
id: 'last_users_message.joined_channel.type',
id: t('last_users_message.joined_channel.type'),
defaultMessage: '**joined the channel**.',
},
[Posts.POST_TYPES.LEAVE_CHANNEL]: {
id: 'last_users_message.left_channel.type',
id: t('last_users_message.left_channel.type'),
defaultMessage: '**left the channel**.',
},
[Posts.POST_TYPES.REMOVE_FROM_CHANNEL]: {
id: 'last_users_message.removed_from_channel.type',
id: t('last_users_message.removed_from_channel.type'),
defaultMessage: 'were **removed from the channel**.',
},
[Posts.POST_TYPES.ADD_TO_TEAM]: {
id: 'last_users_message.added_to_team.type',
id: t('last_users_message.added_to_team.type'),
defaultMessage: 'were **added to the team** by {actor}.',
},
[Posts.POST_TYPES.JOIN_TEAM]: {
id: 'last_users_message.joined_team.type',
id: t('last_users_message.joined_team.type'),
defaultMessage: '**joined the team**.',
},
[Posts.POST_TYPES.LEAVE_TEAM]: {
id: 'last_users_message.left_team.type',
id: t('last_users_message.left_team.type'),
defaultMessage: '**left the team**.',
},
[Posts.POST_TYPES.REMOVE_FROM_TEAM]: {
id: 'last_users_message.removed_from_team.type',
id: t('last_users_message.removed_from_team.type'),
defaultMessage: 'were **removed from the team**.',
},
};

View file

@ -23,6 +23,7 @@ import TextInputWithLocalizedPlaceholder from 'app/components/text_input_with_lo
import {changeOpacity, makeStyleSheetFromTheme} from 'app/utils/theme';
import {General} from 'mattermost-redux/constants';
import {getShortenedURL} from 'app/utils/url';
import {t} from 'app/utils/i18n';
export default class EditChannelInfo extends PureComponent {
static propTypes = {
@ -248,7 +249,7 @@ export default class EditChannelInfo extends PureComponent {
style={style.input}
autoCapitalize='none'
autoCorrect={false}
placeholder={{id: 'channel_modal.nameEx', defaultMessage: 'E.g.: "Bugs", "Marketing", "客户支持"'}}
placeholder={{id: t('channel_modal.nameEx'), defaultMessage: 'E.g.: "Bugs", "Marketing", "客户支持"'}}
placeholderTextColor={changeOpacity('#000', 0.5)}
underlineColorAndroid='transparent'
disableFullscreenUI={true}
@ -277,7 +278,7 @@ export default class EditChannelInfo extends PureComponent {
style={style.input}
autoCapitalize='none'
autoCorrect={false}
placeholder={{id: 'rename_channel.handleHolder', defaultMessage: 'lowercase alphanumeric characters'}}
placeholder={{id: t('rename_channel.handleHolder'), defaultMessage: 'lowercase alphanumeric characters'}}
placeholderTextColor={changeOpacity('#000', 0.5)}
underlineColorAndroid='transparent'
disableFullscreenUI={true}
@ -307,7 +308,7 @@ export default class EditChannelInfo extends PureComponent {
style={[style.input, {height: 110}]}
autoCapitalize='none'
autoCorrect={false}
placeholder={{id: 'channel_modal.purposeEx', defaultMessage: 'E.g.: "A channel to file bugs and improvements"'}}
placeholder={{id: t('channel_modal.purposeEx'), defaultMessage: 'E.g.: "A channel to file bugs and improvements"'}}
placeholderTextColor={changeOpacity('#000', 0.5)}
multiline={true}
blurOnSubmit={false}
@ -345,7 +346,7 @@ export default class EditChannelInfo extends PureComponent {
style={[style.input, {height: 110}]}
autoCapitalize='none'
autoCorrect={false}
placeholder={{id: 'channel_modal.headerEx', defaultMessage: 'E.g.: "[Link Title](http://example.com)"'}}
placeholder={{id: t('channel_modal.headerEx'), defaultMessage: 'E.g.: "[Link Title](http://example.com)"'}}
placeholderTextColor={changeOpacity('#000', 0.5)}
multiline={true}
blurOnSubmit={false}

View file

@ -13,58 +13,59 @@ import {getCustomEmojis, searchCustomEmojis} from 'mattermost-redux/actions/emoj
import {incrementEmojiPickerPage} from 'app/actions/views/emoji';
import {getDimensions, isLandscape} from 'app/selectors/device';
import {CategoryNames, Emojis, EmojiIndicesByAlias, EmojiIndicesByCategory} from 'app/utils/emojis';
import {t} from 'app/utils/i18n';
import EmojiPicker from './emoji_picker';
import Fuse from 'fuse.js';
const categoryToI18n = {
activity: {
id: 'mobile.emoji_picker.activity',
id: t('mobile.emoji_picker.activity'),
defaultMessage: 'ACTIVITY',
icon: 'futbol-o',
},
custom: {
id: 'mobile.emoji_picker.custom',
id: t('mobile.emoji_picker.custom'),
defaultMessage: 'CUSTOM',
icon: 'at',
},
flags: {
id: 'mobile.emoji_picker.flags',
id: t('mobile.emoji_picker.flags'),
defaultMessage: 'FLAGS',
icon: 'flag-o',
},
foods: {
id: 'mobile.emoji_picker.foods',
id: t('mobile.emoji_picker.foods'),
defaultMessage: 'FOODS',
icon: 'cutlery',
},
nature: {
id: 'mobile.emoji_picker.nature',
id: t('mobile.emoji_picker.nature'),
defaultMessage: 'NATURE',
icon: 'leaf',
},
objects: {
id: 'mobile.emoji_picker.objects',
id: t('mobile.emoji_picker.objects'),
defaultMessage: 'OBJECTS',
icon: 'lightbulb-o',
},
people: {
id: 'mobile.emoji_picker.people',
id: t('mobile.emoji_picker.people'),
defaultMessage: 'PEOPLE',
icon: 'smile-o',
},
places: {
id: 'mobile.emoji_picker.places',
id: t('mobile.emoji_picker.places'),
defaultMessage: 'PLACES',
icon: 'plane',
},
recent: {
id: 'mobile.emoji_picker.recent',
id: t('mobile.emoji_picker.recent'),
defaultMessage: 'RECENTLY USED',
icon: 'clock-o',
},
symbols: {
id: 'mobile.emoji_picker.symbols',
id: t('mobile.emoji_picker.symbols'),
defaultMessage: 'SYMBOLS',
icon: 'heart-o',
},

View file

@ -7,6 +7,7 @@ import {TouchableOpacity, View} from 'react-native';
import FormattedText from 'app/components/formatted_text';
import {changeOpacity, makeStyleSheetFromTheme} from 'app/utils/theme';
import {t} from 'app/utils/i18n';
import Cloud from './cloud';
@ -20,11 +21,11 @@ export default class FailedNetworkAction extends PureComponent {
static defaultProps = {
errorTitle: {
id: 'mobile.failed_network_action.title',
id: t('mobile.failed_network_action.title'),
defaultMessage: 'No internet connection',
},
errorDescription: {
id: 'mobile.failed_network_action.description',
id: t('mobile.failed_network_action.description'),
defaultMessage: 'There seems to be a problem with your internet connection. Make sure you have an active connection and try again.',
},
};

View file

@ -11,6 +11,7 @@ import {
} from 'react-native';
import {makeStyleSheetFromTheme} from 'app/utils/theme';
import {t} from 'app/utils/i18n';
import FormattedText from 'app/components/formatted_text';
@ -32,7 +33,7 @@ export default class LoadMorePosts extends PureComponent {
renderText(style) {
if (this.props.loading) {
const i18nId = 'mobile.loading_posts';
const i18nId = t('mobile.loading_posts');
const defaultMessage = 'Loading messages...';
return (

View file

@ -18,6 +18,7 @@ import FormattedText from 'app/components/formatted_text';
import {ViewTypes} from 'app/constants';
import mattermostBucket from 'app/mattermost_bucket';
import checkNetwork from 'app/utils/network';
import {t} from 'app/utils/i18n';
import LocalConfig from 'assets/config';
import {RequestStatus} from 'mattermost-redux/constants';
@ -47,8 +48,8 @@ export default class OfflineIndicator extends Component {
webSocketStatus: PropTypes.string,
};
static defaultProps: {
isOnline: true
static defaultProps = {
isOnline: true,
};
constructor(props) {
@ -214,7 +215,7 @@ export default class OfflineIndicator extends Component {
let action;
switch (this.state.network) {
case OFFLINE:
i18nId = 'mobile.offlineIndicator.offline';
i18nId = t('mobile.offlineIndicator.offline');
defaultMessage = 'Cannot connect to the server';
action = (
<TouchableOpacity
@ -230,7 +231,7 @@ export default class OfflineIndicator extends Component {
);
break;
case CONNECTING:
i18nId = 'mobile.offlineIndicator.connecting';
i18nId = t('mobile.offlineIndicator.connecting');
defaultMessage = 'Connecting...';
action = (
<View style={styles.actionContainer}>
@ -243,7 +244,7 @@ export default class OfflineIndicator extends Component {
break;
case CONNECTED:
default:
i18nId = 'mobile.offlineIndicator.connected';
i18nId = t('mobile.offlineIndicator.connected');
defaultMessage = 'Connected';
action = (
<View style={styles.actionContainer}>

View file

@ -23,6 +23,7 @@ import {fromAutoResponder} from 'app/utils/general';
import {preventDoubleTap} from 'app/utils/tap';
import {changeOpacity, makeStyleSheetFromTheme} from 'app/utils/theme';
import {getToolTipVisible} from 'app/utils/tooltip';
import {t} from 'app/utils/i18n';
import {Posts} from 'mattermost-redux/constants';
import EventEmitter from 'mattermost-redux/utils/event_emitter';
@ -191,7 +192,7 @@ export default class Post extends PureComponent {
handleFailedPostPress = () => {
const options = {
title: {
id: 'mobile.post.failed_title',
id: t('mobile.post.failed_title'),
defaultMessage: 'Unable to send your message:',
},
items: [{
@ -202,7 +203,7 @@ export default class Post extends PureComponent {
this.props.actions.createPost(post);
},
text: {
id: 'mobile.post.failed_retry',
id: t('mobile.post.failed_retry'),
defaultMessage: 'Try Again',
},
}, {
@ -211,7 +212,7 @@ export default class Post extends PureComponent {
this.onRemovePost(this.props.post);
},
text: {
id: 'mobile.post.failed_delete',
id: t('mobile.post.failed_delete'),
defaultMessage: 'Delete Message',
},
textStyle: {

View file

@ -10,6 +10,7 @@ import {Text} from 'react-native';
import {General} from 'mattermost-redux/constants';
import {concatStyles} from 'app/utils/theme';
import {t} from 'app/utils/i18n';
import AtMention from 'app/components/at_mention';
import FormattedText from 'app/components/formatted_text';
@ -145,20 +146,20 @@ export default class PostAddChannelMember extends React.PureComponent {
let linkId;
let linkText;
if (channelType === General.PRIVATE_CHANNEL) {
linkId = 'post_body.check_for_out_of_channel_mentions.link.private';
linkId = t('post_body.check_for_out_of_channel_mentions.link.private');
linkText = 'add them to this private channel';
} else if (channelType === General.OPEN_CHANNEL) {
linkId = 'post_body.check_for_out_of_channel_mentions.link.public';
linkId = t('post_body.check_for_out_of_channel_mentions.link.public');
linkText = 'add them to the channel';
}
let messageId;
let messageText;
if (usernames.length === 1) {
messageId = 'post_body.check_for_out_of_channel_mentions.message.one';
messageId = t('post_body.check_for_out_of_channel_mentions.message.one');
messageText = 'was mentioned but is not in the channel. Would you like to ';
} else if (usernames.length > 1) {
messageId = 'post_body.check_for_out_of_channel_mentions.message.multiple';
messageId = t('post_body.check_for_out_of_channel_mentions.message.multiple');
messageText = 'were mentioned but they are not in the channel. Would you like to ';
}

View file

@ -15,6 +15,7 @@ import FileUploadPreview from 'app/components/file_upload_preview';
import {INITIAL_HEIGHT, INSERT_TO_COMMENT, INSERT_TO_DRAFT, IS_REACTION_REGEX, MAX_CONTENT_HEIGHT, MAX_FILE_COUNT} from 'app/constants/post_textbox';
import {confirmOutOfOfficeDisabled} from 'app/utils/status';
import {changeOpacity, makeStyleSheetFromTheme} from 'app/utils/theme';
import {t} from 'app/utils/i18n';
import FormattedMarkdownText from 'app/components/formatted_markdown_text';
import FormattedText from 'app/components/formatted_text';
@ -524,11 +525,11 @@ export default class PostTextbox extends PureComponent {
let placeholder;
if (channelIsReadOnly) {
placeholder = {id: 'mobile.create_post.read_only', defaultMessage: 'This channel is read-only.'};
placeholder = {id: t('mobile.create_post.read_only'), defaultMessage: 'This channel is read-only.'};
} else if (rootId) {
placeholder = {id: 'create_comment.addComment', defaultMessage: 'Add a comment...'};
placeholder = {id: t('create_comment.addComment'), defaultMessage: 'Add a comment...'};
} else {
placeholder = {id: 'create_post.write', defaultMessage: 'Write a message...'};
placeholder = {id: t('create_post.write'), defaultMessage: 'Write a message...'};
}
let attachmentButton = null;

View file

@ -13,8 +13,8 @@ export default class RadioButtonGroup extends PureComponent {
onSelect: PropTypes.func,
};
static defaultProps: {
options: []
static defaultProps = {
options: [],
};
constructor(props) {

View file

@ -7,6 +7,7 @@ import {Text, TouchableOpacity, View} from 'react-native';
import LinearGradient from 'react-native-linear-gradient';
import FormattedText from 'app/components/formatted_text';
import {t} from 'app/utils/i18n';
import {changeOpacity, makeStyleSheetFromTheme} from 'app/utils/theme';
@ -24,11 +25,11 @@ export default class ShowMoreButton extends PureComponent {
renderButton(showMore, style) {
let sign = '+';
let textId = 'post_info.message.show_more';
let textId = t('post_info.message.show_more');
let textMessage = 'Show More';
if (!showMore) {
sign = '-';
textId = 'post_info.message.show_less';
textId = t('post_info.message.show_less');
textMessage = 'Show Less';
}

View file

@ -18,6 +18,7 @@ import {changeOpacity} from 'app/utils/theme';
import {General} from 'mattermost-redux/constants';
import {sortChannelsByDisplayName} from 'mattermost-redux/utils/channel_utils';
import {displayUsername} from 'mattermost-redux/utils/user_utils';
import {t} from 'app/utils/i18n';
import ChannelItem from 'app/components/sidebars/main/channels_list/channel_item';
import {ListTypes} from 'app/constants';
@ -145,27 +146,27 @@ class FilteredList extends Component {
getSectionBuilders = () => ({
unreads: {
builder: this.buildUnreadChannelsForSearch,
id: 'mobile.channel_list.unreads',
id: t('mobile.channel_list.unreads'),
defaultMessage: 'UNREADS',
},
channels: {
builder: this.buildChannelsForSearch,
id: 'mobile.channel_list.channels',
id: t('mobile.channel_list.channels'),
defaultMessage: 'CHANNELS',
},
dms: {
builder: this.buildCurrentDMSForSearch,
id: 'sidebar.direct',
id: t('sidebar.direct'),
defaultMessage: 'DIRECT MESSAGES',
},
members: {
builder: this.buildMembersForSearch,
id: 'mobile.channel_list.members',
id: t('mobile.channel_list.members'),
defaultMessage: 'MEMBERS',
},
nonmembers: {
builder: this.buildOtherMembersForSearch,
id: 'mobile.channel_list.not_member',
id: t('mobile.channel_list.not_member'),
defaultMessage: 'NOT A MEMBER',
},
});

View file

@ -20,6 +20,7 @@ import ChannelItem from 'app/components/sidebars/main/channels_list/channel_item
import {ListTypes} from 'app/constants';
import {preventDoubleTap} from 'app/utils/tap';
import {changeOpacity} from 'app/utils/theme';
import {t} from 'app/utils/i18n';
const VIEWABILITY_CONFIG = {
...ListTypes.VISIBILITY_CONFIG_DEFAULTS,
@ -100,7 +101,7 @@ export default class List extends PureComponent {
if (unreadChannelIds.length) {
sections.push({
id: 'mobile.channel_list.unreads',
id: t('mobile.channel_list.unreads'),
defaultMessage: 'UNREADS',
data: unreadChannelIds,
renderItem: this.renderUnreadItem,
@ -111,7 +112,7 @@ export default class List extends PureComponent {
if (favoriteChannelIds.length) {
sections.push({
id: 'sidebar.favorite',
id: t('sidebar.favorite'),
defaultMessage: 'FAVORITES',
data: favoriteChannelIds,
topSeparator: unreadChannelIds.length > 0,
@ -121,7 +122,7 @@ export default class List extends PureComponent {
sections.push({
action: this.goToMoreChannels,
id: 'sidebar.channels',
id: t('sidebar.channels'),
defaultMessage: 'PUBLIC CHANNELS',
data: publicChannelIds,
topSeparator: favoriteChannelIds.length > 0 || unreadChannelIds.length > 0,
@ -130,7 +131,7 @@ export default class List extends PureComponent {
sections.push({
action: canCreatePrivateChannels ? this.goToCreatePrivateChannel : null,
id: 'sidebar.pg',
id: t('sidebar.pg'),
defaultMessage: 'PRIVATE CHANNELS',
data: privateChannelIds,
topSeparator: true,
@ -139,7 +140,7 @@ export default class List extends PureComponent {
sections.push({
action: this.goToDirectMessages,
id: 'sidebar.direct',
id: t('sidebar.direct'),
defaultMessage: 'DIRECT MESSAGES',
data: directChannelIds,
topSeparator: true,

View file

@ -17,6 +17,7 @@ import EventEmitter from 'mattermost-redux/utils/event_emitter';
import SafeAreaView from 'app/components/safe_area_view';
import tracker from 'app/utils/time_tracker';
import {t} from 'app/utils/i18n';
import ChannelsList from './channels_list';
import DrawerSwiper from './drawer_swipper';
@ -186,7 +187,7 @@ export default class ChannelSidebar extends Component {
const {intl} = this.context;
const unableToJoinMessage = {
id: 'mobile.open_unknown_channel.error',
id: t('mobile.open_unknown_channel.error'),
defaultMessage: "We couldn't join the channel. Please reset the cache and try again.",
};
const erroMessage = {};
@ -226,7 +227,7 @@ export default class ChannelSidebar extends Component {
if (result.error) {
const dmFailedMessage = {
id: 'mobile.open_dm.error',
id: t('mobile.open_dm.error'),
defaultMessage: "We couldn't open a direct message with {displayName}. Please check your connection and try again.",
};
utils.alertErrorWithFallback(intl, result.error, dmFailedMessage, displayValue);
@ -236,7 +237,7 @@ export default class ChannelSidebar extends Component {
if (result.error || !result.data || !result.data.channel) {
const joinFailedMessage = {
id: 'mobile.join_channel.error',
id: t('mobile.join_channel.error'),
defaultMessage: "We couldn't join the channel {displayName}. Please check your connection and try again.",
};
utils.alertErrorWithFallback(intl, result.error, joinFailedMessage, displayValue);

View file

@ -23,6 +23,7 @@ import {NavigationTypes} from 'app/constants';
import {confirmOutOfOfficeDisabled} from 'app/utils/status';
import {preventDoubleTap} from 'app/utils/tap';
import {changeOpacity, makeStyleSheetFromTheme} from 'app/utils/theme';
import {t} from 'app/utils/i18n';
import DrawerItem from './drawer_item';
import UserInfo from './user_info';
@ -107,25 +108,25 @@ export default class SettingsDrawer extends PureComponent {
const items = [{
action: () => this.setStatus(General.ONLINE),
text: {
id: 'mobile.set_status.online',
id: t('mobile.set_status.online'),
defaultMessage: 'Online',
},
}, {
action: () => this.setStatus(General.AWAY),
text: {
id: 'mobile.set_status.away',
id: t('mobile.set_status.away'),
defaultMessage: 'Away',
},
}, {
action: () => this.setStatus(General.DND),
text: {
id: 'mobile.set_status.dnd',
id: t('mobile.set_status.dnd'),
defaultMessage: 'Do Not Disturb',
},
}, {
action: () => this.setStatus(General.OFFLINE),
text: {
id: 'mobile.set_status.offline',
id: t('mobile.set_status.offline'),
defaultMessage: 'Offline',
},
}];

View file

@ -8,6 +8,7 @@ import {General} from 'mattermost-redux/constants';
import FormattedText from 'app/components/formatted_text';
import {changeOpacity, makeStyleSheetFromTheme} from 'app/utils/theme';
import {t} from 'app/utils/i18n';
export default class UserInfo extends PureComponent {
static propTypes = {
@ -23,25 +24,25 @@ export default class UserInfo extends PureComponent {
const {status, theme} = this.props;
const style = getStyleSheet(theme);
let i18nId = 'status_dropdown.set_offline';
let i18nId = t('status_dropdown.set_offline');
let defaultMessage = 'Offline';
switch (status) {
case General.AWAY:
i18nId = 'status_dropdown.set_away';
i18nId = t('status_dropdown.set_away');
defaultMessage = 'Away';
break;
case General.DND:
i18nId = 'status_dropdown.set_dnd';
i18nId = t('status_dropdown.set_dnd');
defaultMessage = 'Do Not Disturb';
break;
case General.ONLINE:
i18nId = 'status_dropdown.set_online';
i18nId = t('status_dropdown.set_online');
defaultMessage = 'Online';
break;
}
if (status === General.OUT_OF_OFFICE) {
i18nId = 'status_dropdown.set_ooo';
i18nId = t('status_dropdown.set_ooo');
defaultMessage = 'Out Of Office';
}

View file

@ -12,6 +12,8 @@ import EventEmitter from 'mattermost-redux/utils/event_emitter';
import mattermostBucket from 'app/mattermost_bucket';
import LocalConfig from 'assets/config';
import {t} from 'app/utils/i18n';
const HEADER_X_VERSION_ID = 'X-Version-Id';
const HEADER_X_CLUSTER_ID = 'X-Cluster-Id';
const HEADER_TOKEN = 'Token';
@ -59,7 +61,7 @@ Client4.doFetchWithResponse = async (url, options) => {
throw {
message: 'Received invalid response from the server.',
intl: {
id: 'mobile.request.invalid_response',
id: t('mobile.request.invalid_response'),
defaultMessage: 'Received invalid response from the server.',
},
};

View file

@ -45,6 +45,7 @@ import {loadConfigAndLicense, startDataCleanup} from 'app/actions/views/root';
import {setChannelDisplayName} from 'app/actions/views/channel';
import {deleteFileCache} from 'app/utils/file';
import avoidNativeBridge from 'app/utils/avoid_native_bridge';
import {t} from 'app/utils/i18n';
import LocalConfig from 'assets/config';
import App from './app';
@ -161,10 +162,10 @@ const handleServerVersionChanged = async (serverVersion) => {
if (serverVersion) {
if (semver.valid(version) && semver.lt(version, LocalConfig.MinServerVersion)) {
Alert.alert(
translations['mobile.server_upgrade.title'],
translations['mobile.server_upgrade.description'],
translations[t('mobile.server_upgrade.title')],
translations[t('mobile.server_upgrade.description')],
[{
text: translations['mobile.server_upgrade.button'],
text: translations[t('mobile.server_upgrade.button')],
onPress: handleServerVersionUpgradeNeeded,
}],
{cancelable: false}
@ -265,10 +266,10 @@ export const handleManagedConfig = async (eventFromEmmServer = false) => {
if (!isTrusted) {
const translations = app.getTranslations();
Alert.alert(
translations['mobile.managed.blocked_by'].replace('{vendor}', vendor),
translations['mobile.managed.jailbreak'].replace('{vendor}', vendor),
translations[t('mobile.managed.blocked_by')].replace('{vendor}', vendor),
translations[t('mobile.managed.jailbreak')].replace('{vendor}', vendor),
[{
text: translations['mobile.managed.exit'],
text: translations[t('mobile.managed.exit')],
style: 'destructive',
onPress: () => {
mattermostManaged.quitApp();
@ -315,7 +316,7 @@ const handleAuthentication = async (vendor) => {
try {
mattermostBucket.setPreference('emm', vendor, LocalConfig.AppGroupId);
await mattermostManaged.authenticate({
reason: translations['mobile.managed.secured_by'].replace('{vendor}', vendor),
reason: translations[t('mobile.managed.secured_by')].replace('{vendor}', vendor),
fallbackToPasscode: true,
suppressEnterPassword: true,
});

View file

@ -15,6 +15,7 @@ import StatusBar from 'app/components/status_bar';
import {preventDoubleTap} from 'app/utils/tap';
import {alertErrorWithFallback} from 'app/utils/general';
import {changeOpacity, makeStyleSheetFromTheme, setNavigatorStyles} from 'app/utils/theme';
import {t} from 'app/utils/i18n';
import {General} from 'mattermost-redux/constants';
import EventEmitter from 'mattermost-redux/utils/event_emitter';
@ -118,7 +119,7 @@ export default class ChannelInfo extends PureComponent {
goToChannelMembers = preventDoubleTap(() => {
const {intl} = this.context;
const {canManageUsers, navigator, theme} = this.props;
const id = canManageUsers ? 'channel_header.manageMembers' : 'channel_header.viewMembers';
const id = canManageUsers ? t('channel_header.manageMembers') : t('channel_header.viewMembers');
const defaultMessage = canManageUsers ? 'Manage Members' : 'View Members';
navigator.push({
@ -138,7 +139,7 @@ export default class ChannelInfo extends PureComponent {
handleChannelEdit = preventDoubleTap(() => {
const {intl} = this.context;
const {navigator, theme} = this.props;
const id = 'mobile.channel_info.edit';
const id = t('mobile.channel_info.edit');
const defaultMessage = 'Edit Channel';
navigator.push({
@ -173,9 +174,9 @@ export default class ChannelInfo extends PureComponent {
let message;
let onPressAction;
if (eventType === 'leave') {
title = {id: 'mobile.channel_info.alertTitleLeaveChannel', defaultMessage: 'Leave {term}'};
title = {id: t('mobile.channel_info.alertTitleLeaveChannel'), defaultMessage: 'Leave {term}'};
message = {
id: 'mobile.channel_info.alertMessageLeaveChannel',
id: t('mobile.channel_info.alertMessageLeaveChannel'),
defaultMessage: 'Are you sure you want to leave the {term} {name}?',
};
onPressAction = () => {
@ -184,9 +185,9 @@ export default class ChannelInfo extends PureComponent {
});
};
} else if (eventType === 'delete') {
title = {id: 'mobile.channel_info.alertTitleDeleteChannel', defaultMessage: 'Archive {term}'};
title = {id: t('mobile.channel_info.alertTitleDeleteChannel'), defaultMessage: 'Archive {term}'};
message = {
id: 'mobile.channel_info.alertMessageDeleteChannel',
id: t('mobile.channel_info.alertMessageDeleteChannel'),
defaultMessage: 'Are you sure you want to archive the {term} {name}?',
};
onPressAction = async () => {
@ -196,7 +197,7 @@ export default class ChannelInfo extends PureComponent {
this.context.intl,
result.error,
{
id: 'mobile.channel_info.delete_failed',
id: t('mobile.channel_info.delete_failed'),
defaultMessage: "We couldn't archive the channel {displayName}. Please check your connection and try again.",
},
{
@ -350,7 +351,7 @@ export default class ChannelInfo extends PureComponent {
defaultMessage='Favorite'
detail={this.state.isFavorite}
icon='star-o'
textId='mobile.routes.channelInfo.favorite'
textId={t('mobile.routes.channelInfo.favorite')}
togglable={true}
theme={theme}
/>
@ -360,7 +361,7 @@ export default class ChannelInfo extends PureComponent {
defaultMessage='Mute channel'
detail={this.state.isMuted}
icon='bell-slash-o'
textId='channel_notifications.muteChannel.settings'
textId={t('channel_notifications.muteChannel.settings')}
togglable={true}
theme={theme}
/>
@ -385,7 +386,7 @@ export default class ChannelInfo extends PureComponent {
defaultMessage={canManageUsers ? 'Manage Members' : 'View Members'}
detail={currentChannelMemberCount}
icon='users'
textId={canManageUsers ? 'channel_header.manageMembers' : 'channel_header.viewMembers'}
textId={canManageUsers ? t('channel_header.manageMembers') : t('channel_header.viewMembers')}
theme={theme}
/>
</View>
@ -397,7 +398,7 @@ export default class ChannelInfo extends PureComponent {
action={this.goToChannelAddMembers}
defaultMessage='Add Members'
icon='user-plus'
textId='channel_header.addMembers'
textId={t('channel_header.addMembers')}
theme={theme}
/>
</View>
@ -409,7 +410,7 @@ export default class ChannelInfo extends PureComponent {
action={this.handleChannelEdit}
defaultMessage='Edit Channel'
icon='edit'
textId='mobile.channel_info.edit'
textId={t('mobile.channel_info.edit')}
theme={theme}
/>
</View>
@ -436,11 +437,11 @@ export default class ChannelInfo extends PureComponent {
let defaultMessage;
switch (currentChannel.type) {
case General.DM_CHANNEL:
i18nId = 'mobile.channel_list.closeDM';
i18nId = t('mobile.channel_list.closeDM');
defaultMessage = 'Close Direct Message';
break;
case General.GM_CHANNEL:
i18nId = 'mobile.channel_list.closeGM';
i18nId = t('mobile.channel_list.closeGM');
defaultMessage = 'Close Group Message';
break;
}
@ -474,7 +475,7 @@ export default class ChannelInfo extends PureComponent {
action={this.handleLeave}
defaultMessage='Leave Channel'
icon='sign-out'
textId='navbar.leave'
textId={t('navbar.leave')}
theme={theme}
/>
</View>
@ -487,7 +488,7 @@ export default class ChannelInfo extends PureComponent {
defaultMessage='Archive Channel'
iconColor='#CA3B27'
icon='archive'
textId='mobile.routes.channelInfo.delete_channel'
textId={t('mobile.routes.channelInfo.delete_channel')}
textColor='#CA3B27'
theme={theme}
/>

View file

@ -11,6 +11,7 @@ import SectionItem from 'app/screens/settings/section_item';
import FormattedText from 'app/components/formatted_text';
import {changeOpacity, makeStyleSheetFromTheme} from 'app/utils/theme';
import {t} from 'app/utils/i18n';
import ClockDisplayBase from './clock_display_base';
@ -26,7 +27,7 @@ export default class ClockDisplay extends ClockDisplayBase {
<View style={style.wrapper}>
<Section
disableHeader={true}
footerId='user.settings.display.preferTime'
footerId={t('user.settings.display.preferTime')}
footerDefaultMessage='Select how you prefer time displayed.'
theme={theme}
>

View file

@ -16,34 +16,35 @@ import EditChannelInfo from 'app/components/edit_channel_info';
import {ViewTypes} from 'app/constants';
import {setNavigatorStyles} from 'app/utils/theme';
import {cleanUpUrlable} from 'app/utils/url';
import {t} from 'app/utils/i18n';
const messages = {
display_name_required: {
id: 'mobile.rename_channel.display_name_required',
id: t('mobile.rename_channel.display_name_required'),
defaultMessage: 'Channel name is required',
},
display_name_maxLength: {
id: 'mobile.rename_channel.display_name_maxLength',
id: t('mobile.rename_channel.display_name_maxLength'),
defaultMessage: 'Channel name must be less than {maxLength, number} characters',
},
display_name_minLength: {
id: 'mobile.rename_channel.display_name_minLength',
id: t('mobile.rename_channel.display_name_minLength'),
defaultMessage: 'Channel name must be {minLength, number} or more characters',
},
name_required: {
id: 'mobile.rename_channel.name_required',
id: t('mobile.rename_channel.name_required'),
defaultMessage: 'URL is required',
},
name_maxLength: {
id: 'mobile.rename_channel.name_maxLength',
id: t('mobile.rename_channel.name_maxLength'),
defaultMessage: 'URL must be less than {maxLength, number} characters',
},
name_minLength: {
id: 'mobile.rename_channel.name_minLength',
id: t('mobile.rename_channel.name_minLength'),
defaultMessage: 'URL must be {minLength, number} or more characters',
},
name_lowercase: {
id: 'mobile.rename_channel.name_lowercase',
id: t('mobile.rename_channel.name_lowercase'),
defaultMessage: 'URL be lowercase alphanumeric characters',
},
};

View file

@ -13,6 +13,7 @@ import Loading from 'app/components/loading';
import StatusBar from 'app/components/status_bar';
import TextInputWithLocalizedPlaceholder from 'app/components/text_input_with_localized_placeholder';
import {changeOpacity, makeStyleSheetFromTheme, setNavigatorStyles} from 'app/utils/theme';
import {t} from 'app/utils/i18n';
import {RequestStatus} from 'mattermost-redux/constants';
@ -187,7 +188,7 @@ export default class EditPost extends PureComponent {
autoFocus={true}
autoCapitalize='none'
autoCorrect={false}
placeholder={{id: 'edit_post.editPost', defaultMessage: 'Edit the post...'}}
placeholder={{id: t('edit_post.editPost'), defaultMessage: 'Edit the post...'}}
placeholderTextColor={changeOpacity(theme.centerChannelColor, 0.4)}
underlineColorAndroid='transparent'
disableFullscreenUI={true}

View file

@ -14,6 +14,7 @@ import {buildFileUploadData, encodeHeaderURIStringToUTF8} from 'app/utils/file';
import {emptyFunction} from 'app/utils/general';
import {preventDoubleTap} from 'app/utils/tap';
import {changeOpacity, makeStyleSheetFromTheme} from 'app/utils/theme';
import {t} from 'app/utils/i18n';
import Loading from 'app/components/loading';
import ErrorText from 'app/components/error_text';
@ -27,27 +28,27 @@ import EditProfileItem from './edit_profile_item';
const holders = {
firstName: {
id: 'user.settings.general.firstName',
id: t('user.settings.general.firstName'),
defaultMessage: 'First Name',
},
lastName: {
id: 'user.settings.general.lastName',
id: t('user.settings.general.lastName'),
defaultMessage: 'Last Name',
},
username: {
id: 'user.settings.general.username',
id: t('user.settings.general.username'),
defaultMessage: 'Username',
},
nickname: {
id: 'user.settings.general.nickname',
id: t('user.settings.general.nickname'),
defaultMessage: 'Nickname',
},
position: {
id: 'user.settings.general.position',
id: t('user.settings.general.position'),
defaultMessage: 'Position',
},
email: {
id: 'user.settings.general.email',
id: t('user.settings.general.email'),
defaultMessage: 'Email',
},
};

View file

@ -12,14 +12,15 @@ import FailedNetworkAction from 'app/components/failed_network_action';
import Loading from 'app/components/loading';
import StatusBar from 'app/components/status_bar';
import {makeStyleSheetFromTheme, setNavigatorStyles} from 'app/utils/theme';
import {t} from 'app/utils/i18n';
const errorTitle = {
id: 'error.team_not_found.title',
id: t('error.team_not_found.title'),
defaultMessage: 'Team Not Found',
};
const errorDescription = {
id: 'mobile.failed_network_action.shortDescription',
id: t('mobile.failed_network_action.shortDescription'),
defaultMessage: 'Make sure you have an active connection and try again.',
};

View file

@ -49,7 +49,7 @@ export default class ExpandedAnnouncementBanner extends React.PureComponent {
onPress={this.dismissBanner}
>
<FormattedText
id='asdf'
id='announcment_banner.dont_show_again'
defaultMessage={'Don\'t show again'}
style={style.dismissButtonText}
/>

View file

@ -32,6 +32,7 @@ import {DeviceTypes, NavigationTypes, PermissionTypes} from 'app/constants';
import {getLocalFilePathFromFile, isDocument, isVideo} from 'app/utils/file';
import {emptyFunction} from 'app/utils/general';
import {calculateDimensions} from 'app/utils/images';
import {t} from 'app/utils/i18n';
import Downloader from './downloader';
import VideoPreview from './video_preview';
@ -544,7 +545,7 @@ export default class ImagePreview extends PureComponent {
items.push({
action: this.saveVideoIOS,
text: {
id: 'mobile.image_preview.save_video',
id: t('mobile.image_preview.save_video'),
defaultMessage: 'Save Video',
},
});
@ -555,7 +556,7 @@ export default class ImagePreview extends PureComponent {
items.push({
action: this.showDownloader,
text: {
id: 'mobile.image_preview.save',
id: t('mobile.image_preview.save'),
defaultMessage: 'Save Image',
},
});

View file

@ -26,6 +26,7 @@ import PushNotifications from 'app/push_notifications';
import {GlobalStyles} from 'app/styles';
import {preventDoubleTap} from 'app/utils/tap';
import tracker from 'app/utils/time_tracker';
import {t} from 'app/utils/i18n';
import {RequestStatus} from 'mattermost-redux/constants';
@ -178,7 +179,7 @@ export default class Login extends PureComponent {
isLoading: false,
error: {
intl: {
id: 'login.noPassword',
id: t('login.noPassword'),
defaultMessage: 'Please enter your password',
},
},
@ -262,7 +263,7 @@ export default class Login extends PureComponent {
) {
return {
intl: {
id: 'login.userNotFound',
id: t('login.userNotFound'),
defaultMessage: "We couldn't find an account matching your login credentials.",
},
};
@ -272,7 +273,7 @@ export default class Login extends PureComponent {
) {
return {
intl: {
id: 'login.invalidPassword',
id: t('login.invalidPassword'),
defaultMessage: 'Your password is incorrect.',
},
};

View file

@ -22,6 +22,7 @@ import StatusBar from 'app/components/status_bar';
import TextInputWithLocalizedPlaceholder from 'app/components/text_input_with_localized_placeholder';
import {GlobalStyles} from 'app/styles';
import {preventDoubleTap} from 'app/utils/tap';
import {t} from 'app/utils/i18n';
export default class Mfa extends PureComponent {
static propTypes = {
@ -88,7 +89,7 @@ export default class Mfa extends PureComponent {
this.setState({
error: {
intl: {
id: 'login_mfa.tokenReq',
id: t('login_mfa.tokenReq'),
defaultMessage: 'Please enter an MFA token',
},
},
@ -155,7 +156,7 @@ export default class Mfa extends PureComponent {
autoCapitalize='none'
autoCorrect={false}
keyboardType='numeric'
placeholder={{id: 'login_mfa.token', defaultMessage: 'MFA Token'}}
placeholder={{id: t('login_mfa.token'), defaultMessage: 'MFA Token'}}
returnKeyType='go'
underlineColorAndroid='transparent'
disableFullscreenUI={true}

View file

@ -21,6 +21,7 @@ import SearchBar from 'app/components/search_bar';
import StatusBar from 'app/components/status_bar';
import {alertErrorWithFallback} from 'app/utils/general';
import {changeOpacity, makeStyleSheetFromTheme, setNavigatorStyles} from 'app/utils/theme';
import {t} from 'app/utils/i18n';
export default class MoreChannels extends PureComponent {
static propTypes = {
@ -348,7 +349,7 @@ export default class MoreChannels extends PureComponent {
showSections={false}
renderRow={ChannelListRow}
onRowPress={this.onSelectChannel}
loadingText={{id: 'mobile.loading_channels', defaultMessage: 'Loading Channels...'}}
loadingText={{id: t('mobile.loading_channels'), defaultMessage: 'Loading Channels...'}}
showNoResults={this.state.showNoResults}
/>
</React.Fragment>

View file

@ -26,6 +26,7 @@ import StatusBar from 'app/components/status_bar';
import {alertErrorWithFallback} from 'app/utils/general';
import {loadingText} from 'app/utils/member_list';
import {changeOpacity, setNavigatorStyles} from 'app/utils/theme';
import {t} from 'app/utils/i18n';
import SelectedUsers from './selected_users';
@ -366,7 +367,7 @@ class MoreDirectMessages extends PureComponent {
intl,
result.error,
{
id: 'mobile.open_gm.error',
id: t('mobile.open_gm.error'),
defaultMessage: "We couldn't open a group message with those users. Please check your connection and try again.",
}
);
@ -525,9 +526,9 @@ class MoreDirectMessages extends PureComponent {
<SelectedUsers
selectedIds={this.state.selectedIds}
warnCount={5}
warnMessage={{id: 'mobile.more_dms.add_more', defaultMessage: 'You can add {remaining, number} more users'}}
warnMessage={{id: t('mobile.more_dms.add_more'), defaultMessage: 'You can add {remaining, number} more users'}}
maxCount={7}
maxMessage={{id: 'mobile.more_dms.cannot_add_more', defaultMessage: 'You cannot add more users'}}
maxMessage={{id: t('mobile.more_dms.cannot_add_more'), defaultMessage: 'You cannot add more users'}}
onRemove={this.handleRemoveUser}
/>
</View>

View file

@ -34,6 +34,7 @@ import checkUpgradeType from 'app/utils/client_upgrade';
import {isValidUrl, stripTrailingSlashes} from 'app/utils/url';
import {preventDoubleTap} from 'app/utils/tap';
import tracker from 'app/utils/time_tracker';
import {t} from 'app/utils/i18n';
import LocalConfig from 'assets/config';
@ -176,7 +177,7 @@ export default class SelectServer extends PureComponent {
this.setState({
error: {
intl: {
id: 'mobile.server_url.invalid_format',
id: t('mobile.server_url.invalid_format'),
defaultMessage: 'URL must start with http:// or https://',
},
},

View file

@ -22,6 +22,7 @@ import StatusBar from 'app/components/status_bar';
import {ListTypes} from 'app/constants';
import {preventDoubleTap} from 'app/utils/tap';
import {changeOpacity, makeStyleSheetFromTheme, setNavigatorStyles} from 'app/utils/theme';
import {t} from 'app/utils/i18n';
import TeamIcon from 'app/components/team_icon';
@ -30,12 +31,12 @@ const VIEWABILITY_CONFIG = ListTypes.VISIBILITY_CONFIG_DEFAULTS;
const TEAMS_PER_PAGE = 200;
const errorTitle = {
id: 'error.team_not_found.title',
id: t('error.team_not_found.title'),
defaultMessage: 'Team Not Found',
};
const errorDescription = {
id: 'mobile.failed_network_action.shortDescription',
id: t('mobile.failed_network_action.shortDescription'),
defaultMessage: 'Make sure you have an active connection and try again.',
};
@ -100,7 +101,7 @@ export default class SelectTeam extends PureComponent {
this.setState({teams: props.teams});
} else {
const teams = [{
id: 'mobile.select_team.no_teams',
id: t('mobile.select_team.no_teams'),
defaultMessage: 'There are no available teams for you to join.',
}];
this.setState({teams});

View file

@ -17,6 +17,7 @@ import StatusBar from 'app/components/status_bar';
import {preventDoubleTap} from 'app/utils/tap';
import {changeOpacity, makeStyleSheetFromTheme, setNavigatorStyles} from 'app/utils/theme';
import {isValidUrl} from 'app/utils/url';
import {t} from 'app/utils/i18n';
import LocalConfig from 'assets/config';
@ -230,7 +231,7 @@ class Settings extends PureComponent {
<View style={style.divider}/>
<SettingsItem
defaultMessage='Notifications'
i18nId='user.settings.modal.notifications'
i18nId={t('user.settings.modal.notifications')}
iconName='ios-notifications'
iconType='ion'
onPress={this.goToNotifications}
@ -239,7 +240,7 @@ class Settings extends PureComponent {
/>
<SettingsItem
defaultMessage='Display'
i18nId='user.settings.modal.display'
i18nId={t('user.settings.modal.display')}
iconName='ios-apps'
iconType='ion'
onPress={this.goToDisplaySettings}
@ -249,7 +250,7 @@ class Settings extends PureComponent {
{showTeams &&
<SettingsItem
defaultMessage='Open teams you can join'
i18nId='mobile.select_team.join_open'
i18nId={t('mobile.select_team.join_open')}
iconName='list'
iconType='foundation'
onPress={this.goToSelectTeam}
@ -260,7 +261,7 @@ class Settings extends PureComponent {
{showHelp &&
<SettingsItem
defaultMessage='Help'
i18nId='mobile.help.title'
i18nId={t('mobile.help.title')}
iconName='md-help'
iconType='ion'
onPress={this.openHelp}
@ -270,7 +271,7 @@ class Settings extends PureComponent {
}
<SettingsItem
defaultMessage='Report a Problem'
i18nId='sidebar_right_menu.report'
i18nId={t('sidebar_right_menu.report')}
iconName='exclamation'
iconType='fontawesome'
onPress={this.openErrorEmail}
@ -279,7 +280,7 @@ class Settings extends PureComponent {
/>
<SettingsItem
defaultMessage='Advanced Settings'
i18nId='mobile.advanced_settings.title'
i18nId={t('mobile.advanced_settings.title')}
iconName='ios-hammer'
iconType='ion'
onPress={this.goToAdvancedSettings}
@ -289,7 +290,7 @@ class Settings extends PureComponent {
{LocalConfig.EnableMobileClientUpgrade && LocalConfig.EnableMobileClientUpgradeUserSetting &&
<SettingsItem
defaultMessage='Check for Upgrade'
i18nId='mobile.settings.modal.check_for_upgrade'
i18nId={t('mobile.settings.modal.check_for_upgrade')}
iconName='update'
iconType='material'
onPress={this.goToClientUpgrade}
@ -299,7 +300,7 @@ class Settings extends PureComponent {
}
<SettingsItem
defaultMessage='About Mattermost'
i18nId='about.title'
i18nId={t('about.title')}
iconName='ios-information-circle'
iconType='ion'
onPress={this.goToAbout}

View file

@ -20,6 +20,7 @@ import SettingsItem from 'app/screens/settings/settings_item';
import {getNotificationProps} from 'app/utils/notify_props';
import {preventDoubleTap} from 'app/utils/tap';
import {changeOpacity, makeStyleSheetFromTheme, setNavigatorStyles} from 'app/utils/theme';
import {t} from 'app/utils/i18n';
class NotificationSettings extends PureComponent {
static propTypes = {
@ -210,7 +211,7 @@ class NotificationSettings extends PureComponent {
autoResponder = (
<SettingsItem
defaultMessage='Automatic Direct Message Replies'
i18nId='mobile.notification_settings.ooo_auto_responder'
i18nId={t('mobile.notification_settings.ooo_auto_responder')}
iconName='beach-access'
iconType='material'
onPress={() => this.handlePress(this.goToNotificationSettingsAutoResponder)}
@ -231,7 +232,7 @@ class NotificationSettings extends PureComponent {
<View style={style.divider}/>
<SettingsItem
defaultMessage='Mentions and Replies'
i18nId='mobile.notification_settings.mentions_replies'
i18nId={t('mobile.notification_settings.mentions_replies')}
iconName='md-at'
iconType='ion'
onPress={() => this.handlePress(this.goToNotificationSettingsMentions)}
@ -241,7 +242,7 @@ class NotificationSettings extends PureComponent {
/>
<SettingsItem
defaultMessage='Mobile'
i18nId='mobile.notification_settings.mobile'
i18nId={t('mobile.notification_settings.mobile')}
iconName='md-phone-portrait'
iconType='ion'
onPress={() => this.handlePress(this.goToNotificationSettingsMobile)}
@ -251,7 +252,7 @@ class NotificationSettings extends PureComponent {
/>
<SettingsItem
defaultMessage='Email'
i18nId='mobile.notification_settings.email'
i18nId={t('mobile.notification_settings.email')}
iconName='ios-mail'
iconType='ion'
onPress={() => this.handlePress(this.goToNotificationSettingsEmail)}

View file

@ -15,6 +15,7 @@ import StatusBar from 'app/components/status_bar';
import TextInputWithLocalizedPlaceholder from 'app/components/text_input_with_localized_placeholder';
import {getNotificationProps} from 'app/utils/notify_props';
import {changeOpacity, makeStyleSheetFromTheme} from 'app/utils/theme';
import {t} from 'app/utils/i18n';
import Section from 'app/screens/settings/section';
import SectionItem from 'app/screens/settings/section_item';
@ -119,7 +120,7 @@ export default class NotificationSettingsAutoResponder extends PureComponent {
</Section>
{autoResponderActive === 'true' && (
<Section
headerId='mobile.notification_settings.auto_responder.message_title'
headerId={t('mobile.notification_settings.auto_responder.message_title')}
headerDefaultMessage='CUSTOM MESSAGE'
theme={theme}
>
@ -134,7 +135,7 @@ export default class NotificationSettingsAutoResponder extends PureComponent {
style={style.input}
autoCapitalize='none'
autoCorrect={false}
placeholder={{id: 'mobile.notification_settings.auto_responder.message_placeholder', defaultMessage: 'Message'}}
placeholder={{id: t('mobile.notification_settings.auto_responder.message_placeholder'), defaultMessage: 'Message'}}
placeholderTextColor={changeOpacity(theme.centerChannelColor, 0.4)}
textAlignVertical='top'
underlineColorAndroid='transparent'

View file

@ -13,6 +13,7 @@ import {
import {Preferences} from 'mattermost-redux/constants';
import {changeOpacity, makeStyleSheetFromTheme} from 'app/utils/theme';
import {t} from 'app/utils/i18n';
import FormattedText from 'app/components/formatted_text';
import RadioButtonGroup from 'app/components/radio_button';
@ -52,25 +53,25 @@ class NotificationSettingsEmailAndroid extends NotificationSettingsEmailBase {
if (sendEmailNotifications) {
switch (interval) {
case Preferences.INTERVAL_IMMEDIATE.toString():
i18nId = 'user.settings.notifications.email.immediately';
i18nId = t('user.settings.notifications.email.immediately');
i18nMessage = 'Immediately';
break;
case Preferences.INTERVAL_HOUR.toString():
i18nId = 'user.settings.notifications.email.everyHour';
i18nId = t('user.settings.notifications.email.everyHour');
i18nMessage = 'Every hour';
break;
case Preferences.INTERVAL_FIFTEEN_MINUTES.toString():
i18nId = 'mobile.user.settings.notifications.email.fifteenMinutes';
i18nId = t('mobile.user.settings.notifications.email.fifteenMinutes');
i18nMessage = 'Every 15 minutes';
break;
case Preferences.INTERVAL_NEVER.toString():
default:
i18nId = 'user.settings.notifications.email.never';
i18nId = t('user.settings.notifications.email.never');
i18nMessage = 'Never';
break;
}
} else {
i18nId = 'user.settings.notifications.email.disabled';
i18nId = t('user.settings.notifications.email.disabled');
i18nMessage = 'Email notifications are not enabled';
}

View file

@ -13,6 +13,7 @@ import {Preferences} from 'mattermost-redux/constants';
import FormattedText from 'app/components/formatted_text';
import StatusBar from 'app/components/status_bar';
import {changeOpacity, makeStyleSheetFromTheme} from 'app/utils/theme';
import {t} from 'app/utils/i18n';
import Section from 'app/screens/settings/section';
import SectionItem from 'app/screens/settings/section_item';
@ -32,9 +33,9 @@ class NotificationSettingsEmailIos extends NotificationSettingsEmailBase {
return (
<Section
headerId='mobile.notification_settings.email.send'
headerId={t('mobile.notification_settings.email.send')}
headerDefaultMessage='SEND EMAIL NOTIFICATIONS'
footerId='user.settings.notifications.emailInfo'
footerId={t('user.settings.notifications.emailInfo')}
footerDefaultMessage='Email notifications are sent for mentions and direct messages when you are offline or away from {siteName} for more than 5 minutes.'
footerValues={{siteName}}
disableFooter={!sendEmailNotifications}

View file

@ -17,6 +17,7 @@ import StatusBar from 'app/components/status_bar';
import TextInputWithLocalizedPlaceholder from 'app/components/text_input_with_localized_placeholder';
import SectionItem from 'app/screens/settings/section_item';
import {changeOpacity, makeStyleSheetFromTheme} from 'app/utils/theme';
import {t} from 'app/utils/i18n';
import NotificationSettingsMentionsBase from './notification_settings_mention_base';
@ -206,16 +207,16 @@ class NotificationSettingsMentionsAndroid extends NotificationSettingsMentionsBa
let i18nMessage;
switch (this.state.comments) {
case 'root':
i18nId = 'mobile.account_notifications.threads_start';
i18nId = t('mobile.account_notifications.threads_start');
i18nMessage = 'Threads that I start';
break;
case 'never':
i18nId = 'mobile.account_notifications.threads_mentions';
i18nId = t('mobile.account_notifications.threads_mentions');
i18nMessage = 'Mentions in threads';
break;
case 'any':
default:
i18nId = 'mobile.account_notifications.threads_start_participate';
i18nId = t('mobile.account_notifications.threads_start_participate');
i18nMessage = 'Threads that I start or participate in';
break;
}

View file

@ -14,6 +14,7 @@ import StatusBar from 'app/components/status_bar';
import Section from 'app/screens/settings/section';
import SectionItem from 'app/screens/settings/section_item';
import {changeOpacity, makeStyleSheetFromTheme} from 'app/utils/theme';
import {t} from 'app/utils/i18n';
import NotificationSettingsMentionsBase from './notification_settings_mention_base';
@ -57,7 +58,7 @@ class NotificationSettingsMentionsIos extends NotificationSettingsMentionsBase {
return (
<Section
headerId='mobile.notification_settings_mentions.wordsTrigger'
headerId={t('mobile.notification_settings_mentions.wordsTrigger')}
headerDefaultMessage='WORDS THAT TRIGGER MENTIONS'
theme={theme}
>
@ -140,7 +141,7 @@ class NotificationSettingsMentionsIos extends NotificationSettingsMentionsBase {
return (
<Section
headerId='mobile.account_notifications.reply.header'
headerId={t('mobile.account_notifications.reply.header')}
headerDefaultMessage='SEND REPLY NOTIFICATIONS FOR'
theme={theme}
>

View file

@ -11,6 +11,7 @@ import {
import FormattedText from 'app/components/formatted_text';
import StatusBar from 'app/components/status_bar';
import {changeOpacity, makeStyleSheetFromTheme} from 'app/utils/theme';
import {t} from 'app/utils/i18n';
import Section from 'app/screens/settings/section';
import SectionItem from 'app/screens/settings/section_item';
@ -24,7 +25,7 @@ class NotificationSettingsMobileIos extends NotificationSettingsMobileBase {
const pushNotificationsEnabled = config.SendPushNotifications === 'true';
return (
<Section
headerId='mobile.notification_settings_mobile.push_activity'
headerId={t('mobile.notification_settings_mobile.push_activity')}
headerDefaultMessage='SEND NOTIFICATIONS'
theme={theme}
>
@ -94,7 +95,7 @@ class NotificationSettingsMobileIos extends NotificationSettingsMobileBase {
return (
<Section
headerId='mobile.notification_settings_mobile.push_status'
headerId={t('mobile.notification_settings_mobile.push_status')}
headerDefaultMessage='TRIGGER PUSH NOTIFICATIONS WHEN'
theme={theme}
>

View file

@ -20,6 +20,7 @@ import FormattedTime from 'app/components/formatted_time';
import StatusBar from 'app/components/status_bar';
import {alertErrorWithFallback} from 'app/utils/general';
import {changeOpacity, makeStyleSheetFromTheme, setNavigatorStyles} from 'app/utils/theme';
import {t} from 'app/utils/i18n';
import UserProfileRow from './user_profile_row';
import Config from 'assets/config';
@ -141,7 +142,7 @@ export default class UserProfile extends PureComponent {
intl,
result.error,
{
id: 'mobile.open_dm.error',
id: t('mobile.open_dm.error'),
defaultMessage: "We couldn't open a direct message with {displayName}. Please check your connection and try again.",
},
{
@ -230,7 +231,7 @@ export default class UserProfile extends PureComponent {
defaultMessage='Send Message'
icon='paper-plane-o'
iconType='fontawesome'
textId='mobile.routes.user_profile.send_message'
textId={t('mobile.routes.user_profile.send_message')}
theme={theme}
/>
{this.renderAdditionalOptions()}

View file

@ -23,6 +23,8 @@ import {
import {app, store} from 'app/mattermost';
import {t} from 'app/utils/i18n';
const errorHandler = (e, isFatal) => {
if (__DEV__ && !e && !isFatal) {
// react-native-exception-handler redirects console.error to call this, and React calls
@ -46,10 +48,10 @@ const errorHandler = (e, isFatal) => {
const translations = app.getTranslations();
Alert.alert(
translations['mobile.error_handler.title'],
translations['mobile.error_handler.description'],
translations[t('mobile.error_handler.title')],
translations[t('mobile.error_handler.description')],
[{
text: translations['mobile.error_handler.button'],
text: translations[t('mobile.error_handler.button')],
onPress: () => {
// purge the store
dispatch(purgeOfflineStore());

6
app/utils/i18n.js Normal file
View file

@ -0,0 +1,6 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
export function t(v) {
return v;
}

View file

@ -1,8 +1,10 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {t} from 'app/utils/i18n';
export const loadingText = {
id: 'mobile.loading_members',
id: t('mobile.loading_members'),
defaultMessage: 'Loading Members...',
};

View file

@ -19,6 +19,7 @@ import {
} from 'app/actions/views/root';
import {ViewTypes} from 'app/constants';
import {DEFAULT_LOCALE, getLocalizedMessage} from 'app/i18n';
import {t} from 'app/utils/i18n';
import {
app,
store,
@ -142,7 +143,7 @@ export const onPushNotificationReply = async (data, text, badge, completed) => {
if (result.error) {
const locale = reduxCurrentUser ? reduxCurrentUser.locale : DEFAULT_LOCALE;
PushNotifications.localNotification({
message: getLocalizedMessage(locale, 'mobile.reply_post.failed'),
message: getLocalizedMessage(locale, t('mobile.reply_post.failed')),
userInfo: {
localNotification: true,
localTest: true,

View file

@ -5,9 +5,15 @@ import {
Alert,
} from 'react-native';
import {toTitleCase} from 'app/utils/general';
import {t} from 'app/utils/i18n';
export function confirmOutOfOfficeDisabled(intl, status, updateStatus) {
const userStatusId = 'modal.manual_status.auto_responder.message_' + status;
t('modal.manual_status.auto_responder.message_');
t('modal.manual_status.auto_responder.message_away');
t('modal.manual_status.auto_responder.message_dnd');
t('modal.manual_status.auto_responder.message_offline');
t('modal.manual_status.auto_responder.message_online');
let translatedStatus;
if (status === 'dnd') {

File diff suppressed because it is too large Load diff

View file

@ -149,6 +149,7 @@ module.exports = ['./node_modules/app/app.js',
'./node_modules/app/utils/network.js',
'./node_modules/app/utils/push_notifications.js',
'./node_modules/app/utils/sentry/middleware.js',
'./node_modules/app/utils/i18n.js',
'./node_modules/app/utils/theme.js',
'./node_modules/app/utils/time_tracker.js',
'./node_modules/index.js',