-
-
Notifications
You must be signed in to change notification settings - Fork 50.4k
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
Lazy set moment locale #8785
Conversation
components/locale-provider/ar_EG.tsx
Outdated
uploadError: 'مشكلة فى الرفع', | ||
previewFile: 'استعرض الملف', | ||
}, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个 diff 看着慌。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好像是原来的缩进有问题。
components/locale-provider/index.tsx
Outdated
this.componentDidUpdate(); | ||
} | ||
|
||
componentWillReceiveProps() { | ||
this.setMomentLocale(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不用比较一下?
941a20d
to
422d79c
Compare
原来的测试没测到这部分。 |
422d79c
to
1dec931
Compare
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'); }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这两个字符串如果都是一样的话,setMomentLocale 可以在 LocaleProvider 里写。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
话说上面那个 locale
的作用是啥?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const localeCode = antLocale && antLocale.locale; |
用于时间组件,如 DatePicker 内,强行设置 moment.locale
,以应对 value 里面的 locale 与 LocaleProvider 的 locale 不一致的情况。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
奥,那这个 localeCode
就是 moment 的 locale 表示。
e1ef97c
to
00c2ca5
Compare
componentDidUpdate() { | ||
const { locale } = this.props; | ||
changeConfirmLocale(locale && locale.Modal); | ||
} | ||
|
||
componentWillUnMount() { | ||
componentWillUnmount() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
原来写错了
7511474
to
3d69f4e
Compare
3d69f4e
to
bdf6016
Compare
bdf6016
to
303a9e8
Compare
Fix #8662 #8816