Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/i18n/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"LANGUAGE": "Language",
"ENGLISH": "English",
"SPANISH": "Spanish",
"HEBREW": "Hebrew",
"HELP": "Help",
"ABOUT": "About",
"BLOCKS": "Blocks",
Expand Down
1 change: 1 addition & 0 deletions src/i18n/locales/es/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"LANGUAGE": "Idioma",
"ENGLISH": "Inglés",
"SPANISH": "Español",
"HEBREW": "Hebreo",
"HELP": "Ayuda",
"ABOUT": "Acerca de",
"BLOCKS": "Bloques",
Expand Down
83 changes: 83 additions & 0 deletions src/i18n/locales/he/translation.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{
"mechanism_delete": "מחק מנגנון",
"mechanism_rename": "שנה שם מנגנון",
"mechanism_copy": "העתק מנגנון",
"opmode_delete": "מחק מצב פעולה",
"opmode_rename": "שנה שם מצב פעולה",
"opmode_copy": "העתק מצב פעולה",
"project_delete": "מחק פרויקט",
"project_rename": "שנה שם פרויקט",
"project_copy": "העתק פרויקט",
"fail_list_projects": "נכשל בטעינת רשימת הפרויקטים.",
"mechanism": "מנגנון",
"opmode": "מצב פעולה",
"class_rule_description": "רווחים אינם מותרים בשם. כל מילה בשם צריכה להתחיל באות גדולה.",
"example_mechanism": "לדוגמה: GamePieceShooter",
"example_opmode": "לדוגמה: AutoParkAndShoot",
"example_project": "לדוגמה: WackyWheelerRobot",
"addTabDialog": {
"title": "הוסף כרטיסייה",
"newItemPlaceholder": "הוסף מודול",
"search": "חיפוש..."
},
"PROJECT": "פרויקט",
"SAVE": "שמור",
"DEPLOY": "פרוס",
"MANAGE": "נהל",
"EXPLORER": "סייר",
"ROBOT": "רובוט",
"SETTINGS": "הגדרות",
"WPI_TOOLBOX": "ארגז כלים WPI",
"THEME": "ערכת נושא",
"LANGUAGE": "שפה",
"ENGLISH": "אנגלית",
"SPANISH": "ספרדית",
"HEBREW": "עברית",
"HELP": "עזרה",
"ABOUT": "אודות",
"BLOCKS": "בלוקים",
"CODE": "קוד",
"COPY": "העתק",
"MECHANISMS": "מנגנונים",
"OPMODES": "מצבי פעולה",
"BLOCKLY":{
"OF_TYPE": "מסוג",
"WITH": "עם",
"WHEN": "כאשר",
"PARAMETER": "פרמטר",
"PARAMETERS_CAN_ONLY_GO_IN_THEIR_METHODS_BLOCK": "פרמטרים יכולים להיכנס רק בבלוק השיטה שלהם",
"COMPONENTS": "רכיבים",
"EVENTS": "אירועים",
"EVALUATE_BUT_IGNORE_RESULT": "הערך אך התעלם מהתוצאה",
"TYPE": "סוג",
"ENABLED": "מופעל",
"DISPLAY_NAME": "שם תצוגה",
"DISPLAY_GROUP": "קבוצת תצוגה",
"PRINT": "הדפס",
"TOOLTIP":{
"EVALUATE_BUT_IGNORE_RESULT": "מריץ את הבלוק המחובר ומתעלם מהתוצאה. מאפשר לך לקרוא לפונקציה ולהתעלם מערך ההחזרה.",
"OPMODE_TYPE": "איזה סוג של מצב פעולה זה",
"OPMODE_ENABLED": "האם מצב הפעולה מוצג בתחנת הנהג",
"OPMODE_NAME": "השם המוצג בתחנת הנהג. אם ריק ישתמש בשם הכיתה.",
"OPMODE_GROUP": "קבוצה אופציונלית לקיבוץ מצבי פעולה בתחנת הנהג"
},
"CATEGORY":{
"LISTS": "רשימות",
"HARDWARE": "חומרה",
"COMPONENTS": "רכיבים",
"ROBOT": "רובוט",
"MECHANISMS": "מנגנונים",
"LOGIC": "לוגיקה",
"LOOPS": "לולאות",
"MATH": "מתמטיקה",
"TEXT": "טקסט",
"MISC": "שונות",
"VARIABLES": "משתנים",
"METHODS": "שיטות",
"EVENTS": "אירועים",
"ADD_MECHANISM": "+ מנגנון",
"ADD_COMPONENT": "+ רכיב",
"TEST": "בדיקה"
}
}
}
22 changes: 22 additions & 0 deletions src/reactComponents/BlocklyComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import * as React from 'react';
import * as Blockly from 'blockly/core';
import * as En from 'blockly/msg/en';
import * as Es from 'blockly/msg/es';
import * as He from 'blockly/msg/he';
import { customTokens } from '../blocks/tokens';

import { themes } from '../themes/mrc_themes';
Expand Down Expand Up @@ -140,6 +141,20 @@ const BlocklyComponent = React.forwardRef<BlocklyComponentType | null, BlocklyCo
if (!workspaceRef.current) {
return;
}

const newIsRtl = i18n.dir() === 'rtl';
const currentIsRtl = workspaceRef.current.RTL;

// If RTL direction changed, we need to recreate the workspace
if (newIsRtl !== currentIsRtl) {
cleanupWorkspace();
initializeWorkspace();
if (props.onWorkspaceRecreated) {
props.onWorkspaceRecreated(workspaceRef.current!);
}
return;
}

// Set new locale
switch (i18n.language) {
case 'es':
Expand All @@ -148,6 +163,9 @@ const BlocklyComponent = React.forwardRef<BlocklyComponentType | null, BlocklyCo
case 'en':
Blockly.setLocale(En as any);
break;
case 'he':
Blockly.setLocale(He as any);
break;
default:
Blockly.setLocale(En as any);
break;
Expand Down Expand Up @@ -175,6 +193,9 @@ const BlocklyComponent = React.forwardRef<BlocklyComponentType | null, BlocklyCo
case 'en':
Blockly.setLocale(En as any);
break;
case 'he':
Blockly.setLocale(He as any);
break;
default:
Blockly.setLocale(En as any);
break;
Expand All @@ -183,6 +204,7 @@ const BlocklyComponent = React.forwardRef<BlocklyComponentType | null, BlocklyCo

// Create workspace
const workspaceConfig = createWorkspaceConfig();
workspaceConfig.rtl = i18n.dir() === 'rtl';
const workspace = Blockly.inject(blocklyDiv.current, workspaceConfig);
workspaceRef.current = workspace;
};
Expand Down
5 changes: 5 additions & 0 deletions src/reactComponents/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@ function getMenuItems(t: (key: string) => string, project: commonStorage.Project
'setlang:es',
currentLanguage === 'es' ? <CheckOutlined /> : undefined
),
getItem(
t('HEBREW'),
'setlang:he',
currentLanguage === 'he' ? <CheckOutlined /> : undefined
),
]),
]),
getItem(t('HELP'), 'help', <QuestionCircleOutlined />, [
Expand Down