Refactor i18n calendar formatter

This commit is contained in:
zbettenbuk 2018-02-15 13:01:54 -06:00 committed by Lyubo Marinov
parent 1020a54a33
commit c86c7beb24
6 changed files with 9 additions and 14 deletions

View File

@ -2,13 +2,11 @@
import moment from 'moment'; import moment from 'moment';
import { i18next } from '../i18n'; import i18next from './i18next';
// MomentJS uses static language bundle loading, so in order to support dynamic // MomentJS uses static language bundle loading, so in order to support dynamic
// language selection in the app we need to load all bundles that we support in // language selection in the app we need to load all bundles that we support in
// the app. // the app.
// FIXME: If we decide to support MomentJS in other features as well we may need
// to move this import and the lenient matcher to the i18n feature.
require('moment/locale/bg'); require('moment/locale/bg');
require('moment/locale/de'); require('moment/locale/de');
require('moment/locale/eo'); require('moment/locale/eo');
@ -32,7 +30,7 @@ require('moment/locale/zh-cn');
/** /**
* Returns a localized date formatter initialized with a specific {@code Date} * Returns a localized date formatter initialized with a specific {@code Date}
* or time stamp ({@code number}). * or timestamp ({@code number}).
* *
* @private * @private
* @param {Date | number} dateOrTimeStamp - The date or unix timestamp (ms) * @param {Date | number} dateOrTimeStamp - The date or unix timestamp (ms)

View File

@ -1,4 +1,4 @@
export * from './dateUtil';
export * from './functions'; export * from './functions';
// TODO Eventually (e.g. when the non-React Web app is rewritten into React), it // TODO Eventually (e.g. when the non-React Web app is rewritten into React), it

View File

@ -1,4 +1,3 @@
export * from './dateUtil';
export * from './helpers'; export * from './helpers';
export * from './loadScript'; export * from './loadScript';
export * from './randomUtil'; export * from './randomUtil';

View File

@ -9,10 +9,9 @@ import { connect } from 'react-redux';
import { appNavigate } from '../../app'; import { appNavigate } from '../../app';
import { getURLWithoutParams } from '../../base/connection'; import { getURLWithoutParams } from '../../base/connection';
import { translate } from '../../base/i18n'; import { getLocalizedDateFormatter, translate } from '../../base/i18n';
import { Icon } from '../../base/font-icons'; import { Icon } from '../../base/font-icons';
import { ASPECT_RATIO_NARROW } from '../../base/responsive-ui'; import { ASPECT_RATIO_NARROW } from '../../base/responsive-ui';
import { getLocalizedDateFormatter } from '../../base/util';
import styles from './styles'; import styles from './styles';

View File

@ -5,9 +5,8 @@ import { connect } from 'react-redux';
import { refreshCalendarEntryList } from '../actions'; import { refreshCalendarEntryList } from '../actions';
import { appNavigate } from '../../app'; import { appNavigate } from '../../app';
import { translate } from '../../base/i18n'; import { getLocalizedDateFormatter, translate } from '../../base/i18n';
import { NavigateSectionList } from '../../base/react'; import { NavigateSectionList } from '../../base/react';
import { getLocalizedDateFormatter } from '../../base/util';
type Props = { type Props = {

View File

@ -3,13 +3,13 @@ import React, { Component } from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { appNavigate } from '../../app'; import { appNavigate } from '../../app';
import { translate } from '../../base/i18n';
import { NavigateSectionList } from '../../base/react';
import { import {
getLocalizedDateFormatter, getLocalizedDateFormatter,
getLocalizedDurationFormatter, getLocalizedDurationFormatter,
parseURIString translate
} from '../../base/util'; } from '../../base/i18n';
import { NavigateSectionList } from '../../base/react';
import { parseURIString } from '../../base/util';
/** /**
* The type of the React {@code Component} props of {@link RecentList} * The type of the React {@code Component} props of {@link RecentList}