Skip to content

Commit 013f617

Browse files
authored
fix(select-inputs): localize placeholder (#802)
* feat(select-inputs): add placeholder * chore: undo message changes * chore: add translations
1 parent 670fc46 commit 013f617

File tree

14 files changed

+66
-6
lines changed

14 files changed

+66
-6
lines changed

i18n/data/core.json

+4
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22
"UIKit.AsyncCreatableSelectInput.createLabel": "Create \"{inputValue}\"",
33
"UIKit.AsyncCreatableSelectInput.noOptionsMessageWithInputValue": "No options",
44
"UIKit.AsyncCreatableSelectInput.noOptionsMessageWithoutInputValue": "No options",
5+
"UIKit.AsyncCreatableSelectInput.placeholder": "Select...",
56
"UIKit.AsyncSelectInput.noOptionsMessageWithInputValue": "No options",
67
"UIKit.AsyncSelectInput.noOptionsMessageWithoutInputValue": "No options",
8+
"UIKit.AsyncSelectInput.placeholder": "Select...",
79
"UIKit.CreatableSelectInput.createLabel": "Create \"{inputValue}\"",
810
"UIKit.CreatableSelectInput.noOptionsMessageWithInputValue": "No options",
911
"UIKit.CreatableSelectInput.noOptionsMessageWithoutInputValue": "No options",
12+
"UIKit.CreatableSelectInput.placeholder": "Select...",
1013
"UIKit.DateInput.placeholder": "MM/DD/YYYY",
1114
"UIKit.DateRangeInput.placeholder": "MM/DD/YYYY - MM/DD/YYYY",
1215
"UIKit.DateTimeInput.placeholder": "MM/DD/YYYY - HH:mm AM/PM",
@@ -33,5 +36,6 @@
3336
"UIKit.PasswordField.show": "show",
3437
"UIKit.SelectInput.noOptionsMessageWithInputValue": "No options",
3538
"UIKit.SelectInput.noOptionsMessageWithoutInputValue": "No options",
39+
"UIKit.SelectInput.placeholder": "Select...",
3640
"UIKit.TimeInput.placeholder": "HH:mm AM/PM"
3741
}

i18n/data/de.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22
"UIKit.AsyncCreatableSelectInput.createLabel": "",
33
"UIKit.AsyncCreatableSelectInput.noOptionsMessageWithInputValue": "",
44
"UIKit.AsyncCreatableSelectInput.noOptionsMessageWithoutInputValue": "",
5+
"UIKit.AsyncCreatableSelectInput.placeholder": "Auswählen...",
56
"UIKit.AsyncSelectInput.noOptionsMessageWithInputValue": "",
67
"UIKit.AsyncSelectInput.noOptionsMessageWithoutInputValue": "",
8+
"UIKit.AsyncSelectInput.placeholder": "Auswählen...",
79
"UIKit.CreatableSelectInput.createLabel": "",
810
"UIKit.CreatableSelectInput.noOptionsMessageWithInputValue": "",
911
"UIKit.CreatableSelectInput.noOptionsMessageWithoutInputValue": "",
12+
"UIKit.CreatableSelectInput.placeholder": "Auswählen...",
1013
"UIKit.DateInput.placeholder": "DD.MM.YYYY",
1114
"UIKit.DateRangeInput.placeholder": "DD.MM.YYYY - DD.MM.YYYY",
1215
"UIKit.DateTimeInput.placeholder": "DD.MM.YYYY - HH:mm",
@@ -33,5 +36,6 @@
3336
"UIKit.PasswordField.show": "anzeigen",
3437
"UIKit.SelectInput.noOptionsMessageWithInputValue": "",
3538
"UIKit.SelectInput.noOptionsMessageWithoutInputValue": "",
39+
"UIKit.SelectInput.placeholder": "Auswählen...",
3640
"UIKit.TimeInput.placeholder": "HH:mm"
37-
}
41+
}

i18n/data/en.json

+4
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22
"UIKit.AsyncCreatableSelectInput.createLabel": "Create \"{inputValue}\"",
33
"UIKit.AsyncCreatableSelectInput.noOptionsMessageWithInputValue": "No options",
44
"UIKit.AsyncCreatableSelectInput.noOptionsMessageWithoutInputValue": "No options",
5+
"UIKit.AsyncCreatableSelectInput.placeholder": "Select...",
56
"UIKit.AsyncSelectInput.noOptionsMessageWithInputValue": "No options",
67
"UIKit.AsyncSelectInput.noOptionsMessageWithoutInputValue": "No options",
8+
"UIKit.AsyncSelectInput.placeholder": "Select...",
79
"UIKit.CreatableSelectInput.createLabel": "Create \"{inputValue}\"",
810
"UIKit.CreatableSelectInput.noOptionsMessageWithInputValue": "No options",
911
"UIKit.CreatableSelectInput.noOptionsMessageWithoutInputValue": "No options",
12+
"UIKit.CreatableSelectInput.placeholder": "Select...",
1013
"UIKit.DateInput.placeholder": "MM/DD/YYYY",
1114
"UIKit.DateRangeInput.placeholder": "MM/DD/YYYY - MM/DD/YYYY",
1215
"UIKit.DateTimeInput.placeholder": "MM/DD/YYYY - HH:mm AM/PM",
@@ -33,5 +36,6 @@
3336
"UIKit.PasswordField.show": "show",
3437
"UIKit.SelectInput.noOptionsMessageWithInputValue": "No options",
3538
"UIKit.SelectInput.noOptionsMessageWithoutInputValue": "No options",
39+
"UIKit.SelectInput.placeholder": "Select...",
3640
"UIKit.TimeInput.placeholder": "HH:mm AM/PM"
3741
}

i18n/data/es.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22
"UIKit.AsyncCreatableSelectInput.createLabel": "Crear \"{inputValue}\"",
33
"UIKit.AsyncCreatableSelectInput.noOptionsMessageWithInputValue": "Menú vacío",
44
"UIKit.AsyncCreatableSelectInput.noOptionsMessageWithoutInputValue": "Menú vacío",
5+
"UIKit.AsyncCreatableSelectInput.placeholder": "Seleccionar...",
56
"UIKit.AsyncSelectInput.noOptionsMessageWithInputValue": "Menú vacío",
67
"UIKit.AsyncSelectInput.noOptionsMessageWithoutInputValue": "Menú vacío",
8+
"UIKit.AsyncSelectInput.placeholder": "Seleccionar...",
79
"UIKit.CreatableSelectInput.createLabel": "Crear \"{inputValue}\"",
810
"UIKit.CreatableSelectInput.noOptionsMessageWithInputValue": "Menú vacío",
911
"UIKit.CreatableSelectInput.noOptionsMessageWithoutInputValue": "Menú vacío",
12+
"UIKit.CreatableSelectInput.placeholder": "Seleccionar...",
1013
"UIKit.DateInput.placeholder": "DD/MM/YYYY",
1114
"UIKit.DateRangeInput.placeholder": "DD/MM/YYYY - DD/MM/YYYY",
1215
"UIKit.DateTimeInput.placeholder": "DD/MM/YYYY - HH:mm",
@@ -33,5 +36,6 @@
3336
"UIKit.PasswordField.show": "mostrar",
3437
"UIKit.SelectInput.noOptionsMessageWithInputValue": "Menú vacío",
3538
"UIKit.SelectInput.noOptionsMessageWithoutInputValue": "Menú vacío",
39+
"UIKit.SelectInput.placeholder": "Seleccionar...",
3640
"UIKit.TimeInput.placeholder": "HH:mm"
37-
}
41+
}

i18n/data/fr-FR.json

+4
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22
"UIKit.AsyncCreatableSelectInput.createLabel": "Créer \"{inputValue}\"",
33
"UIKit.AsyncCreatableSelectInput.noOptionsMessageWithInputValue": "Aucune option",
44
"UIKit.AsyncCreatableSelectInput.noOptionsMessageWithoutInputValue": "Aucune option",
5+
"UIKit.AsyncCreatableSelectInput.placeholder": "Sélectionner...",
56
"UIKit.AsyncSelectInput.noOptionsMessageWithInputValue": "Aucune option",
67
"UIKit.AsyncSelectInput.noOptionsMessageWithoutInputValue": "Aucune option",
8+
"UIKit.AsyncSelectInput.placeholder": "Sélectionner...",
79
"UIKit.CreatableSelectInput.createLabel": "Créer \"{inputValue}\"",
810
"UIKit.CreatableSelectInput.noOptionsMessageWithInputValue": "Aucune option",
911
"UIKit.CreatableSelectInput.noOptionsMessageWithoutInputValue": "Aucune option",
12+
"UIKit.CreatableSelectInput.placeholder": "Sélectionner...",
1013
"UIKit.DateInput.placeholder": "MM/JJ/AAAA",
1114
"UIKit.DateRangeInput.placeholder": "MM/JJ/AAAA - MM/JJ/AAAA",
1215
"UIKit.DateTimeInput.placeholder": "MM/JJ/AAAA - HH:mm AM/PM",
@@ -33,5 +36,6 @@
3336
"UIKit.PasswordField.show": "afficher",
3437
"UIKit.SelectInput.noOptionsMessageWithInputValue": "Aucune option",
3538
"UIKit.SelectInput.noOptionsMessageWithoutInputValue": "Aucune option",
39+
"UIKit.SelectInput.placeholder": "Sélectionner...",
3640
"UIKit.TimeInput.placeholder": "HH:mm AM/PM"
3741
}

i18n/data/zh-CN.json

+4
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22
"UIKit.AsyncCreatableSelectInput.createLabel": "创建 \"{inputValue}\"",
33
"UIKit.AsyncCreatableSelectInput.noOptionsMessageWithInputValue": "无选项",
44
"UIKit.AsyncCreatableSelectInput.noOptionsMessageWithoutInputValue": "无选项",
5+
"UIKit.AsyncCreatableSelectInput.placeholder": "选择...",
56
"UIKit.AsyncSelectInput.noOptionsMessageWithInputValue": "无选项",
67
"UIKit.AsyncSelectInput.noOptionsMessageWithoutInputValue": "无选项",
8+
"UIKit.AsyncSelectInput.placeholder": "选择...",
79
"UIKit.CreatableSelectInput.createLabel": "创建 \"{inputValue}\"",
810
"UIKit.CreatableSelectInput.noOptionsMessageWithInputValue": "无选项",
911
"UIKit.CreatableSelectInput.noOptionsMessageWithoutInputValue": "无选项",
12+
"UIKit.CreatableSelectInput.placeholder": "选择...",
1013
"UIKit.DateInput.placeholder": "月/日/年",
1114
"UIKit.DateRangeInput.placeholder": "月/日/年 - 月/日/年",
1215
"UIKit.DateTimeInput.placeholder": "月/日/年 - 小时:分钟 上午/下午",
@@ -33,5 +36,6 @@
3336
"UIKit.PasswordField.show": "显示",
3437
"UIKit.SelectInput.noOptionsMessageWithInputValue": "无选项",
3538
"UIKit.SelectInput.noOptionsMessageWithoutInputValue": "无选项",
39+
"UIKit.SelectInput.placeholder": "选择...",
3640
"UIKit.TimeInput.placeholder": "小时:分钟 上午/下午"
3741
}

src/components/inputs/async-creatable-select-input/async-creatable-select-input.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,10 @@ export class AsyncCreatableSelectInput extends React.Component {
118118
};
119119

120120
render() {
121+
const placeholder =
122+
this.props.placeholder ||
123+
this.props.intl.formatMessage(messages.placeholder);
124+
121125
return (
122126
<Constraints.Horizontal constraint={this.props.horizontalConstraint}>
123127
<div {...filterDataAttributes(this.props)}>
@@ -199,7 +203,7 @@ export class AsyncCreatableSelectInput extends React.Component {
199203
}}
200204
onFocus={this.props.onFocus}
201205
onInputChange={this.props.onInputChange}
202-
placeholder={this.props.placeholder}
206+
placeholder={placeholder}
203207
tabIndex={this.props.tabIndex}
204208
tabSelectsValue={this.props.tabSelectsValue}
205209
value={this.props.value}

src/components/inputs/async-creatable-select-input/messages.js

+5
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,9 @@ export default defineMessages({
1616
description: 'Text of dropdown when no options exist',
1717
defaultMessage: 'No options',
1818
},
19+
placeholder: {
20+
id: 'UIKit.AsyncCreatableSelectInput.placeholder',
21+
description: 'Default input placeholder text',
22+
defaultMessage: 'Select...',
23+
},
1924
});

src/components/inputs/async-select-input/async-select-input.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,10 @@ export class AsyncSelectInput extends React.Component {
114114
};
115115

116116
render() {
117+
const placeholder =
118+
this.props.placeholder ||
119+
this.props.intl.formatMessage(messages.placeholder);
120+
117121
return (
118122
<Constraints.Horizontal constraint={this.props.horizontalConstraint}>
119123
<div {...filterDataAttributes(this.props)}>
@@ -195,7 +199,7 @@ export class AsyncSelectInput extends React.Component {
195199
}}
196200
onFocus={this.props.onFocus}
197201
onInputChange={this.props.onInputChange}
198-
placeholder={this.props.placeholder}
202+
placeholder={placeholder}
199203
tabIndex={this.props.tabIndex}
200204
tabSelectsValue={this.props.tabSelectsValue}
201205
value={this.props.value}

src/components/inputs/async-select-input/messages.js

+5
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,9 @@ export default defineMessages({
1111
description: 'Text of dropdown when no options exist',
1212
defaultMessage: 'No options',
1313
},
14+
placeholder: {
15+
id: 'UIKit.AsyncSelectInput.placeholder',
16+
description: 'Default input placeholder text',
17+
defaultMessage: 'Select...',
18+
},
1419
});

src/components/inputs/creatable-select-input/creatable-select-input.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@ export class CreatableSelectInput extends React.Component {
120120
};
121121

122122
render() {
123+
const placeholder =
124+
this.props.placeholder ||
125+
this.props.intl.formatMessage(messages.placeholder);
126+
123127
return (
124128
<Constraints.Horizontal constraint={this.props.horizontalConstraint}>
125129
<div {...filterDataAttributes(this.props)}>
@@ -205,7 +209,7 @@ export class CreatableSelectInput extends React.Component {
205209
onFocus={this.props.onFocus}
206210
onInputChange={this.props.onInputChange}
207211
options={this.props.options}
208-
placeholder={this.props.placeholder}
212+
placeholder={placeholder}
209213
tabIndex={this.props.tabIndex}
210214
tabSelectsValue={this.props.tabSelectsValue}
211215
value={this.props.value}

src/components/inputs/creatable-select-input/messages.js

+5
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,9 @@ export default defineMessages({
1616
description: 'Text of dropdown when no options exist',
1717
defaultMessage: 'No options',
1818
},
19+
placeholder: {
20+
id: 'UIKit.CreatableSelectInput.placeholder',
21+
description: 'Default input placeholder text',
22+
defaultMessage: 'Select...',
23+
},
1924
});

src/components/inputs/select-input/messages.js

+5
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,9 @@ export default defineMessages({
1111
description: 'Text of dropdown when no options exist',
1212
defaultMessage: 'No options',
1313
},
14+
placeholder: {
15+
id: 'UIKit.SelectInput.placeholder',
16+
description: 'Default input placeholder text',
17+
defaultMessage: 'Select...',
18+
},
1419
});

src/components/inputs/select-input/select-input.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,10 @@ export class SelectInput extends React.Component {
167167
};
168168

169169
render() {
170+
const placeholder =
171+
this.props.placeholder ||
172+
this.props.intl.formatMessage(messages.placeholder);
173+
170174
return (
171175
<Constraints.Horizontal constraint={this.props.horizontalConstraint}>
172176
<div {...filterDataAttributes(this.props)}>
@@ -257,7 +261,7 @@ export class SelectInput extends React.Component {
257261
onFocus={this.props.onFocus}
258262
onInputChange={this.props.onInputChange}
259263
options={this.props.options}
260-
placeholder={this.props.placeholder}
264+
placeholder={placeholder}
261265
tabIndex={this.props.tabIndex}
262266
tabSelectsValue={this.props.tabSelectsValue}
263267
value={this.state.selectedOptions}

0 commit comments

Comments
 (0)