From c86c7beb2482ad7efa2256392072442ab4ee128e Mon Sep 17 00:00:00 2001 From: zbettenbuk Date: Thu, 15 Feb 2018 13:01:54 -0600 Subject: [PATCH] Refactor i18n calendar formatter --- react/features/base/{util => i18n}/dateUtil.js | 6 ++---- react/features/base/i18n/index.js | 2 +- react/features/base/util/index.js | 1 - .../components/ConferenceNotification.native.js | 3 +-- .../calendar-sync/components/MeetingList.native.js | 3 +-- .../features/recent-list/components/RecentList.native.js | 8 ++++---- 6 files changed, 9 insertions(+), 14 deletions(-) rename react/features/base/{util => i18n}/dateUtil.js (91%) diff --git a/react/features/base/util/dateUtil.js b/react/features/base/i18n/dateUtil.js similarity index 91% rename from react/features/base/util/dateUtil.js rename to react/features/base/i18n/dateUtil.js index 5b8a81703..376afa2a9 100644 --- a/react/features/base/util/dateUtil.js +++ b/react/features/base/i18n/dateUtil.js @@ -2,13 +2,11 @@ import moment from 'moment'; -import { i18next } from '../i18n'; +import i18next from './i18next'; // 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 // 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/de'); require('moment/locale/eo'); @@ -32,7 +30,7 @@ require('moment/locale/zh-cn'); /** * Returns a localized date formatter initialized with a specific {@code Date} - * or time stamp ({@code number}). + * or timestamp ({@code number}). * * @private * @param {Date | number} dateOrTimeStamp - The date or unix timestamp (ms) diff --git a/react/features/base/i18n/index.js b/react/features/base/i18n/index.js index e74374c7e..59657a34e 100644 --- a/react/features/base/i18n/index.js +++ b/react/features/base/i18n/index.js @@ -1,4 +1,4 @@ - +export * from './dateUtil'; export * from './functions'; // TODO Eventually (e.g. when the non-React Web app is rewritten into React), it diff --git a/react/features/base/util/index.js b/react/features/base/util/index.js index 18214a274..1a4ad8b91 100644 --- a/react/features/base/util/index.js +++ b/react/features/base/util/index.js @@ -1,4 +1,3 @@ -export * from './dateUtil'; export * from './helpers'; export * from './loadScript'; export * from './randomUtil'; diff --git a/react/features/calendar-sync/components/ConferenceNotification.native.js b/react/features/calendar-sync/components/ConferenceNotification.native.js index c3515d135..ef5ba6df6 100644 --- a/react/features/calendar-sync/components/ConferenceNotification.native.js +++ b/react/features/calendar-sync/components/ConferenceNotification.native.js @@ -9,10 +9,9 @@ import { connect } from 'react-redux'; import { appNavigate } from '../../app'; import { getURLWithoutParams } from '../../base/connection'; -import { translate } from '../../base/i18n'; +import { getLocalizedDateFormatter, translate } from '../../base/i18n'; import { Icon } from '../../base/font-icons'; import { ASPECT_RATIO_NARROW } from '../../base/responsive-ui'; -import { getLocalizedDateFormatter } from '../../base/util'; import styles from './styles'; diff --git a/react/features/calendar-sync/components/MeetingList.native.js b/react/features/calendar-sync/components/MeetingList.native.js index 79f7c580b..4875e194e 100644 --- a/react/features/calendar-sync/components/MeetingList.native.js +++ b/react/features/calendar-sync/components/MeetingList.native.js @@ -5,9 +5,8 @@ import { connect } from 'react-redux'; import { refreshCalendarEntryList } from '../actions'; import { appNavigate } from '../../app'; -import { translate } from '../../base/i18n'; +import { getLocalizedDateFormatter, translate } from '../../base/i18n'; import { NavigateSectionList } from '../../base/react'; -import { getLocalizedDateFormatter } from '../../base/util'; type Props = { diff --git a/react/features/recent-list/components/RecentList.native.js b/react/features/recent-list/components/RecentList.native.js index 19347c1f7..57a62f5f3 100644 --- a/react/features/recent-list/components/RecentList.native.js +++ b/react/features/recent-list/components/RecentList.native.js @@ -3,13 +3,13 @@ import React, { Component } from 'react'; import { connect } from 'react-redux'; import { appNavigate } from '../../app'; -import { translate } from '../../base/i18n'; -import { NavigateSectionList } from '../../base/react'; import { getLocalizedDateFormatter, getLocalizedDurationFormatter, - parseURIString -} from '../../base/util'; + translate +} from '../../base/i18n'; +import { NavigateSectionList } from '../../base/react'; +import { parseURIString } from '../../base/util'; /** * The type of the React {@code Component} props of {@link RecentList}