From 85d1b74ac3bbd563c35a7212069b84f8d3a6bd99 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Fri, 18 Nov 2016 15:36:16 +0100 Subject: [PATCH] Adding german localization --- .../components/status_action_bar.jsx | 20 +++- .../components/components/video_player.jsx | 8 +- .../components/containers/mastodon.jsx | 6 +- .../account/components/action_bar.jsx | 26 ++-- .../features/account/components/header.jsx | 3 +- .../compose/components/compose_form.jsx | 13 +- .../compose/components/reply_indicator.jsx | 8 +- .../features/compose/components/search.jsx | 10 +- .../compose/components/upload_button.jsx | 8 +- .../compose/components/upload_form.jsx | 8 +- .../features/followers/components/account.jsx | 8 +- .../features/home_timeline/index.jsx | 8 +- .../features/mentions_timeline/index.jsx | 8 +- .../features/public_timeline/index.jsx | 8 +- .../features/status/components/action_bar.jsx | 20 +++- .../javascripts/components/locales/de.jsx | 48 ++++++++ .../javascripts/components/locales/en.jsx | 49 ++++++++ .../javascripts/components/locales/index.jsx | 11 ++ .../components/reducers/search.jsx | 4 +- config/application.rb | 2 +- config/locales/de.yml | 59 +++++++++ config/locales/devise.de.yml | 61 ++++++++++ config/locales/doorkeeper.de.yml | 112 ++++++++++++++++++ config/locales/en.yml | 2 + config/locales/simple_form.de.yml | 27 +++++ config/locales/simple_form.en.yml | 2 - 26 files changed, 488 insertions(+), 51 deletions(-) create mode 100644 app/assets/javascripts/components/locales/de.jsx create mode 100644 app/assets/javascripts/components/locales/en.jsx create mode 100644 app/assets/javascripts/components/locales/index.jsx create mode 100644 config/locales/de.yml create mode 100644 config/locales/devise.de.yml create mode 100644 config/locales/doorkeeper.de.yml create mode 100644 config/locales/simple_form.de.yml diff --git a/app/assets/javascripts/components/components/status_action_bar.jsx b/app/assets/javascripts/components/components/status_action_bar.jsx index 8883d08068..051b898bd5 100644 --- a/app/assets/javascripts/components/components/status_action_bar.jsx +++ b/app/assets/javascripts/components/components/status_action_bar.jsx @@ -2,7 +2,15 @@ import ImmutablePropTypes from 'react-immutable-proptypes'; import PureRenderMixin from 'react-addons-pure-render-mixin'; import IconButton from './icon_button'; import DropdownMenu from './dropdown_menu'; -import { injectIntl } from 'react-intl'; +import { defineMessages, injectIntl } from 'react-intl'; + +const messages = defineMessages({ + delete: { id: 'status.delete', defaultMessage: 'Delete' }, + mention: { id: 'status.mention', defaultMessage: 'Mention' }, + reply: { id: 'status.reply', defaultMessage: 'Reply' }, + reblog: { id: 'status.reblog', defaultMessage: 'Reblog' }, + favourite: { id: 'status.favourite', defaultMessage: 'Favourite' } +}); const StatusActionBar = React.createClass({ propTypes: { @@ -41,16 +49,16 @@ const StatusActionBar = React.createClass({ let menu = []; if (status.getIn(['account', 'id']) === me) { - menu.push({ text: intl.formatMessage({ id: 'status.delete', defaultMessage: 'Delete' }), action: this.handleDeleteClick }); + menu.push({ text: intl.formatMessage(messages.delete), action: this.handleDeleteClick }); } else { - menu.push({ text: intl.formatMessage({ id: 'status.mention', defaultMessage: 'Mention' }), action: this.handleMentionClick }); + menu.push({ text: intl.formatMessage(messages.mention), action: this.handleMentionClick }); } return (
-
-
-
+
+
+
diff --git a/app/assets/javascripts/components/components/video_player.jsx b/app/assets/javascripts/components/components/video_player.jsx index 2c236b996b..9b9b0a2e4f 100644 --- a/app/assets/javascripts/components/components/video_player.jsx +++ b/app/assets/javascripts/components/components/video_player.jsx @@ -1,7 +1,11 @@ import ImmutablePropTypes from 'react-immutable-proptypes'; import PureRenderMixin from 'react-addons-pure-render-mixin'; import IconButton from './icon_button'; -import { injectIntl } from 'react-intl'; +import { defineMessages, injectIntl } from 'react-intl'; + +const messages = defineMessages({ + toggle_sound: { id: 'video_player.toggle_sound', defaultMessage: 'Toggle sound' } +}); const videoStyle = { position: 'relative', @@ -64,7 +68,7 @@ const VideoPlayer = React.createClass({ return (
-
+
); diff --git a/app/assets/javascripts/components/containers/mastodon.jsx b/app/assets/javascripts/components/containers/mastodon.jsx index a12b197468..e61107cd1a 100644 --- a/app/assets/javascripts/components/containers/mastodon.jsx +++ b/app/assets/javascripts/components/containers/mastodon.jsx @@ -34,6 +34,8 @@ import Favourites from '../features/favourites'; import HashtagTimeline from '../features/hashtag_timeline'; import { IntlProvider, addLocaleData } from 'react-intl'; import en from 'react-intl/locale-data/en'; +import de from 'react-intl/locale-data/de'; +import getMessagesForLocale from '../locales'; const store = configureStore(); @@ -41,7 +43,7 @@ const browserHistory = useRouterHistory(createBrowserHistory)({ basename: '/web' }); -addLocaleData([...en]); +addLocaleData([...en, ...de]); const Mastodon = React.createClass({ @@ -89,7 +91,7 @@ const Mastodon = React.createClass({ const { locale } = this.props; return ( - + diff --git a/app/assets/javascripts/components/features/account/components/action_bar.jsx b/app/assets/javascripts/components/features/account/components/action_bar.jsx index f8d0514397..cd01de2e20 100644 --- a/app/assets/javascripts/components/features/account/components/action_bar.jsx +++ b/app/assets/javascripts/components/features/account/components/action_bar.jsx @@ -2,7 +2,17 @@ import PureRenderMixin from 'react-addons-pure-render-mixin'; import ImmutablePropTypes from 'react-immutable-proptypes'; import DropdownMenu from '../../../components/dropdown_menu'; import { Link } from 'react-router'; -import { injectIntl, FormattedMessage, FormattedNumber } from 'react-intl'; +import { defineMessages, injectIntl, FormattedMessage, FormattedNumber } from 'react-intl'; + +const messages = defineMessages({ + mention: { id: 'account.mention', defaultMessage: 'Mention' }, + edit_profile: { id: 'account.edit_profile', defaultMessage: 'Edit profile' }, + unblock: { id: 'account.unblock', defaultMessage: 'Unblock' }, + unfollow: { id: 'account.unfollow', defaultMessage: 'Unfollow' }, + block: { id: 'account.block', defaultMessage: 'Block' }, + follow: { id: 'account.follow', defaultMessage: 'Follow' }, + block: { id: 'account.block', defaultMessage: 'Block' } +}); const outerStyle = { borderTop: '1px solid #363c4b', @@ -41,18 +51,18 @@ const ActionBar = React.createClass({ let menu = []; - menu.push({ text: intl.formatMessage({ id: 'account.mention', defaultMessage: 'Mention' }), action: this.props.onMention }); + menu.push({ text: intl.formatMessage(messages.mention), action: this.props.onMention }); if (account.get('id') === me) { - menu.push({ text: intl.formatMessage({ id: 'account.edit_profile', defaultMessage: 'Edit profile' }), href: '/settings/profile' }); + menu.push({ text: intl.formatMessage(messages.edit_profile), href: '/settings/profile' }); } else if (account.getIn(['relationship', 'blocking'])) { - menu.push({ text: intl.formatMessage({ id: 'account.unblock', defaultMessage: 'Unblock' }), action: this.props.onBlock }); + menu.push({ text: intl.formatMessage(messages.unblock), action: this.props.onBlock }); } else if (account.getIn(['relationship', 'following'])) { - menu.push({ text: intl.formatMessage({ id: 'account.unfollow', defaultMessage: 'Unfollow' }), action: this.props.onFollow }); - menu.push({ text: intl.formatMessage({ id: 'account.block', defaultMessage: 'Block' }), action: this.props.onBlock }); + menu.push({ text: intl.formatMessage(messages.unfollow), action: this.props.onFollow }); + menu.push({ text: intl.formatMessage(messages.block), action: this.props.onBlock }); } else { - menu.push({ text: intl.formatMessage({ id: 'account.follow', defaultMessage: 'Follow' }), action: this.props.onFollow }); - menu.push({ text: intl.formatMessage({ id: 'account.block', defaultMessage: 'Block' }), action: this.props.onBlock }); + menu.push({ text: intl.formatMessage(messages.follow), action: this.props.onFollow }); + menu.push({ text: intl.formatMessage(messages.block), action: this.props.onBlock }); } return ( diff --git a/app/assets/javascripts/components/features/account/components/header.jsx b/app/assets/javascripts/components/features/account/components/header.jsx index 7a086c99a3..b3e9e2a9f7 100644 --- a/app/assets/javascripts/components/features/account/components/header.jsx +++ b/app/assets/javascripts/components/features/account/components/header.jsx @@ -2,6 +2,7 @@ import PureRenderMixin from 'react-addons-pure-render-mixin'; import ImmutablePropTypes from 'react-immutable-proptypes'; import emojify from '../../../emoji'; import escapeTextContentForBrowser from 'react/lib/escapeTextContentForBrowser'; +import { FormattedMessage } from 'react-intl'; const Header = React.createClass({ @@ -23,7 +24,7 @@ const Header = React.createClass({ } if (me !== account.get('id') && account.getIn(['relationship', 'followed_by'])) { - info = Follows you + info = } const content = { __html: emojify(account.get('note')) }; diff --git a/app/assets/javascripts/components/features/compose/components/compose_form.jsx b/app/assets/javascripts/components/features/compose/components/compose_form.jsx index 5aa041f09a..32bdeaeca4 100644 --- a/app/assets/javascripts/components/features/compose/components/compose_form.jsx +++ b/app/assets/javascripts/components/features/compose/components/compose_form.jsx @@ -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 => ( -