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

Lazy set moment locale #8785

Merged
merged 1 commit into from Jan 13, 2018
Merged

Lazy set moment locale #8785

merged 1 commit into from Jan 13, 2018

Conversation

@yesmeck
Copy link
Member

@yesmeck yesmeck commented Dec 29, 2017

Fix #8662 #8816

@yesmeck yesmeck requested review from afc163, benjycui and yutingzhao1991 Dec 29, 2017
components/locale-provider/ar_EG.tsx Outdated
uploadError: 'مشكلة فى الرفع',
previewFile: 'استعرض الملف',
},
};

This comment has been minimized.

@afc163

afc163 Dec 29, 2017
Member

这个 diff 看着慌。

This comment has been minimized.

@yesmeck

yesmeck Dec 29, 2017
Author Member

好像是原来的缩进有问题。

components/locale-provider/index.tsx Outdated
this.componentDidUpdate();
}

componentWillReceiveProps() {
this.setMomentLocale();

This comment has been minimized.

@afc163

afc163 Dec 29, 2017
Member

不用比较一下?

@yesmeck yesmeck force-pushed the lazy-set-moment-locale branch 6 times, most recently Dec 29, 2017
@yesmeck
Copy link
Member Author

@yesmeck yesmeck commented Dec 29, 2017

b439ca7

原来的测试没测到这部分。

@yesmeck yesmeck force-pushed the lazy-set-moment-locale branch to 1dec931 Dec 29, 2017
@codecov
Copy link

@codecov codecov bot commented Dec 29, 2017

Codecov Report

Merging #8785 into master will decrease coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #8785      +/-   ##
=========================================
- Coverage   85.32%   85.3%   -0.02%     
=========================================
  Files         227     194      -33     
  Lines        4696    4683      -13     
  Branches     1376    1384       +8     
=========================================
- Hits         4007    3995      -12     
+ Misses        689     688       -1
Impacted Files Coverage Δ
components/locale-provider/index.tsx 91.3% <100%> (+6.68%) ⬆️
components/dropdown/dropdown.tsx 100% <0%> (ø) ⬆️
components/date-picker/createPicker.tsx 92.59% <0%> (+1.85%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8de2b47...303a9e8. Read the comment docs.

import Pagination from 'rc-pagination/lib/locale/fr_FR';
import DatePicker from '../date-picker/locale/fr_FR';
import TimePicker from '../time-picker/locale/fr_FR';
import Calendar from '../calendar/locale/fr_FR';

export default {
locale: 'fr',
setMomentLocale() { moment.locale('fr'); },

This comment has been minimized.

@afc163

afc163 Jan 1, 2018
Member

这两个字符串如果都是一样的话,setMomentLocale 可以在 LocaleProvider 里写。

This comment has been minimized.

@yesmeck

yesmeck Jan 1, 2018
Author Member

话说上面那个 locale 的作用是啥?

This comment has been minimized.

@benjycui

benjycui Jan 2, 2018
Contributor

const localeCode = antLocale && antLocale.locale;

用于时间组件,如 DatePicker 内,强行设置 moment.locale,以应对 value 里面的 locale 与 LocaleProvider 的 locale 不一致的情况。

This comment has been minimized.

@yesmeck

yesmeck Jan 4, 2018
Author Member

奥,那这个 localeCode 就是 moment 的 locale 表示。

@yesmeck yesmeck force-pushed the lazy-set-moment-locale branch 2 times, most recently from e1ef97c to 00c2ca5 Jan 4, 2018
componentDidUpdate() {
const { locale } = this.props;
changeConfirmLocale(locale && locale.Modal);
}

componentWillUnMount() {
componentWillUnmount() {

This comment has been minimized.

@yesmeck

yesmeck Jan 4, 2018
Author Member

原来写错了

@yesmeck yesmeck force-pushed the lazy-set-moment-locale branch 2 times, most recently from 7511474 to 3d69f4e Jan 4, 2018
@yesmeck yesmeck force-pushed the lazy-set-moment-locale branch from 3d69f4e Jan 13, 2018
@yesmeck yesmeck force-pushed the lazy-set-moment-locale branch to 303a9e8 Jan 13, 2018
@afc163
afc163 approved these changes Jan 13, 2018
@yesmeck yesmeck merged commit 7f5922b into master Jan 13, 2018
5 checks passed
5 checks passed
codecov/patch 100% of diff hit (target 85.32%)
Details
codecov/project Absolute coverage decreased by -0.01% but relative coverage increased by +14.67% compared to 8de2b47
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
security/snyk No new issues
Details
@yesmeck yesmeck deleted the lazy-set-moment-locale branch Jan 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants