diff --git a/ardublockly/ardublockly_lang.js b/ardublockly/ardublockly_lang.js
index ccc2cf295c..caea0b9312 100644
--- a/ardublockly/ardublockly_lang.js
+++ b/ardublockly/ardublockly_lang.js
@@ -1,183 +1,184 @@
-/**
- * @license Licensed under the Apache License, Version 2.0 (the "License"):
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * @fileoverview Functions related to language and localisation.
- */
-'use strict';
-
-/** Create a namespace for the application. */
-var Ardublockly = Ardublockly || {};
-
-/** Lookup for names of supported languages. Keys in ISO 639 format. */
-Ardublockly.LANGUAGE_NAME = {
- 'fr': 'Français',
- 'en': 'English',
- 'es': 'Español',
- 'nl': 'Nederlands',
- 'pt': 'Português',
- 'it': 'Italiano',
- 'ru': 'Русский'
-};
-
-/**
- * Selected language, default English.
- * @type {string}
- */
-Ardublockly.LANG = 'en';
-
-/**
- * We keep a local copy of the default language in case translations cannot
- * be found in the injected language file.
- * @type {Object}
- */
-Ardublockly.DEFAULT_LANG_TEXT = {};
-
-
-/** Initialize the page language. */
-Ardublockly.initLanguage = function() {
- // Save the current default language ID to check if it has been changed
- var defaultLang = Ardublockly.LANG;
-
- // Check server settings and url language, url gets priority
- Ardublockly.LANG = Ardublockly.getUrlLanguage() ||
- Ardublockly.getLanguageSetting() || Ardublockly.LANG;
-
- Ardublockly.populateLanguageMenu(Ardublockly.LANG);
-
- if (defaultLang !== Ardublockly.LANG) {
- Ardublockly.duplicateDefaultLang();
- Ardublockly.injectLanguageJsSources(Ardublockly.LANG);
- Ardublockly.updateLanguageText();
- }
-};
-
-/**
- * Get the language previously set by the user from the server settings.
- * @return {string} Language saved in the server settings.
- */
-Ardublockly.getLanguageSetting = function() {
- //TODO: Server feature still to be implemented, for now return default
- return null;
-};
-
-/**
- * Get the language selected from the URL, format '?lang=en'.
- * @return {string} Selected language.
- */
-Ardublockly.getUrlLanguage = function() {
- var langKey = 'lang';
- var val = location.search.match(new RegExp('[?&]' + langKey + '=([^&]+)'));
- var language = val ? decodeURIComponent(val[1].replace(/\+/g, '%20')) : '';
- if (Ardublockly.LANGUAGE_NAME[language] === undefined) {
- language = null;
- }
- return language;
-};
-
-/**
- * Populates the settings language selection menu.
- * @param {!string} selectedLang Language to be marked as selected.
- */
-Ardublockly.populateLanguageMenu = function(selectedLang) {
- var languageMenu = document.getElementById('language');
- languageMenu.options.length = 0;
-
- for (var lang in Ardublockly.LANGUAGE_NAME) {
- var option = new Option(Ardublockly.LANGUAGE_NAME[lang], lang);
- if (lang == selectedLang) {
- option.selected = true;
- }
- languageMenu.options.add(option);
- }
- languageMenu.onchange = Ardublockly.changeLanguage;
-};
-
-/**
- * Because new languages are injected by overwriting Ardublockly.LOCALISED_TEXT
- * we keep a local copy of the default language (included in the html header) so
- * that we can still retrieve these strings if the translation cannot be found.
- */
-Ardublockly.duplicateDefaultLang = function() {
- for (var textId in Ardublockly.LOCALISED_TEXT) {
- Ardublockly.DEFAULT_LANG_TEXT[textId] = Ardublockly.LOCALISED_TEXT[textId];
- }
-};
-
-/** Updates the page text strings with the new language. */
-Ardublockly.updateLanguageText = function() {
- for (var textId in Ardublockly.LOCALISED_TEXT) {
- var textStrings = document.getElementsByClassName('translatable_' + textId);
- for (var i = 0; i < textStrings.length; i++) {
- textStrings[i].innerHTML = Ardublockly.getLocalStr(textId);
- }
- }
-};
-
-/**
- * Injects the language JavaScript files into the html head element.
- * @param {string} langKey Dictionary key for the language to inject, must also
- * be JS file name.
- */
-Ardublockly.injectLanguageJsSources = function(langKey) {
- var head = document.getElementsByTagName('head')[0];
-
- // Retrieve and inject Ardublockly translations synchronously
- var appLangJsLoad = document.createElement('script');
- var request = ArdublocklyServer.createRequest();
- var appLangJdPath = 'msg/' + langKey + '.js';
- try {
- request.open('GET', appLangJdPath, false);
- request.send('');
- appLangJsLoad.text = request.responseText;
- } catch (e) {
- // Display an alert to indicate we cannot load languages
- Ardublockly.alertMessage(
- Ardublockly.getLocalStr('noServerTitle'),
- Ardublockly.getLocalStr('noServerNoLangBody'),
- false);
- // But still asynchronous lazy load so at least some text gets translated
- appLangJsLoad.src = appLangJdPath;
- }
- head.appendChild(appLangJsLoad);
-
- // Retrieve and inject Blockly translations asynchronously
- var blocklyLangJsLoad = document.createElement('script');
- blocklyLangJsLoad.src = '../blockly/msg/js/' + langKey + '.js';
- head.appendChild(blocklyLangJsLoad);
-};
-
-/** Saves the blocks and reloads with a different language. */
-Ardublockly.changeLanguage = function() {
- // Store the blocks for the duration of the reload only
- Ardublockly.saveSessionStorageBlocks();
-
- var languageMenu = document.getElementById('language');
- var newLang = encodeURIComponent(
- languageMenu.options[languageMenu.selectedIndex].value);
- var search = window.location.search;
- if (search.length <= 1) {
- search = '?lang=' + newLang;
- } else if (search.match(/[?&]lang=[^&]*/)) {
- search = search.replace(/([?&]lang=)[^&]*/, '$1' + newLang);
- } else {
- search = search.replace(/\?/, '?lang=' + newLang + '&');
- }
-
- window.location = window.location.protocol + '//' +
- window.location.host + window.location.pathname + search;
-};
-
-/**
- * Finds and returns the requests string in the localised language.
- * If the translation is not returned, it fetches the original language string.
- * @param {string} stringId
- * @return {!string} The localised, original, or an empty string.
- */
-Ardublockly.getLocalStr = function(stringId) {
- var text = Ardublockly.LOCALISED_TEXT[stringId];
- if (!text) {
- console.log('Localised text string ID "' + stringId + '" does not exists!');
- }
- return text || Ardublockly.DEFAULT_LANG_TEXT[stringId] || '';
-};
+/**
+ * @license Licensed under the Apache License, Version 2.0 (the "License"):
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * @fileoverview Functions related to language and localisation.
+ */
+'use strict';
+
+/** Create a namespace for the application. */
+var Ardublockly = Ardublockly || {};
+
+/** Lookup for names of supported languages. Keys in ISO 639 format. */
+Ardublockly.LANGUAGE_NAME = {
+ 'de': 'Deutsch',
+ 'fr': 'Français',
+ 'en': 'English',
+ 'es': 'Español',
+ 'nl': 'Nederlands',
+ 'pt': 'Português',
+ 'it': 'Italiano',
+ 'ru': 'Русский'
+};
+
+/**
+ * Selected language, default English.
+ * @type {string}
+ */
+Ardublockly.LANG = 'en';
+
+/**
+ * We keep a local copy of the default language in case translations cannot
+ * be found in the injected language file.
+ * @type {Object}
+ */
+Ardublockly.DEFAULT_LANG_TEXT = {};
+
+
+/** Initialize the page language. */
+Ardublockly.initLanguage = function() {
+ // Save the current default language ID to check if it has been changed
+ var defaultLang = Ardublockly.LANG;
+
+ // Check server settings and url language, url gets priority
+ Ardublockly.LANG = Ardublockly.getUrlLanguage() ||
+ Ardublockly.getLanguageSetting() || Ardublockly.LANG;
+
+ Ardublockly.populateLanguageMenu(Ardublockly.LANG);
+
+ if (defaultLang !== Ardublockly.LANG) {
+ Ardublockly.duplicateDefaultLang();
+ Ardublockly.injectLanguageJsSources(Ardublockly.LANG);
+ Ardublockly.updateLanguageText();
+ }
+};
+
+/**
+ * Get the language previously set by the user from the server settings.
+ * @return {string} Language saved in the server settings.
+ */
+Ardublockly.getLanguageSetting = function() {
+ //TODO: Server feature still to be implemented, for now return default
+ return null;
+};
+
+/**
+ * Get the language selected from the URL, format '?lang=en'.
+ * @return {string} Selected language.
+ */
+Ardublockly.getUrlLanguage = function() {
+ var langKey = 'lang';
+ var val = location.search.match(new RegExp('[?&]' + langKey + '=([^&]+)'));
+ var language = val ? decodeURIComponent(val[1].replace(/\+/g, '%20')) : '';
+ if (Ardublockly.LANGUAGE_NAME[language] === undefined) {
+ language = null;
+ }
+ return language;
+};
+
+/**
+ * Populates the settings language selection menu.
+ * @param {!string} selectedLang Language to be marked as selected.
+ */
+Ardublockly.populateLanguageMenu = function(selectedLang) {
+ var languageMenu = document.getElementById('language');
+ languageMenu.options.length = 0;
+
+ for (var lang in Ardublockly.LANGUAGE_NAME) {
+ var option = new Option(Ardublockly.LANGUAGE_NAME[lang], lang);
+ if (lang == selectedLang) {
+ option.selected = true;
+ }
+ languageMenu.options.add(option);
+ }
+ languageMenu.onchange = Ardublockly.changeLanguage;
+};
+
+/**
+ * Because new languages are injected by overwriting Ardublockly.LOCALISED_TEXT
+ * we keep a local copy of the default language (included in the html header) so
+ * that we can still retrieve these strings if the translation cannot be found.
+ */
+Ardublockly.duplicateDefaultLang = function() {
+ for (var textId in Ardublockly.LOCALISED_TEXT) {
+ Ardublockly.DEFAULT_LANG_TEXT[textId] = Ardublockly.LOCALISED_TEXT[textId];
+ }
+};
+
+/** Updates the page text strings with the new language. */
+Ardublockly.updateLanguageText = function() {
+ for (var textId in Ardublockly.LOCALISED_TEXT) {
+ var textStrings = document.getElementsByClassName('translatable_' + textId);
+ for (var i = 0; i < textStrings.length; i++) {
+ textStrings[i].innerHTML = Ardublockly.getLocalStr(textId);
+ }
+ }
+};
+
+/**
+ * Injects the language JavaScript files into the html head element.
+ * @param {string} langKey Dictionary key for the language to inject, must also
+ * be JS file name.
+ */
+Ardublockly.injectLanguageJsSources = function(langKey) {
+ var head = document.getElementsByTagName('head')[0];
+
+ // Retrieve and inject Ardublockly translations synchronously
+ var appLangJsLoad = document.createElement('script');
+ var request = ArdublocklyServer.createRequest();
+ var appLangJdPath = 'msg/' + langKey + '.js';
+ try {
+ request.open('GET', appLangJdPath, false);
+ request.send('');
+ appLangJsLoad.text = request.responseText;
+ } catch (e) {
+ // Display an alert to indicate we cannot load languages
+ Ardublockly.alertMessage(
+ Ardublockly.getLocalStr('noServerTitle'),
+ Ardublockly.getLocalStr('noServerNoLangBody'),
+ false);
+ // But still asynchronous lazy load so at least some text gets translated
+ appLangJsLoad.src = appLangJdPath;
+ }
+ head.appendChild(appLangJsLoad);
+
+ // Retrieve and inject Blockly translations asynchronously
+ var blocklyLangJsLoad = document.createElement('script');
+ blocklyLangJsLoad.src = '../blockly/msg/js/' + langKey + '.js';
+ head.appendChild(blocklyLangJsLoad);
+};
+
+/** Saves the blocks and reloads with a different language. */
+Ardublockly.changeLanguage = function() {
+ // Store the blocks for the duration of the reload only
+ Ardublockly.saveSessionStorageBlocks();
+
+ var languageMenu = document.getElementById('language');
+ var newLang = encodeURIComponent(
+ languageMenu.options[languageMenu.selectedIndex].value);
+ var search = window.location.search;
+ if (search.length <= 1) {
+ search = '?lang=' + newLang;
+ } else if (search.match(/[?&]lang=[^&]*/)) {
+ search = search.replace(/([?&]lang=)[^&]*/, '$1' + newLang);
+ } else {
+ search = search.replace(/\?/, '?lang=' + newLang + '&');
+ }
+
+ window.location = window.location.protocol + '//' +
+ window.location.host + window.location.pathname + search;
+};
+
+/**
+ * Finds and returns the requests string in the localised language.
+ * If the translation is not returned, it fetches the original language string.
+ * @param {string} stringId
+ * @return {!string} The localised, original, or an empty string.
+ */
+Ardublockly.getLocalStr = function(stringId) {
+ var text = Ardublockly.LOCALISED_TEXT[stringId];
+ if (!text) {
+ console.log('Localised text string ID "' + stringId + '" does not exists!');
+ }
+ return text || Ardublockly.DEFAULT_LANG_TEXT[stringId] || '';
+};
diff --git a/ardublockly/msg/de.js b/ardublockly/msg/de.js
new file mode 100644
index 0000000000..7e8da9ba08
--- /dev/null
+++ b/ardublockly/msg/de.js
@@ -0,0 +1,105 @@
+var Ardublockly = Ardublockly || {};
+Ardublockly.LOCALISED_TEXT = {
+ translationLanguage: "Deutsch",
+ title: "Ardublockly",
+ blocks: "Blöcke",
+ /* Menu */
+ open: "Öffnen",
+ save: "Speichern",
+ deleteAll: "Alles löschen",
+ settings: "Einstellungen",
+ documentation: "Dokumentation",
+ reportBug: "Fehler melden",
+ examples: "Beispiele",
+ /* Settings */
+ compilerLocation: "Pfad zum Compiler",
+ compilerLocationDefault: "Pfad zum Compiler unbekannt",
+ sketchFolder: "Sketch Ordner",
+ sketchFolderDefault: "Sketch Ordner unbekannt",
+ arduinoBoard: "Arduino Board",
+ arduinoBoardDefault: "Arduino Board unbekannt",
+ comPort: "COM Port",
+ comPortDefault: "COM Port unbekannt",
+ defaultIdeButton: "Standard IDE Schaltfläche",
+ defaultIdeButtonDefault: "Standardaktion für IDE Schaltfläche unbekannt",
+ language: "Sprache",
+ languageDefault: "Sprache unbekannt",
+ sketchName: "Sketch Name",
+ /* Arduino console output */
+ arduinoOpMainTitle: "Arduino IDE Ausgabe",
+ arduinoOpWaiting: "Wartet auf IDE Ausgabe...",
+ arduinoOpUploadedTitle: "Sketch erfolgreich hochgeladen",
+ arduinoOpVerifiedTitle: "Sketch erfolgreich geprüft",
+ arduinoOpOpenedTitle: "Sketch in IDE geöffnet",
+ arduinoOpOpenedBody: "Der Sketch sollte in der Arduino IDE geöffnet worden sein.",
+ arduinoOpErrorTitle: "Ein Fehler ist aufgetreten",
+ arduinoOpErrorIdContext_0: "Kein Fehler.",
+ arduinoOpErrorIdContext_1: "Compilieren oder Hochladen fehlgeschlagen.",
+ arduinoOpErrorIdContext_2: "Sketch wurde nicht gefunden.",
+ arduinoOpErrorIdContext_3: "Ungültiges Befehlszeilen Argument.",
+ arduinoOpErrorIdContext_4: "Preference-Flag welcher an 'get-pref' übergeben wurde existiert nicht.",
+ arduinoOpErrorIdContext_5: "Unklarer Fehler, aber Arduino IDE wirft diesen Fehler manchmal.",
+ arduinoOpErrorIdContext_50: "Unerwarteter Fehlercode der Arduino IDE",
+ arduinoOpErrorIdContext_51: "Sketch Datei konnte nicht erstellt werden",
+ arduinoOpErrorIdContext_52: "Ungültiger Pfad zur intern erstellen Sketch-Datei",
+ arduinoOpErrorIdContext_53: "Arduino IDE kann nicht gefunden werden
" +
+ "Der Pfad zum Compiler wurde nicht korrekt festgelegt.
" +
+ "Bitte vergewissern sie sich, dass der Pfad in den Einstellungen korrekt festgelegt wurde.",
+ arduinoOpErrorIdContext_54: "Was sollen wir mit dem Sketch machen?
" +
+ "Die Standardaktion zum Öffnen der IDE wurde nicht gesetzt.
" +
+ "Bitte wähle eine Standardaktion für die IDE in den Einstellungen.",
+ arduinoOpErrorIdContext_55: "Serieller Port nicht verfügbar
" +
+ "Der serielle Port ist nicht verfügbar.
" +
+ "Bitte prüfe ob der Arduino korrekt an den PC angeschlossen ist und der Pfad in den Einstellungen korrekt gewählt wurde.",
+ arduinoOpErrorIdContext_56: "Unbekanntes Arduino Board
" +
+ "Das Arduino Board wurde nicht ausgewählt.
" +
+ "Bitte wähle das passende Arduino Board in den Einstellungen.",
+ arduinoOpErrorIdContext_52: "Unerwarteter Serverfehler.",
+ arduinoOpErrorIdContext_64: "JSON konnte nicht geparsed werden.",
+ arduinoOpErrorUnknown: "Unerwarteter Fehler",
+ /* Modals */
+ noServerTitle: "Ardublockly App läuft nicht",
+ noServerTitleBody: "
Damit alle Ardublockly Features funktionieren, muss die Ardublockly Desktop App lokal auf ihrem Computer laufen.
" + + "Falls sie eine Onlineversion nutzen, können sie weder die Einstellungen verändern, noch den Code der Blöcke auf den Arduino laden.
" + + "Installations-Anweisungen können in der Ardublockly Repository nachgelesen werden.
" + + "Sollte Ardublockly bereits installiert worden sein, vergewissern sie sich, dass die Anwendung korrekt läuft.
", + noServerNoLangBody: "Wenn die Ardublockly Desktopp App nicht läuft, kann die Sprache nicht vollständig gewechselt werden.", + addBlocksTitle: "Zusätzliche Blöcke", + /* Alerts */ + loadNewBlocksTitle: "Neue Blöcke laden?", + loadNewBlocksBody: "Das Laden einer neuen XML Datei überschreibt die aktuellen Blöcke im Arbeitsbereich.