Skip to content

Commit e31862e

Browse files
authored
Update categories to use i18n (#267)
1 parent 0d83ede commit e31862e

File tree

7 files changed

+30
-6
lines changed

7 files changed

+30
-6
lines changed

src/blocks/tokens.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,5 +108,11 @@ export function customTokens(t: (key: string) => string): typeof Blockly.Msg {
108108
MRC_CATEGORY_ADD_COMPONENT: t('BLOCKLY.CATEGORY.ADD_COMPONENT'),
109109
MRC_CATEGORY_TEST: t('BLOCKLY.CATEGORY.TEST'),
110110
MRC_PRINT: t('BLOCKLY.PRINT'),
111+
CUSTOM_EVENTS_LABEL: t('BLOCKLY.CUSTOM_EVENTS_LABEL'),
112+
CUSTOM_METHODS_LABEL: t('BLOCKLY.CUSTOM_METHODS_LABEL'),
113+
MORE_ROBOT_METHODS_LABEL: t('BLOCKLY.MORE_ROBOT_METHODS_LABEL'),
114+
MORE_MECHANISM_METHODS_LABEL: t('BLOCKLY.MORE_MECHANISM_METHODS_LABEL'),
115+
MORE_OPMODE_METHODS_LABEL: t('BLOCKLY.MORE_OPMODE_METHODS_LABEL'),
116+
COMMENT_DEFAULT_TEXT: t('BLOCKLY.COMMENT_DEFAULT_TEXT'),
111117
}
112118
};

src/i18n/locales/en/translation.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,12 @@
114114
"ROBOT": "robot",
115115
"CREATE": "create",
116116
"FIRE": "fire",
117+
"CUSTOM_EVENTS_LABEL": "Custom Events",
118+
"CUSTOM_METHODS_LABEL": "Custom Methods",
119+
"MORE_ROBOT_METHODS_LABEL": "More Robot Methods",
120+
"MORE_MECHANISM_METHODS_LABEL": "More Mechanism Methods",
121+
"MORE_OPMODE_METHODS_LABEL": "More OpMode Methods",
122+
"COMMENT_DEFAULT_TEXT": "Enter your comment here!",
117123
"TOOLTIP":{
118124
"EVALUATE_BUT_IGNORE_RESULT": "Executes the connected block and ignores the result. Allows you to call a function and ignore the return value.",
119125
"NONE": "Returns None.",

src/i18n/locales/es/translation.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,12 @@
115115
"ROBOT": "robot",
116116
"CREATE": "crear",
117117
"FIRE": "disparar",
118+
"CUSTOM_EVENTS_LABEL": "Eventos Personalizados",
119+
"CUSTOM_METHODS_LABEL": "Métodos Personalizados",
120+
"MORE_ROBOT_METHODS_LABEL": "Más Métodos del Robot",
121+
"MORE_MECHANISM_METHODS_LABEL": "Más Métodos del Mecanismo",
122+
"MORE_OPMODE_METHODS_LABEL": "Más Métodos del OpMode",
123+
"COMMENT_DEFAULT_TEXT": "¡Ingresa tu comentario aquí!",
118124
"TOOLTIP": {
119125
"EVALUATE_BUT_IGNORE_RESULT": "Ejecuta el bloque conectado e ignora el resultado. Te permite llamar una función e ignorar el valor de retorno.",
120126
"NONE": "No devuelve ninguno.",

src/i18n/locales/he/translation.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,12 @@
114114
"ROBOT": "רובוט",
115115
"CREATE": "צור",
116116
"FIRE": "הפעל",
117+
"CUSTOM_EVENTS_LABEL": "אירועים מותאמים אישית",
118+
"CUSTOM_METHODS_LABEL": "מתודות מותאמות אישית",
119+
"MORE_ROBOT_METHODS_LABEL": "מתודות נוספות לרובוט",
120+
"MORE_MECHANISM_METHODS_LABEL": "מתודות נוספות למנגנון",
121+
"MORE_OPMODE_METHODS_LABEL": "מתודות נוספות לאופמוד",
122+
"COMMENT_DEFAULT_TEXT": "הזן את ההערה שלך כאן!",
117123
"TOOLTIP": {
118124
"EVALUATE_BUT_IGNORE_RESULT": "מבצע את הבלוק המחובר ומתעלם מהתוצאה. מאפשר לקרוא לפונקציה מבלי להשתמש בערך שהיא מחזירה.",
119125
"NONE": "מחזיר כלום.",

src/toolbox/event_category.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class EventsCategory {
6565
contents.push(
6666
{
6767
kind: 'label',
68-
text: 'Custom Events',
68+
text: Blockly.Msg['CUSTOM_EVENTS_LABEL'],
6969
},
7070
createCustomEventBlock(storageNames.makeUniqueName('my_event', eventNames))
7171
);

src/toolbox/methods_category.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class MethodsCategory {
8181
];
8282
// Add the methods for a Robot.
8383
this.addClassBlocksForCurrentModule(
84-
'More Robot Methods', this.robotClassBlocks, robotMethodNamesNotOverrideable,
84+
Blockly.Msg['MORE_ROBOT_METHODS_LABEL'], this.robotClassBlocks, robotMethodNamesNotOverrideable,
8585
methodNamesAlreadyOverridden, contents);
8686
break;
8787
case storageModule.ModuleType.MECHANISM:
@@ -95,13 +95,13 @@ class MethodsCategory {
9595
];
9696
// Add the methods for a Mechanism.
9797
this.addClassBlocksForCurrentModule(
98-
'More Mechanism Methods', this.mechanismClassBlocks, mechanismMethodNamesNotOverrideable,
98+
Blockly.Msg['MORE_MECHANISM_METHODS_LABEL'], this.mechanismClassBlocks, mechanismMethodNamesNotOverrideable,
9999
methodNamesAlreadyOverridden, contents);
100100
break;
101101
case storageModule.ModuleType.OPMODE:
102102
// Add the methods for an OpMode.
103103
this.addClassBlocksForCurrentModule(
104-
'More OpMode Methods', this.opmodeClassBlocks, [],
104+
Blockly.Msg['MORE_OPMODE_METHODS_LABEL'], this.opmodeClassBlocks, [],
105105
methodNamesAlreadyOverridden, contents);
106106
break;
107107
}
@@ -110,7 +110,7 @@ class MethodsCategory {
110110
contents.push(
111111
{
112112
kind: 'label',
113-
text: 'Custom Methods',
113+
text: Blockly.Msg['CUSTOM_METHODS_LABEL'],
114114
},
115115
createCustomMethodBlock(),
116116
createCustomMethodBlockWithReturn()

src/toolbox/misc_category.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export const getCategory = () => ({
77
kind: 'block',
88
type: 'mrc_misc_comment',
99
fields: {
10-
COMMENT: 'Enter your comment here!',
10+
COMMENT: Blockly.Msg['COMMENT_DEFAULT_TEXT'],
1111
},
1212
},
1313
{

0 commit comments

Comments
 (0)