Skip to content

Commit 7a9befb

Browse files
committed
Localize '+ Add parameter' button via i18n\n\n- Add button-add-parameter key to en/ru\n- Use i18n.t in ParameterListWidget and refresh after i18n.load()
1 parent bc265da commit 7a9befb

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

i18n/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
"placeholder-parameter-name": "parameter name",
7575
"placeholder-parameter-value": "parameter value",
7676
"label-add-parameter": "Add parameter:",
77+
"button-add-parameter": "Add parameter",
7778
"label-class": "Class",
7879
"label-importance": "Importance",
7980
"option-no-class": "no class",

i18n/ru.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
"placeholder-parameter-name": "имя параметра",
7575
"placeholder-parameter-value": "значение параметра",
7676
"label-add-parameter": "Добавить параметр:",
77+
"button-add-parameter": "Добавить параметр",
7778
"label-class": "Класс",
7879
"label-importance": "Важность",
7980
"option-no-class": "без класса",

rater-src/Windows/Components/ParameterListWidget.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
* @cfg {Number} displayLimit The most to show at once. If the number of items
66
* is more than this, then only the first (displayLimit - 1) items are shown.
77
*/
8+
import i18n from "../../i18n";
9+
810
var ParameterListWidget = function ParameterListWidget( config ) {
911
config = config || {};
1012

@@ -46,13 +48,18 @@ var ParameterListWidget = function ParameterListWidget( config ) {
4648

4749
// Add the button that allows user to add more parameters
4850
this.addParametersButton = new OO.ui.ButtonWidget({
49-
label: "Add parameter",
51+
label: i18n.t("button-add-parameter"),
5052
icon: "add",
5153
framed: false,
5254
$element: $("<span style='margin-bottom:0'>")
5355
});
5456
this.addItems([this.addParametersButton]);
5557

58+
// Refresh label after i18n loads
59+
i18n.load().then(function(){
60+
this.addParametersButton.setLabel(i18n.t("button-add-parameter"));
61+
}.bind(this));
62+
5663
/* --- Events --- */
5764

5865
// Handle delete events from ParameterWidgets

0 commit comments

Comments
 (0)