File tree 6 files changed +30
-13
lines changed
6 files changed +30
-13
lines changed Original file line number Diff line number Diff line change 153
153
▸ ** postMessage** (` value ` : string): * [ DecimalSetting] ( _pages_decimal_setting_d_.decimalsetting.md ) *
154
154
155
155
A string to be shown after the text input field. One common use for this field is to
156
- specify a unit of measure.
156
+ specify a unit of measure. Omitting the value and calling ` postMessage() ` will set the
157
+ value to the default i18n string, allowing translations to be defines in the locale
158
+ file in the usual way.
157
159
158
160
** Parameters:**
159
161
Original file line number Diff line number Diff line change 161
161
▸ ** postMessage** (` value ` : string): * [ NumberSetting] ( _pages_number_setting_d_.numbersetting.md ) *
162
162
163
163
A string to be shown after the text input field. One common use for this field is to
164
- specify a unit of measure.
164
+ specify a unit of measure. Omitting the value and calling ` postMessage() ` will set the
165
+ value to the default i18n string, allowing translations to be defines in the locale
166
+ file in the usual way.
165
167
166
168
** Parameters:**
167
169
195
197
196
198
▸ ** step** (` value ` : number): * [ NumberSetting] ( _pages_number_setting_d_.numbersetting.md ) *
197
199
198
- The step between values values . If the style is not set to slider then setting a step will
200
+ The step between values. If the style is not set to slider then setting a step will
199
201
cause up and down arrows to appear next to the input box that increment or decrement the value
200
202
by the value of the step.
201
203
Original file line number Diff line number Diff line change @@ -32,8 +32,10 @@ export class DecimalSetting extends SectionSetting<DecimalSetting> {
32
32
33
33
/**
34
34
* A string to be shown after the text input field. One common use for this field is to
35
- * specify a unit of measure.
35
+ * specify a unit of measure. Omitting the value and calling `postMessage()` will set the
36
+ * value to the default i18n string, allowing translations to be defines in the locale
37
+ * file in the usual way.
36
38
* @param value Max length 10 characters
37
39
*/
38
- postMessage ( value : string ) : DecimalSetting
40
+ postMessage ( value ? : string ) : DecimalSetting
39
41
}
Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ module.exports = class DecimalSetting extends SectionSetting {
7
7
super ( section , id )
8
8
this . _type = 'DECIMAL'
9
9
this . _description = 'Tap to set'
10
- this . _postMessage = this . i18nKey ( 'postMessage' )
11
10
}
12
11
13
12
max ( value ) {
@@ -26,7 +25,12 @@ module.exports = class DecimalSetting extends SectionSetting {
26
25
}
27
26
28
27
postMessage ( value ) {
29
- this . _postMessage = value
28
+ if ( value === undefined ) {
29
+ this . _postMessage = this . i18nKey ( 'postMessage' )
30
+ } else {
31
+ this . _postMessage = value
32
+ }
33
+
30
34
return this
31
35
}
32
36
@@ -45,7 +49,7 @@ module.exports = class DecimalSetting extends SectionSetting {
45
49
}
46
50
47
51
if ( this . _postMessage ) {
48
- result . postMessage = this . _postMessage
52
+ result . postMessage = this . translate ( this . _postMessage )
49
53
}
50
54
51
55
return result
Original file line number Diff line number Diff line change @@ -42,13 +42,15 @@ export class NumberSetting extends SectionSetting<NumberSetting> {
42
42
43
43
/**
44
44
* A string to be shown after the text input field. One common use for this field is to
45
- * specify a unit of measure.
45
+ * specify a unit of measure. Omitting the value and calling `postMessage()` will set the
46
+ * value to the default i18n string, allowing translations to be defines in the locale
47
+ * file in the usual way.
46
48
* @param value Max length 10 characters
47
49
*/
48
- postMessage ( value : string ) : NumberSetting
50
+ postMessage ( value ? : string ) : NumberSetting
49
51
50
52
/**
51
- * The step between values values . If the style is not set to slider then setting a step will
53
+ * The step between values. If the style is not set to slider then setting a step will
52
54
* cause up and down arrows to appear next to the input box that increment or decrement the value
53
55
* by the value of the step.
54
56
*/
Original file line number Diff line number Diff line change @@ -73,7 +73,12 @@ module.exports = class NumberSetting extends SectionSetting {
73
73
* @returns {NumberSetting } Number Setting instance
74
74
*/
75
75
postMessage ( value ) {
76
- this . _postMessage = value
76
+ if ( value === undefined ) {
77
+ this . _postMessage = this . i18nKey ( 'postMessage' )
78
+ } else {
79
+ this . _postMessage = value
80
+ }
81
+
77
82
return this
78
83
}
79
84
@@ -100,7 +105,7 @@ module.exports = class NumberSetting extends SectionSetting {
100
105
}
101
106
102
107
if ( this . _postMessage ) {
103
- result . postMessage = this . _postMessage
108
+ result . postMessage = this . translate ( this . _postMessage )
104
109
}
105
110
106
111
return result
You can’t perform that action at this time.
0 commit comments