@@ -45,8 +45,6 @@ const PhoneInput = forwardRef(({
45
45
onlyCountries = [ ] ,
46
46
excludeCountries = [ ] ,
47
47
preferredCountries = [ ] ,
48
- searchNotFound = "No country found" ,
49
- searchPlaceholder = "Search country" ,
50
48
dropdownRender = ( node ) => node ,
51
49
onMount : handleMount = ( ) => null ,
52
50
onInput : handleInput = ( ) => null ,
@@ -55,6 +53,7 @@ const PhoneInput = forwardRef(({
55
53
...antInputProps
56
54
} : PhoneInputProps , forwardedRef : any ) => {
57
55
const formInstance = useFormInstance ( ) ;
56
+ const { locale = { } } = useContext ( ConfigContext ) ;
58
57
const formContext = useContext ( FormContext ) ;
59
58
const { getPrefixCls} = useContext ( ConfigContext ) ;
60
59
const inputRef = useRef < any > ( null ) ;
@@ -65,6 +64,12 @@ const PhoneInput = forwardRef(({
65
64
const [ minWidth , setMinWidth ] = useState < number > ( 0 ) ;
66
65
const [ countryCode , setCountryCode ] = useState < string > ( country ) ;
67
66
67
+ const {
68
+ searchNotFound = "No country found" ,
69
+ searchPlaceholder = "Search country" ,
70
+ countries = new Proxy ( { } , ( { get : ( _ : any , prop : any ) => prop } ) ) ,
71
+ } = ( locale as any ) . PhoneInput || { } ;
72
+
68
73
const prefixCls = getPrefixCls ( ) ;
69
74
injectMergedStyles ( prefixCls ) ;
70
75
@@ -222,13 +227,13 @@ const PhoneInput = forwardRef(({
222
227
label = { < div className = { `flag ${ iso } ` } /> }
223
228
children = { < div className = { `${ prefixCls } -phone-input-select-item` } >
224
229
< div className = { `flag ${ iso } ` } />
225
- { name } { displayFormat ( mask ) }
230
+ { countries [ name ] } { displayFormat ( mask ) }
226
231
</ div > }
227
232
/>
228
233
)
229
234
} ) }
230
235
</ Select >
231
- ) , [ selectValue , query , disabled , disableParentheses , disableDropdown , onDropdownVisibleChange , minWidth , searchNotFound , countriesList , setFieldValue , setValue , prefixCls , enableSearch , searchPlaceholder ] )
236
+ ) , [ selectValue , query , disabled , disableParentheses , disableDropdown , onDropdownVisibleChange , minWidth , searchNotFound , countries , countriesList , setFieldValue , setValue , prefixCls , enableSearch , searchPlaceholder ] )
232
237
233
238
return (
234
239
< div className = { `${ prefixCls } -phone-input-wrapper` }
0 commit comments