Adding german localization

This commit is contained in:
Eugen Rochko 2016-11-18 15:36:16 +01:00
parent c1be1ac7c6
commit 85d1b74ac3
26 changed files with 488 additions and 51 deletions

View file

@ -8,7 +8,12 @@ import Autosuggest from 'react-autosuggest';
import AutosuggestAccountContainer from '../../compose/containers/autosuggest_account_container';
import { debounce } from 'react-decoration';
import UploadButtonContainer from '../containers/upload_button_container';
import { injectIntl } from 'react-intl';
import { defineMessages, injectIntl } from 'react-intl';
const messages = defineMessages({
placeholder: { id: 'compose_form.placeholder', defaultMessage: 'What is on your mind?' },
publish: { id: 'compose_form.publish', defaultMessage: 'Publish' }
});
const getTokenForSuggestions = (str, caretPosition) => {
let word;
@ -53,7 +58,7 @@ const textareaStyle = {
};
const renderInputComponent = inputProps => (
<textarea {...inputProps} placeholder='What is on your mind?' className='compose-form__textarea' style={textareaStyle} />
<textarea {...inputProps} className='compose-form__textarea' style={textareaStyle} />
);
const ComposeForm = React.createClass({
@ -144,7 +149,7 @@ const ComposeForm = React.createClass({
}
const inputProps = {
placeholder: intl.formatMessage({ id: 'compose_form.placeholder', defaultMessage: 'What is on your mind?' }),
placeholder: intl.formatMessage(messages.placeholder),
value: this.props.text,
onKeyUp: this.handleKeyUp,
onChange: this.handleChange,
@ -169,7 +174,7 @@ const ComposeForm = React.createClass({
/>
<div style={{ marginTop: '10px', overflow: 'hidden' }}>
<div style={{ float: 'right' }}><Button text={intl.formatMessage({ id: 'compose_form.publish', defaultMessage: 'Publish' })} onClick={this.handleSubmit} disabled={disabled} /></div>
<div style={{ float: 'right' }}><Button text={intl.formatMessage(messages.publish)} onClick={this.handleSubmit} disabled={disabled} /></div>
<div style={{ float: 'right', marginRight: '16px', lineHeight: '36px' }}><CharacterCounter max={500} text={this.props.text} /></div>
<UploadButtonContainer style={{ paddingTop: '4px' }} />
</div>

View file

@ -4,7 +4,11 @@ import Avatar from '../../../components/avatar';
import IconButton from '../../../components/icon_button';
import DisplayName from '../../../components/display_name';
import emojify from '../../../emoji';
import { injectIntl } from 'react-intl';
import { defineMessages, injectIntl } from 'react-intl';
const messages = defineMessages({
cancel: { id: 'reply_indicator.cancel', defaultMessage: 'Cancel' }
});
const ReplyIndicator = React.createClass({
@ -37,7 +41,7 @@ const ReplyIndicator = React.createClass({
return (
<div style={{ background: '#9baec8', padding: '10px' }}>
<div style={{ overflow: 'hidden', marginBottom: '5px' }}>
<div style={{ float: 'right', lineHeight: '24px' }}><IconButton title={intl.formatMessage({ id: 'reply_indicator.cancel', defaultMessage: 'Cancel' })} icon='times' onClick={this.handleClick} /></div>
<div style={{ float: 'right', lineHeight: '24px' }}><IconButton title={intl.formatMessage(messages.cancel)} icon='times' onClick={this.handleClick} /></div>
<a href={this.props.status.getIn(['account', 'url'])} onClick={this.handleAccountClick} className='reply-indicator__display-name' style={{ display: 'block', maxWidth: '100%', paddingRight: '25px', color: '#282c37', textDecoration: 'none', overflow: 'hidden', lineHeight: '24px' }}>
<div style={{ float: 'left', marginRight: '5px' }}><Avatar size={24} src={this.props.status.getIn(['account', 'avatar'])} /></div>

View file

@ -3,7 +3,11 @@ import ImmutablePropTypes from 'react-immutable-proptypes';
import Autosuggest from 'react-autosuggest';
import AutosuggestAccountContainer from '../containers/autosuggest_account_container';
import { debounce } from 'react-decoration';
import { injectIntl } from 'react-intl';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
const messages = defineMessages({
placeholder: { id: 'search.placeholder', defaultMessage: 'Search' }
});
const getSuggestionValue = suggestion => suggestion.value;
@ -16,7 +20,7 @@ const renderSuggestion = suggestion => {
};
const renderSectionTitle = section => (
<strong>{section.title}</strong>
<strong><FormattedMessage id={`search.${section.title}`} defaultMessage={section.title} /></strong>
);
const getSectionSuggestions = section => section.items;
@ -95,7 +99,7 @@ const Search = React.createClass({
render () {
const inputProps = {
placeholder: this.props.intl.formatMessage({ id: 'search.placeholder', defaultMessage: 'Search' }),
placeholder: this.props.intl.formatMessage(messages.placeholder),
value: this.props.value,
onChange: this.onChange,
style: inputStyle

View file

@ -1,6 +1,10 @@
import PureRenderMixin from 'react-addons-pure-render-mixin';
import IconButton from '../../../components/icon_button';
import { injectIntl } from 'react-intl';
import { defineMessages, injectIntl } from 'react-intl';
const messages = defineMessages({
upload: { id: 'upload_button.label', defaultMessage: 'Add media' }
});
const UploadButton = React.createClass({
@ -31,7 +35,7 @@ const UploadButton = React.createClass({
return (
<div style={this.props.style}>
<IconButton icon='photo' title={intl.formatMessage({ id: 'upload_button.label', defaultMessage: 'Add media' })} disabled={this.props.disabled} onClick={this.handleClick} size={24} />
<IconButton icon='photo' title={intl.formatMessage(messages.upload)} disabled={this.props.disabled} onClick={this.handleClick} size={24} />
<input ref={this.setRef} type='file' multiple={false} onChange={this.handleChange} disabled={this.props.disabled} style={{ display: 'none' }} />
</div>
);

View file

@ -1,7 +1,11 @@
import PureRenderMixin from 'react-addons-pure-render-mixin';
import ImmutablePropTypes from 'react-immutable-proptypes';
import IconButton from '../../../components/icon_button';
import { injectIntl } from 'react-intl';
import { defineMessages, injectIntl } from 'react-intl';
const messages = defineMessages({
undo: { id: 'upload_form.undo', defaultMessage: 'Undo' }
});
const UploadForm = React.createClass({
@ -19,7 +23,7 @@ const UploadForm = React.createClass({
const uploads = this.props.media.map(attachment => (
<div key={attachment.get('id')} style={{ borderRadius: '4px', marginBottom: '10px' }} className='transparent-background'>
<div style={{ width: '100%', height: '100px', borderRadius: '4px', background: `url(${attachment.get('preview_url')}) no-repeat center`, backgroundSize: 'cover' }}>
<IconButton icon='times' title={intl.formatMessage({ id: 'upload_form.undo', defaultMessage: 'Undo' })} size={36} onClick={this.props.onRemoveFile.bind(this, attachment.get('id'))} />
<IconButton icon='times' title={intl.formatMessage(messages.undo)} size={36} onClick={this.props.onRemoveFile.bind(this, attachment.get('id'))} />
</div>
</div>
));