Skip to content

Commit c022f56

Browse files
authored
Adding Hebrew translation (#168)
* Adding Hebrew translation This is from Copilot, so it needs to be verified by a native speaker * Changed so Blockly changes rtl when an rtl languages are selected
1 parent a70e75e commit c022f56

File tree

5 files changed

+112
-0
lines changed

5 files changed

+112
-0
lines changed

src/i18n/locales/en/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"LANGUAGE": "Language",
3333
"ENGLISH": "English",
3434
"SPANISH": "Spanish",
35+
"HEBREW": "Hebrew",
3536
"HELP": "Help",
3637
"ABOUT": "About",
3738
"BLOCKS": "Blocks",

src/i18n/locales/es/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"LANGUAGE": "Idioma",
2929
"ENGLISH": "Inglés",
3030
"SPANISH": "Español",
31+
"HEBREW": "Hebreo",
3132
"HELP": "Ayuda",
3233
"ABOUT": "Acerca de",
3334
"BLOCKS": "Bloques",
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
{
2+
"mechanism_delete": "מחק מנגנון",
3+
"mechanism_rename": "שנה שם מנגנון",
4+
"mechanism_copy": "העתק מנגנון",
5+
"opmode_delete": "מחק מצב פעולה",
6+
"opmode_rename": "שנה שם מצב פעולה",
7+
"opmode_copy": "העתק מצב פעולה",
8+
"project_delete": "מחק פרויקט",
9+
"project_rename": "שנה שם פרויקט",
10+
"project_copy": "העתק פרויקט",
11+
"fail_list_projects": "נכשל בטעינת רשימת הפרויקטים.",
12+
"mechanism": "מנגנון",
13+
"opmode": "מצב פעולה",
14+
"class_rule_description": "רווחים אינם מותרים בשם. כל מילה בשם צריכה להתחיל באות גדולה.",
15+
"example_mechanism": "לדוגמה: GamePieceShooter",
16+
"example_opmode": "לדוגמה: AutoParkAndShoot",
17+
"example_project": "לדוגמה: WackyWheelerRobot",
18+
"addTabDialog": {
19+
"title": "הוסף כרטיסייה",
20+
"newItemPlaceholder": "הוסף מודול",
21+
"search": "חיפוש..."
22+
},
23+
"PROJECT": "פרויקט",
24+
"SAVE": "שמור",
25+
"DEPLOY": "פרוס",
26+
"MANAGE": "נהל",
27+
"EXPLORER": "סייר",
28+
"ROBOT": "רובוט",
29+
"SETTINGS": "הגדרות",
30+
"WPI_TOOLBOX": "ארגז כלים WPI",
31+
"THEME": "ערכת נושא",
32+
"LANGUAGE": "שפה",
33+
"ENGLISH": "אנגלית",
34+
"SPANISH": "ספרדית",
35+
"HEBREW": "עברית",
36+
"HELP": "עזרה",
37+
"ABOUT": "אודות",
38+
"BLOCKS": "בלוקים",
39+
"CODE": "קוד",
40+
"COPY": "העתק",
41+
"MECHANISMS": "מנגנונים",
42+
"OPMODES": "מצבי פעולה",
43+
"BLOCKLY":{
44+
"OF_TYPE": "מסוג",
45+
"WITH": "עם",
46+
"WHEN": "כאשר",
47+
"PARAMETER": "פרמטר",
48+
"PARAMETERS_CAN_ONLY_GO_IN_THEIR_METHODS_BLOCK": "פרמטרים יכולים להיכנס רק בבלוק השיטה שלהם",
49+
"COMPONENTS": "רכיבים",
50+
"EVENTS": "אירועים",
51+
"EVALUATE_BUT_IGNORE_RESULT": "הערך אך התעלם מהתוצאה",
52+
"TYPE": "סוג",
53+
"ENABLED": "מופעל",
54+
"DISPLAY_NAME": "שם תצוגה",
55+
"DISPLAY_GROUP": "קבוצת תצוגה",
56+
"PRINT": "הדפס",
57+
"TOOLTIP":{
58+
"EVALUATE_BUT_IGNORE_RESULT": "מריץ את הבלוק המחובר ומתעלם מהתוצאה. מאפשר לך לקרוא לפונקציה ולהתעלם מערך ההחזרה.",
59+
"OPMODE_TYPE": "איזה סוג של מצב פעולה זה",
60+
"OPMODE_ENABLED": "האם מצב הפעולה מוצג בתחנת הנהג",
61+
"OPMODE_NAME": "השם המוצג בתחנת הנהג. אם ריק ישתמש בשם הכיתה.",
62+
"OPMODE_GROUP": "קבוצה אופציונלית לקיבוץ מצבי פעולה בתחנת הנהג"
63+
},
64+
"CATEGORY":{
65+
"LISTS": "רשימות",
66+
"HARDWARE": "חומרה",
67+
"COMPONENTS": "רכיבים",
68+
"ROBOT": "רובוט",
69+
"MECHANISMS": "מנגנונים",
70+
"LOGIC": "לוגיקה",
71+
"LOOPS": "לולאות",
72+
"MATH": "מתמטיקה",
73+
"TEXT": "טקסט",
74+
"MISC": "שונות",
75+
"VARIABLES": "משתנים",
76+
"METHODS": "שיטות",
77+
"EVENTS": "אירועים",
78+
"ADD_MECHANISM": "+ מנגנון",
79+
"ADD_COMPONENT": "+ רכיב",
80+
"TEST": "בדיקה"
81+
}
82+
}
83+
}

src/reactComponents/BlocklyComponent.tsx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import * as React from 'react';
2222
import * as Blockly from 'blockly/core';
2323
import * as En from 'blockly/msg/en';
2424
import * as Es from 'blockly/msg/es';
25+
import * as He from 'blockly/msg/he';
2526
import { customTokens } from '../blocks/tokens';
2627

2728
import { themes } from '../themes/mrc_themes';
@@ -140,6 +141,20 @@ const BlocklyComponent = React.forwardRef<BlocklyComponentType | null, BlocklyCo
140141
if (!workspaceRef.current) {
141142
return;
142143
}
144+
145+
const newIsRtl = i18n.dir() === 'rtl';
146+
const currentIsRtl = workspaceRef.current.RTL;
147+
148+
// If RTL direction changed, we need to recreate the workspace
149+
if (newIsRtl !== currentIsRtl) {
150+
cleanupWorkspace();
151+
initializeWorkspace();
152+
if (props.onWorkspaceRecreated) {
153+
props.onWorkspaceRecreated(workspaceRef.current!);
154+
}
155+
return;
156+
}
157+
143158
// Set new locale
144159
switch (i18n.language) {
145160
case 'es':
@@ -148,6 +163,9 @@ const BlocklyComponent = React.forwardRef<BlocklyComponentType | null, BlocklyCo
148163
case 'en':
149164
Blockly.setLocale(En as any);
150165
break;
166+
case 'he':
167+
Blockly.setLocale(He as any);
168+
break;
151169
default:
152170
Blockly.setLocale(En as any);
153171
break;
@@ -175,6 +193,9 @@ const BlocklyComponent = React.forwardRef<BlocklyComponentType | null, BlocklyCo
175193
case 'en':
176194
Blockly.setLocale(En as any);
177195
break;
196+
case 'he':
197+
Blockly.setLocale(He as any);
198+
break;
178199
default:
179200
Blockly.setLocale(En as any);
180201
break;
@@ -183,6 +204,7 @@ const BlocklyComponent = React.forwardRef<BlocklyComponentType | null, BlocklyCo
183204

184205
// Create workspace
185206
const workspaceConfig = createWorkspaceConfig();
207+
workspaceConfig.rtl = i18n.dir() === 'rtl';
186208
const workspace = Blockly.inject(blocklyDiv.current, workspaceConfig);
187209
workspaceRef.current = workspace;
188210
};

src/reactComponents/Menu.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,11 @@ function getMenuItems(t: (key: string) => string, project: commonStorage.Project
150150
'setlang:es',
151151
currentLanguage === 'es' ? <CheckOutlined /> : undefined
152152
),
153+
getItem(
154+
t('HEBREW'),
155+
'setlang:he',
156+
currentLanguage === 'he' ? <CheckOutlined /> : undefined
157+
),
153158
]),
154159
]),
155160
getItem(t('HELP'), 'help', <QuestionCircleOutlined />, [

0 commit comments

Comments
 (0)