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 .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ jobs:
cache: 'npm'
- run: npm ci
- run: npm run lint
- run: npm run test
File renamed without changes.
2 changes: 1 addition & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default defineConfig([
import: cspellImport,
caseSensitive: false,
},
customWordListFile: "./backend/customWords.txt", // add custom words, that spellchecker doesn't know
customWordListFile: "./customWords.txt", // add custom words, that spellchecker doesn't know
}],
},
},
Expand Down
59 changes: 5 additions & 54 deletions frontend/localization.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,65 +17,16 @@
*/

import * as Blockly from 'blockly/core'
import * as En from 'blockly/msg/en'
import * as De from 'blockly/msg/de'
import { RailBlocksEnTable } from '../backend/tokens_en.js'
import { RailBlocksDeTable } from '../backend/tokens_de.js'
import { en_locale } from '../locales/en/en_locale'
import { de_locale } from '../locales/de/de_locale'


const LANGUAGE_STORAGE_KEY = 'railblocks.language'

// This file contains constants related to localization, such as retrieving the correct labels for the current language and applying the selected language to the Blockly editor and the page.
const LANGUAGE_CONFIGS = {
de: {
label: 'Deutsch',
locale: De,
tokens: RailBlocksDeTable,
htmlLabels: {
title: 'RailBlocks',
simulationTitle: 'Simulieren',
deployTitle: 'Auf der Anlage ausführen',
optionsTitle: 'Entwicklerinformationen anzeigen',
languageButton: 'Sprache',
languageMenuLabel: 'Editorsprache',
generatedCodeTitle: 'Generierter RailSL',
logsTitle: 'Protokolle',
deployConfirm: 'Wirklich auf der Anlage ausführen?',
saveTitle: 'Aktuellen Arbeitsbereich auf der Festplatte speichern',
loadTitle: 'Arbeitsbereich von der Festplatte laden',
attributionsTitle: 'Danksagungen',
attributionsText: 'Bilder erstellt und verteilt von user jucy_fish (Zugsymbol), Freepik (Sanduhr-GIF), <a href="https://www.flaticon.com/" title="icons source 1">Flaticon</a> und <a href="https://www.svgrepo.com" title="icons source 2">svgrepo</a>.'
},
toolboxLabels: {
setStatements: 'Setzanweisungen',
waitStatements: 'Warteanweisungen',
controlFlow: 'Kontrollfluss'
}
},
en: {
label: 'English',
locale: En,
tokens: RailBlocksEnTable,
htmlLabels: {
title: 'RailBlocks',
simulationTitle: 'Simulate',
deployTitle: 'Deploy on railway',
optionsTitle: 'View developer information',
languageButton: 'Language',
languageMenuLabel: 'Editor language',
generatedCodeTitle: 'Generated RailSL',
logsTitle: 'Logs',
deployConfirm: 'Really deploy on the railway?',
saveTitle: 'Save current workspace to disk',
loadTitle: 'Load workspace from disk',
attributionsTitle: 'Attributions',
attributionsText: 'Images created and distributed by user jucy_fish (train icon), Freepik (hourglass gif), <a href="https://www.flaticon.com/" title="icons source 1">Flaticon</a> and <a href="https://www.svgrepo.com" title="icons source 2">svgrepo</a>.'
},
toolboxLabels: {
setStatements: 'Set Statements',
waitStatements: 'Wait Statements',
controlFlow: 'Control Flow'
}
}
en: en_locale,
de: de_locale
}

/**
Expand Down
45 changes: 45 additions & 0 deletions locales/de/de_locale.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* RailBlocks - A Blockly RailSL Implementation
*
* https://github.com/kieler/RailBlocks
*
* Copyright 2026 by
* + Kiel University and others
* + Department of Computer Science
* + Real-Time and Embedded Systems Group
*
* This program and the accompanying materials are made
* available under the terms of the MIT License which
* is available at https://opensource.org/license/MIT.
*
* SPDX-License-Identifier: MIT
*/

import * as De from 'blockly/msg/en'
import { de_tokens } from './de_tokens'

export const de_locale = {
label: 'Deutsch',
locale: De,
tokens: de_tokens,
htmlLabels: {
title: 'RailBlocks',
simulationTitle: 'Simulieren',
deployTitle: 'Auf der Anlage ausführen',
optionsTitle: 'Entwicklerinformationen anzeigen',
languageButton: 'Sprache',
languageMenuLabel: 'Editorsprache',
generatedCodeTitle: 'Generierter RailSL',
logsTitle: 'Protokolle',
deployConfirm: 'Wirklich auf der Anlage ausführen?',
saveTitle: 'Aktuellen Arbeitsbereich auf der Festplatte speichern',
loadTitle: 'Arbeitsbereich von der Festplatte laden',
attributionsTitle: 'Danksagungen',
attributionsText: 'Bilder erstellt und verteilt von user jucy_fish (Zugsymbol), Freepik (Sanduhr-GIF), <a href="https://www.flaticon.com/" title="icons source 1">Flaticon</a> und <a href="https://www.svgrepo.com" title="icons source 2">svgrepo</a>.'
},
toolboxLabels: {
setStatements: 'Setzanweisungen',
waitStatements: 'Warteanweisungen',
controlFlow: 'Kontrollfluss'
}
};
2 changes: 1 addition & 1 deletion backend/tokens_de.js → locales/de/de_tokens.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/

// This file contains the German translations for the block labels, tooltips and warnings.
export const RailBlocksDeTable = {
export const de_tokens = {
RAILBLOCKS_PROGRAM_TEXT: 'Programm',
RAILBLOCKS_PROGRAM_TOOLTIP: 'Das Programm, das ausgeführt werden soll.\n Alle weiteren Befehle sollten innerhalb dieses Blocks stehen.',

Expand Down
45 changes: 45 additions & 0 deletions locales/en/en_locale.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* RailBlocks - A Blockly RailSL Implementation
*
* https://github.com/kieler/RailBlocks
*
* Copyright 2026 by
* + Kiel University and others
* + Department of Computer Science
* + Real-Time and Embedded Systems Group
*
* This program and the accompanying materials are made
* available under the terms of the MIT License which
* is available at https://opensource.org/license/MIT.
*
* SPDX-License-Identifier: MIT
*/

import * as En from 'blockly/msg/en'
import { en_tokens } from './en_tokens'

export const en_locale = {
label: 'English',
locale: En,
tokens: en_tokens,
htmlLabels: {
title: 'RailBlocks',
simulationTitle: 'Simulate',
deployTitle: 'Deploy on railway',
optionsTitle: 'View developer information',
languageButton: 'Language',
languageMenuLabel: 'Editor language',
generatedCodeTitle: 'Generated RailSL',
logsTitle: 'Logs',
deployConfirm: 'Really deploy on the railway?',
saveTitle: 'Save current workspace to disk',
loadTitle: 'Load workspace from disk',
attributionsTitle: 'Attributions',
attributionsText: 'Images created and distributed by user jucy_fish (train icon), Freepik (hourglass gif), <a href="https://www.flaticon.com/" title="icons source 1">Flaticon</a> and <a href="https://www.svgrepo.com" title="icons source 2">svgrepo</a>.'
},
toolboxLabels: {
setStatements: 'Set Statements',
waitStatements: 'Wait Statements',
controlFlow: 'Control Flow'
}
};
2 changes: 1 addition & 1 deletion backend/tokens_en.js → locales/en/en_tokens.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/

// This file contains the English translations for the block labels, tooltips and warnings.
export const RailBlocksEnTable = {
export const en_tokens = {
RAILBLOCKS_PROGRAM_TEXT: 'Program',
RAILBLOCKS_PROGRAM_TOOLTIP: 'The program that should be executed.\nAll further commands should be inside this block.',

Expand Down
Loading