Lazy set moment locale #8785
Merged
Lazy set moment locale #8785
Conversation
components/locale-provider/ar_EG.tsx
Outdated
uploadError: 'مشكلة فى الرفع', | ||
previewFile: 'استعرض الملف', | ||
}, | ||
}; |
afc163
Dec 29, 2017
Member
这个 diff 看着慌。
这个 diff 看着慌。
yesmeck
Dec 29, 2017
Author
Member
好像是原来的缩进有问题。
好像是原来的缩进有问题。
components/locale-provider/index.tsx
Outdated
this.componentDidUpdate(); | ||
} | ||
|
||
componentWillReceiveProps() { | ||
this.setMomentLocale(); |
afc163
Dec 29, 2017
Member
不用比较一下?
不用比较一下?
原来的测试没测到这部分。 |
Codecov Report
@@ 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
Continue to review full report at Codecov.
|
components/locale-provider/fr_FR.tsx
Outdated
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'); }, |
afc163
Jan 1, 2018
Member
这两个字符串如果都是一样的话,setMomentLocale 可以在 LocaleProvider 里写。
这两个字符串如果都是一样的话,setMomentLocale 可以在 LocaleProvider 里写。
yesmeck
Jan 1, 2018
Author
Member
话说上面那个 locale
的作用是啥?
话说上面那个 locale
的作用是啥?
benjycui
Jan 2, 2018
Contributor
用于时间组件,如 DatePicker 内,强行设置 moment.locale
,以应对 value 里面的 locale 与 LocaleProvider 的 locale 不一致的情况。
用于时间组件,如 DatePicker 内,强行设置 moment.locale
,以应对 value 里面的 locale 与 LocaleProvider 的 locale 不一致的情况。
yesmeck
Jan 4, 2018
Author
Member
奥,那这个 localeCode
就是 moment 的 locale 表示。
奥,那这个 localeCode
就是 moment 的 locale 表示。
e1ef97c
to
00c2ca5
componentDidUpdate() { | ||
const { locale } = this.props; | ||
changeConfirmLocale(locale && locale.Modal); | ||
} | ||
|
||
componentWillUnMount() { | ||
componentWillUnmount() { |
yesmeck
Jan 4, 2018
Author
Member
原来写错了
原来写错了
7511474
to
3d69f4e
7f5922b
into
master
5 checks passed
5 checks passed
codecov/project
Absolute coverage decreased by -0.01% but relative coverage increased by +14.67% compared to 8de2b47
Details
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Fix #8662 #8816