Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i18n: Month names are not translated in Deutsch - Closes #929 #942

Merged
merged 1 commit into from
Aug 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/components/shared/formattedDate/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import { Text } from 'react-native';
import moment from 'moment';
import 'moment/min/locales';

/**
* Converts the timestamp to moment prettified time and wraps the value in a component
Expand All @@ -17,10 +18,13 @@ const FormattedDate = ({
children,
style,
type,
locale,
format = 'MMM D, YYYY',
}) => {
const Element = type || Text;

moment.locale(locale);

return (
<Element style={style}>
{moment(children).format(format)}
Expand Down
8 changes: 6 additions & 2 deletions src/components/shared/transactions/item.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import { View, TouchableOpacity } from 'react-native';
import LottieView from 'lottie-react-native';
import { translate } from 'react-i18next';
import connect from 'redux-connect-decorator';
import { fromRawLsk } from '../../../utilities/conversions';
import FormattedNumber from '../formattedNumber';
import Symbol from './symbol';
Expand All @@ -16,6 +17,9 @@ import getStyles from './styles';

const txTypes = ['accountInitialization', 'setSecondPassphrase', 'registerDelegate', 'vote'];

@connect(state => ({
language: state.settings.language
}))
class Item extends React.Component {
componentDidMount() {
if (typeof this.props.tx.timestamp !== 'number') {
Expand Down Expand Up @@ -47,7 +51,7 @@ class Item extends React.Component {
render() {
const {
styles, theme, tx, t, activeToken,
account, followedAccounts, incognito,
account, followedAccounts, incognito, language,
} = this.props;

let direction = 'incoming';
Expand Down Expand Up @@ -97,7 +101,7 @@ class Item extends React.Component {
<Small style={[styles.date, styles.theme.date]}>
{t('Pending confirmation')}
</Small> :
<FormattedDate type={Small} style={[styles.date, styles.theme.date]}>
<FormattedDate locale={language} type={Small} style={[styles.date, styles.theme.date]}>
{tx.timestamp}
</FormattedDate>
}
Expand Down