From f3e29ecd9bd5252427698accabb6815b817c311f Mon Sep 17 00:00:00 2001 From: WebFreak001 Date: Sat, 24 Dec 2016 01:18:48 +0100 Subject: [PATCH 1/6] Mostly allowing translations now & added german --- package.json | 95 ++++++++++++++-------------- package.nls.de.json | 96 ++++++++++++++++++++++++++++ package.nls.json | 96 ++++++++++++++++++++++++++++ src/extension.ts | 6 ++ src/workspace-d.ts | 151 ++++++++++++++++++++++++-------------------- 5 files changed, 330 insertions(+), 114 deletions(-) create mode 100644 package.nls.de.json create mode 100644 package.nls.json diff --git a/package.json b/package.json index 73240cc..c70c891 100644 --- a/package.json +++ b/package.json @@ -144,7 +144,7 @@ "d.workspacedPath": { "type": "string", "default": "workspace-d", - "description": "Path of the workspace-d executable. Path can be omitted if in $PATH or installed using code-d" + "description": "%d.config.workspacedPath%" }, "d.stdlibPath": { "type": "array", @@ -155,57 +155,57 @@ "/usr/include/dmd/druntime/import", "/usr/include/dmd/phobos" ], - "description": "Array of paths to phobos and D runtime for automatic inclusion for auto completion" + "description": "%d.config.stdlibPath%" }, "d.dcdClientPath": { "type": "string", "default": "dcd-client", - "description": "Path of the dcd-client executable. Path can be omitted if in $PATH or installed using code-d" + "description": "%d.config.dcdClientPath%" }, "d.dcdServerPath": { "type": "string", "default": "dcd-server", - "description": "Path of the dcd-server executable. Path can be omitted if in $PATH or installed using code-d" + "description": "%d.config.dcdServerPath%" }, "d.dscannerPath": { "type": "string", "default": "dscanner", - "description": "Path of the dscanner executable. Path can be omitted if in $PATH or installed using code-d" + "description": "%d.config.dscannerPath%" }, "d.dfmtPath": { "type": "string", "default": "dfmt", - "description": "Path of the dfmt executable. Path can be omitted if in $PATH or installed using code-d" + "description": "%d.config.dfmtPath%" }, "d.dubPath": { "type": "string", "default": "dub", - "description": "Path of the dub executable. Path can be omitted if in $PATH or installed using code-d" + "description": "%d.config.dubPath%" }, "d.enableLinting": { "type": "boolean", "default": true, - "description": "If code-d should watch for file saves and report static analysis. Might interfere with other lint plugins or settings." + "description": "%d.config.enableLinting%" }, "d.enableSDLLinting": { "type": "boolean", "default": true, - "description": "If code-d should report errors in your dub.sdl file." + "description": "%d.config.enableSDLLinting%" }, "d.enableDubLinting": { "type": "boolean", "default": true, - "description": "If code-d should build on save to check for compile errors." + "description": "%d.config.enableDubLinting%" }, "d.enableAutoComplete": { "type": "boolean", "default": true, - "description": "Start dcd-server at startup and complete using dcd-client." + "description": "%d.config.enableAutoComplete%" }, "d.neverUseDub": { "type": "boolean", "default": false, - "description": "If this is true then a custom workspace where you manually provide the import paths will always be used instead of dub. See d.projectImportPaths for setting import paths then. This is discouraged as it will remove most features like packages, building & compiler linting. If this is a standalone project with no external dependencies with a custom build system then this should be true." + "description": "%d.config.neverUseDub%" }, "d.projectImportPaths": { "type": "array", @@ -213,38 +213,38 @@ "type": "string" }, "default": [], - "description": "Setting for import paths in your workspace if not using dub. This will replace other paths. Its recommended to set this in your workspace settings instead of your user settings to keep it separate for each project." + "description": "%d.config.projectImportPaths%" }, "d.dubConfiguration": { "type": "string", - "description": "Sets the default configuration to use when starting up" + "description": "%d.config.dubConfiguration%" }, "d.dubArchType": { "type": "string", - "description": "Sets the default arch type to use when starting up" + "description": "%d.config.dubArchType%" }, "d.dubBuildType": { "type": "string", - "description": "Sets the default build type to use when starting up" + "description": "%d.config.dubBuildType%" }, "d.dubCompiler": { "type": "string", - "description": "Sets the default compiler to use when starting up" + "description": "%d.config.dubCompiler%" }, "d.disableWorkspaceD": { "type": "boolean", "default": false, - "description": "Disables most code-d features. Intended for debugging/working on new features with lots of vscode restarts" + "description": "%d.config.disableWorkspaceD%" }, "d.overrideDfmtEditorconfig": { "type": "boolean", "default": true, - "description": "Uses dfmt config options & vscode editor config instead of .editorconfig because dfmt seems to be quite buggy with them." + "description": "%d.config.overrideDfmtEditorconfig%" }, "dfmt.alignSwitchStatements": { "type": "boolean", "default": true, - "description": "Not yet implemented (on dfmt side)" + "description": "%d.config.dfmt.alignSwitchStatements%" }, "dfmt.braceStyle": { "type": "string", @@ -254,32 +254,32 @@ "stroustrup" ], "default": "allman", - "description": "See Wikipedia https://en.wikipedia.org/wiki/Brace_style" + "description": "%d.config.dfmt.braceStyle%" }, "dfmt.outdentAttributes": { "type": "boolean", "default": true, - "description": "Not yet implemented (on dfmt side)" + "description": "%d.config.dfmt.outdentAttributes%" }, "dfmt.spaceAfterCast": { "type": "boolean", "default": true, - "description": "Insert space after the closing paren of a cast expression." + "description": "%d.config.dfmt.spaceAfterCast%" }, "dfmt.splitOperatorAtLineEnd": { "type": "boolean", "default": false, - "description": "Place operators on the end of the previous line when splitting lines." + "description": "%d.config.dfmt.splitOperatorAtLineEnd%" }, "dfmt.selectiveImportSpace": { "type": "boolean", "default": true, - "description": "Insert space after the module name and before the : for selective imports." + "description": "%d.config.dfmt.selectiveImportSpace%" }, "dfmt.compactLabeledStatements": { "type": "boolean", "default": true, - "description": "Place labels on the same line as the labeled switch, for, foreach, or while statement." + "description": "%d.config.dfmt.compactLabeledStatements%" }, "dfmt.templateConstraintStyle": { "type": "string", @@ -290,7 +290,7 @@ "always_newline_indent" ], "default": "conditional_newline_indent", - "description": "Control the formatting of template constraints." + "description": "%d.config.dfmt.templateConstraintStyle%" } } }, @@ -318,71 +318,71 @@ "commands": [ { "command": "code-d.switchConfiguration", - "title": "code-d: Switch Configuration" + "title": "%d.switchConfiguration%" }, { "command": "code-d.switchArchType", - "title": "code-d: Switch Arch Type" + "title": "%d.switchArchType%" }, { "command": "code-d.switchBuildType", - "title": "code-d: Switch Build Type" + "title": "%d.switchBuildType%" }, { "command": "code-d.switchCompiler", - "title": "code-d: Switch Compiler" + "title": "%d.switchCompiler%" }, { "command": "code-d.killServer", - "title": "code-d: Kill DCD Server" + "title": "%d.killServer%" }, { "command": "code-d.restartServer", - "title": "code-d: Restart DCD Server" + "title": "%d.restartServer%" }, { "command": "code-d.reloadImports", - "title": "code-d: Reload import paths" + "title": "%d.reloadImports%" }, { "command": "code-d.run", - "title": "code-d: Run project" + "title": "%d.run%" }, { "command": "code-d.build", - "title": "code-d: Build project" + "title": "%d.build%" }, { "command": "code-d.stop", - "title": "code-d: Stop project" + "title": "%d.stop%" }, { "command": "code-d.debug", - "title": "code-d: Debug project using code-debug" + "title": "%d.debug%" }, { "command": "code-d.uploadSelection", - "title": "code-d: Upload selection to dpaste.com" + "title": "%d.uploadSelection%" }, { "command": "code-d.insertDscanner", - "title": "code-d: Insert default dscanner.ini content" + "title": "%d.insertDscanner%" }, { "command": "code-d.rdmdCurrent", - "title": "Run document using rdmd" + "title": "%d.rdmdCurrent%" }, { "command": "code-d.generateCoverageReport", - "title": "code-d: Generate coverage report" + "title": "%d.generateCoverageReport%" }, { "command": "code-d.showGCCalls", - "title": "code-d: Show GC calls from profilegc.log" + "title": "%d.showGCCalls%" }, { "command": "dub.openSettingsEditor", - "title": "code-d/dub: Open project settings", + "title": "%dub.openSettingsEditor%", "icon": { "light": "./images/edit-dub-inverse.svg", "dark": "./images/edit-dub.svg" @@ -390,7 +390,7 @@ }, { "command": "dub.closeSettingsEditor", - "title": "code-d/dub: Close project settings", + "title": "%dub.closeSettingsEditor%", "icon": { "light": "./images/edit-source-inverse.svg", "dark": "./images/edit-source.svg" @@ -398,7 +398,7 @@ }, { "command": "code-d.createProject", - "title": "code-d: Create new Project" + "title": "%d.createProject%" } ], "jsonValidation": [ @@ -421,7 +421,8 @@ "async": "^2.1.2", "ncp": "^2.0.0", "rmdir": "^1.2.0", - "line-by-line": "^0.1.5" + "line-by-line": "^0.1.5", + "vscode-nls": "^2.0.1" }, "devDependencies": { "typescript": "^2.0.6", diff --git a/package.nls.de.json b/package.nls.de.json new file mode 100644 index 0000000..959b4a0 --- /dev/null +++ b/package.nls.de.json @@ -0,0 +1,96 @@ +{ + "d.switchConfiguration": "code-d: Konfiguration ändern", + "d.action.switchConfiguration": "Konfiguration ändern", + "d.switchArchType": "code-d: Architektur ändern", + "d.action.switchArchType": "Architektur ändern", + "d.switchBuildType": "code-d: Build Type ändern", + "d.action.switchBuildType": "Build Type ändern", + "d.switchCompiler": "code-d: Compiler ändern", + "d.action.switchCompiler": "Compiler ändern", + "d.killServer": "code-d: DCD Server zwangshaft beenden", + "d.action.killServer": "DCD Server zwangshaft beenden", + "d.restartServer": "code-d: DCD Server neustarten", + "d.action.restartServer": "DCD Server neustarten", + "d.reloadImports": "code-d: Import Pfäde neuladen", + "d.action.reloadImports": "Import Pfäde neuladen", + "d.run": "code-d: Projekt Ausführen", + "d.action.run": "Projekt Ausführen", + "d.build": "code-d: Projekt Erstellen", + "d.action.build": "Projekt Erstellen", + "d.stop": "code-d: Ausführung Stoppen", + "d.action.stop": "Ausführung Stoppen", + "d.debug": "code-d: Projekt mit code-debug debuggen", + "d.action.debug": "Projekt mit code-debug debuggen", + "d.uploadSelection": "code-d: Auswahl auf dpaste.com hochladen", + "d.action.uploadSelection": "Auswahl auf dpaste.com hochladen", + "d.insertDscanner": "code-d: Vorgefertigte dscanner.ini Datei einfügen", + "d.action.insertDscanner": "Vorgefertigte dscanner.ini Datei einfügen", + "d.rdmdCurrent": "Aktuelles Dokument mit rdmd ausführen", + "d.generateCoverageReport": "code-d: Bericht aus Testabdeckung generieren", + "d.action.generateCoverageReport": "Bericht aus Testabdeckung generieren", + "d.showGCCalls": "code-d: GC Aufrufe aus profilegc.log anzeigen", + "d.action.showGCCalls": "GC Aufrufe aus profilegc.log anzeigen", + "dub.openSettingsEditor": "code-d/dub: Projekteinstellungen öffnen", + "dub.action.openSettingsEditor": "Projekteinstellungen öffnen", + "dub.closeSettingsEditor": "code-d/dub: Projekteinstellungen schließen", + "dub.action.closeSettingsEditor": "Projekteinstellungen schließen", + "d.createProject": "code-d: Neues Projekt erstellen", + "d.action.createProject": "Neues Projekt erstellen", + + "d.config.workspacedPath": "Pfad zur ausführbaren workspace-d Datei. Kann leer gelassen werden wenn Datei im PATH enthalten ist oder über code-d installiert wurde.", + "d.config.stdlibPath": "Liste an Pfäden für phobos und D runtime für Autovervollständigung", + "d.config.dcdClientPath": "Pfad zur ausführbaren dcd-client Datei. Kann leer gelassen werden wenn Datei im PATH enthalten ist oder über code-d installiert wurde.", + "d.config.dcdServerPath": "Pfad zur ausführbaren dcd-server Datei. Kann leer gelassen werden wenn Datei im PATH enthalten ist oder über code-d installiert wurde.", + "d.config.dscannerPath": "Pfad zur ausführbaren dscanner Datei. Kann leer gelassen werden wenn Datei im PATH enthalten ist oder über code-d installiert wurde.", + "d.config.dfmtPath": "Pfad zur ausführbaren dfmt Datei. Kann leer gelassen werden wenn Datei im PATH enthalten ist oder über code-d installiert wurde.", + "d.config.dubPath": "Pfad zur ausführbaren dub Datei. Kann leer gelassen werden wenn Datei im PATH enthalten ist oder über code-d installiert wurde.", + "d.config.enableLinting": "true wenn code-d beim Datei Speichern Fehlermeldungen anzeigen soll. Könnte mit anderen D plugins oder tasks kollidieren.", + "d.config.enableSDLLinting": "true wenn code-d beim Speichern einer dub.sdl Datei Fehlermeldungen anzeigen soll.", + "d.config.enableDubLinting": "true wenn code-d beim Datei Speichern das Projekt erstellen soll um compiler Fehler zu finden.", + "d.config.enableAutoComplete": "true wenn dcd-server in D Projekten gestartet werden soll und dcd-client für die Autovervollständigung genutzt werden soll.", + "d.config.neverUseDub": "Wenn der Wert true ist wwerden benutzerdefinierte Pfäde über die d.projectImportPaths Einstellung verwendet und dub wird ignoriert. Für dub Projekte nicht empfohlen, da es die meisten Features wie Erstellen & Compiler Fehler deaktiviert. Für Projekte mit anderen Buildsystemen als dub ist diese Einstellung jedoch empfohlen.", + "d.config.projectImportPaths": "Ersetzt import Pfäde wenn dub nicht genutzt wird. Es ist empfohlen diese Einstellung in den Arbeitsbereichseinstellungen zu setzen.", + "d.config.dubConfiguration": "Ändert die standard dub Konfiguration beim Start", + "d.config.dubArchType": "Ändert die standard dub Architektur beim Start", + "d.config.dubBuildType": "Ändert den standard dub Build Type beim Start", + "d.config.dubCompiler": "Ändert den standard dub Compiler beim Start", + "d.config.disableWorkspaceD": "Deaktiviert die meisten code-d features. Genutzt für die Entwicklung am code-d plugin mit vielen Neustarts.", + "d.config.overrideDfmtEditorconfig": "vscode dfmt Einstellungen statt .editorconfig Datei nutzen. Empfohlen da dfmt oft Probleme mit der editorconfig hat.", + "d.config.dfmt.alignSwitchStatements": "Noch nicht von dfmt implementiert", + "d.config.dfmt.braceStyle": "Siehe Wikipedia https://de.wikipedia.org/wiki/Einr%C3%BCckungsstil (1TBS, Allman, Stroustrup)", + "d.config.dfmt.outdentAttributes": "Noch nicht von dfmt implementiert", + "d.config.dfmt.spaceAfterCast": "Leerzeichen nach schließender Klammer von einer Cast Anweisung einfügen.", + "d.config.dfmt.splitOperatorAtLineEnd": "Operatoren am Zeilenende platzieren wenn Zeile geteilt wird.", + "d.config.dfmt.selectiveImportSpace": "Nach Modulnamen und selektiven Imports mit : ein Leerzeichen einfügen.", + "d.config.dfmt.compactLabeledStatements": "Labels auf die gleiche Zeile wie das betroffene switch, for, foreach oder while Statement schieben.", + "d.config.dfmt.templateConstraintStyle": "Formatierung von Template Constraints einstellen.", + + "d.ext.openUserSettings": "Benutzereinstellungen öffnen", + "d.ext.workspacedENOENT": "workspace-d ist nicht installed oder Einstellung zeigt auf einen Ordner", + "d.ext.workspacedENOENT.retry": "Wiederholen", + "d.ext.workspacedENOENT.install": "workspace-d installieren", + "d.ext.workspacedCrash": "workspace-d ist abgestürtzt. Falls der dcd-server Prozess noch läuft, bitte töten!", + "d.ext.workspaced.restart": "Neustarten", + "d.ext.importModule": "{0} importieren", + "d.ext.noImportPaths.project": "Keine Import Pfäde für dieses Projekt. Autovervollständigung könnte nicht funktionieren!", + "d.ext.noImportPaths.buildType": "Keine Import Pfäde für diesen Build Type. Autovervollständigung könnte nicht funktionieren!", + "d.ext.noConfigurations.project": "Keine Konfigurationen für dieses Projekt gefunden. Autovervollständigung könnte nicht funktionieren!", + "d.ext.compilerFail": "Compiler konnte nicht gewechselt werden", + "d.ext.archFail": "Architektur konnte nicht gewechselt werden", + "d.ext.ultimateArchFail": "Architektur konnte nicht gewechselt werden. In die Entwicklertools umschalten für Details.", + "d.ext.dcdUpdateFail": "Konnte DCD nicht anpassen. Bitte DCD neustarten falls es nicht korrekt funktioniert", + "d.ext.workspacedUnresponsive": "workspace-d reagiert nicht mehr. Autovervollständigung könnte nicht funktionieren!", + "d.ext.workspacedUnkillable": "workspace-d konnte nicht beendet werden. Bitte schließen Sie es manuell! PID: {0}", + "d.ext.workspacedOutdated.major": "workspace-d ist nicht mehr aktuell! Bitte updaten um das Plugin weiter zu benutzen. (erwartet={0}, workspaced={1})", + "d.ext.workspacedOutdated.minor": "workspace-d könnte nicht mehr aktuell sein! Bitte updaten wenn etwas nicht funktioniert wie erwartet. (erwartet={0}, workspaced={1})", + "d.ext.workspacedOutdated.patch": "workspace-d hat ein neues optionales Update! Bitte updaten vor dem Senden von Bug Reports. (erwartet={0}, workspaced={1})", + "d.ext.workspacedOutdated.unknown": "Konnte nicht die workspace-d version identifizieren. Bitte workspace-d updaten!", + "d.ext.workspacedOutdated.install": "Neuste Version installieren", + "d.ext.config.invalid.configuration": "Die Konfiguration '{0}' welche in den Einstellungen angegeben wurde, wurde nicht gefunden!", + "d.ext.config.invalid.archType": "Die Architektur '{0}' welche in den Einstellungen angegeben wurde, wurde nicht gefunden!", + "d.ext.config.invalid.buildType": "Der Build Type '{0}' welcher in den Einstellungen angegeben wurde, wurde nicht gefunden!", + "d.ext.config.invalid.compiler": "Der Compiler '{0}' welcher in den Einstellungen angegeben wurde, wurde nicht gefunden!", + "d.ext.dubFail": "Konnte dub nicht starten. Funktionalität begrenzt!", + "d.ext.fsworkspaceFail": "Konnte fsworkspace nicht starten. In die Entwicklertools umschalten für Details.", + "d.ext.dcdFail": "Konnte DCD nicht starten. In die Entwicklertools umschalten für Details." +} \ No newline at end of file diff --git a/package.nls.json b/package.nls.json new file mode 100644 index 0000000..38fd56d --- /dev/null +++ b/package.nls.json @@ -0,0 +1,96 @@ +{ + "d.switchConfiguration": "code-d: Switch Configuration", + "d.action.switchConfiguration": "Switch Configuration", + "d.switchArchType": "code-d: Switch Arch Type", + "d.action.switchArchType": "Switch Arch Type", + "d.switchBuildType": "code-d: Switch Build Type", + "d.action.switchBuildType": "Switch Build Type", + "d.switchCompiler": "code-d: Switch Compiler", + "d.action.switchCompiler": "Switch Compiler", + "d.killServer": "code-d: Kill DCD Server", + "d.action.killServer": "Kill DCD Server", + "d.restartServer": "code-d: Restart DCD Server", + "d.action.restartServer": "Restart DCD Server", + "d.reloadImports": "code-d: Reload import paths", + "d.action.reloadImports": "Reload import paths", + "d.run": "code-d: Run project", + "d.action.run": "Run project", + "d.build": "code-d: Build project", + "d.action.build": "Build project", + "d.stop": "code-d: Stop project", + "d.action.stop": "Stop project", + "d.debug": "code-d: Debug project using code-debug", + "d.action.debug": "Debug project using code-debug", + "d.uploadSelection": "code-d: Upload selection to dpaste.com", + "d.action.uploadSelection": "Upload selection to dpaste.com", + "d.insertDscanner": "code-d: Insert default dscanner.ini content", + "d.action.insertDscanner": "Insert default dscanner.ini content", + "d.rdmdCurrent": "Run document using rdmd", + "d.generateCoverageReport": "code-d: Generate coverage report", + "d.action.generateCoverageReport": "Generate coverage report", + "d.showGCCalls": "code-d: Show GC calls from profilegc.log", + "d.action.showGCCalls": "Show GC calls from profilegc.log", + "dub.openSettingsEditor": "code-d/dub: Open project settings", + "dub.action.openSettingsEditor": "Open project settings", + "dub.closeSettingsEditor": "code-d/dub: Close project settings", + "dub.action.closeSettingsEditor": "Close project settings", + "d.createProject": "code-d: Create new Project", + "d.action.createProject": "Create new Project", + + "d.config.workspacedPath": "Path of the workspace-d executable. Path can be omitted if in $PATH or installed using code-d", + "d.config.stdlibPath": "Array of paths to phobos and D runtime for automatic inclusion for auto completion", + "d.config.dcdClientPath": "Path of the dcd-client executable. Path can be omitted if in $PATH or installed using code-d", + "d.config.dcdServerPath": "Path of the dcd-server executable. Path can be omitted if in $PATH or installed using code-d", + "d.config.dscannerPath": "Path of the dscanner executable. Path can be omitted if in $PATH or installed using code-d", + "d.config.dfmtPath": "Path of the dfmt executable. Path can be omitted if in $PATH or installed using code-d", + "d.config.dubPath": "Path of the dub executable. Path can be omitted if in $PATH or installed using code-d", + "d.config.enableLinting": "If code-d should watch for file saves and report static analysis. Might interfere with other lint plugins or settings.", + "d.config.enableSDLLinting": "If code-d should report errors in your dub.sdl file.", + "d.config.enableDubLinting": "If code-d should build on save to check for compile errors.", + "d.config.enableAutoComplete": "Start dcd-server at startup and complete using dcd-client.", + "d.config.neverUseDub": "If this is true then a custom workspace where you manually provide the import paths will always be used instead of dub. See d.projectImportPaths for setting import paths then. This is discouraged as it will remove most features like packages, building & compiler linting. If this is a standalone project with no external dependencies with a custom build system then this should be true.", + "d.config.projectImportPaths": "Setting for import paths in your workspace if not using dub. This will replace other paths. Its recommended to set this in your workspace settings instead of your user settings to keep it separate for each project.", + "d.config.dubConfiguration": "Sets the default configuration to use when starting up", + "d.config.dubArchType": "Sets the default arch type to use when starting up", + "d.config.dubBuildType": "Sets the default build type to use when starting up", + "d.config.dubCompiler": "Sets the default compiler to use when starting up", + "d.config.disableWorkspaceD": "Disables most code-d features. Intended for debugging/working on new features with lots of vscode restarts", + "d.config.overrideDfmtEditorconfig": "Uses dfmt config options & vscode editor config instead of .editorconfig because dfmt seems to be quite buggy with them.", + "d.config.dfmt.alignSwitchStatements": "Not yet implemented (on dfmt side)", + "d.config.dfmt.braceStyle": "See Wikipedia https://en.wikipedia.org/wiki/Brace_style", + "d.config.dfmt.outdentAttributes": "Not yet implemented (on dfmt side)", + "d.config.dfmt.spaceAfterCast": "Insert space after the closing paren of a cast expression.", + "d.config.dfmt.splitOperatorAtLineEnd": "Place operators on the end of the previous line when splitting lines.", + "d.config.dfmt.selectiveImportSpace": "Insert space after the module name and before the : for selective imports.", + "d.config.dfmt.compactLabeledStatements": "Place labels on the same line as the labeled switch, for, foreach, or while statement.", + "d.config.dfmt.templateConstraintStyle": "Control the formatting of template constraints.", + + "d.ext.openUserSettings": "Open User Settings", + "d.ext.workspacedENOENT": "workspace-d is not installed or points to a folder", + "d.ext.workspacedENOENT.retry": "Retry", + "d.ext.workspacedENOENT.install": "Install workspace-d", + "d.ext.workspacedCrash": "workspace-d crashed. Please kill dcd-server if neccessary!", + "d.ext.workspaced.restart": "Restart", + "d.ext.importModule": "Import {0}", + "d.ext.noImportPaths.project": "No import paths available for this project. Autocompletion could be broken!", + "d.ext.noImportPaths.buildType": "No import paths available for this Build Type. Autocompletion could be broken!", + "d.ext.noConfigurations.project": "No configurations available for this project. Autocompletion could be broken!", + "d.ext.compilerFail": "Could not switch compiler", + "d.ext.archFail": "Could not switch arch type", + "d.ext.ultimateArchFail": "Failed to switch arch type. See console for details.", + "d.ext.dcdUpdateFail": "Could not update DCD. Please restart DCD if its not working properly", + "d.ext.workspacedUnresponsive": "workspace-d is unresponsive. Auto completion could be broken!", + "d.ext.workspacedUnkillable": "Could not kill workspace-d. Please manually kill it! PID: {0}", + "d.ext.workspacedOutdated.major": "workspace-d is outdated! Please update to continue using this plugin. (target={0}, workspaced={1})", + "d.ext.workspacedOutdated.minor": "workspace-d might be outdated! Please update if things are not working as expected. (target={0}, workspaced={1})", + "d.ext.workspacedOutdated.patch": "workspace-d has a new optional update! Please update before submitting a bug report. (target={0}, workspaced={1})", + "d.ext.workspacedOutdated.unknown": "Could not identify workspace-d version. Please update workspace-d!", + "d.ext.workspacedOutdated.install": "Install newest version", + "d.ext.config.invalid.configuration": "Configuration '{0}' which is specified in the config is not available!", + "d.ext.config.invalid.archType": "Arch Type '{0}' which is specified in the config is not available!", + "d.ext.config.invalid.buildType": "Build Type '{0}' which is specified in the config is not available!", + "d.ext.config.invalid.compiler": "Compiler '{0}' which is specified in the config is not available!", + "d.ext.dubFail": "Could not initialize dub. Falling back to limited functionality!", + "d.ext.fsworkspaceFail": "Could not initialize fsworkspace. See console for details!", + "d.ext.dcdFail": "Could not initialize DCD. See console for details!" +} \ No newline at end of file diff --git a/src/extension.ts b/src/extension.ts index aa88d8c..2d68f58 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -6,6 +6,7 @@ import { uploadCode } from "./util" import * as statusbar from "./statusbar" import * as path from "path" import * as fs from "fs" +import * as nls from "vscode-nls" import { DlangUIHandler } from "./dlangui" import { lintDfmt } from "./dfmt-check" import { GCProfiler } from "./gcprofiler" @@ -22,6 +23,8 @@ let oldLint: [vscode.Uri, vscode.Diagnostic[]][][] = [[], [], []]; var extensionContext: vscode.ExtensionContext; +export var localize: nls.LocalizeFunc = (key, fallback) => { return fallback; }; + export function config() { return vscode.workspace.getConfiguration("d"); } @@ -29,6 +32,9 @@ export function config() { export function activate(context: vscode.ExtensionContext) { extensionContext = context; setContext(context); + console.log(vscode.env.language); + console.log(context.asAbsolutePath("package")); + localize = nls.config({ locale: vscode.env.language })(context.asAbsolutePath("package")); if (context.globalState.get("restorePackageBackup", false)) { context.globalState.update("restorePackageBackup", false); diff --git a/src/workspace-d.ts b/src/workspace-d.ts index 2bfbb41..c562a6c 100644 --- a/src/workspace-d.ts +++ b/src/workspace-d.ts @@ -5,7 +5,7 @@ import * as fs from "fs" import { EventEmitter } from "events" import { DlangUIHandler } from "./dlangui" import { installWorkspaceD } from "./installer" -import { config } from "./extension" +import { config, localize } from "./extension" var async = require("async"); var LineByLineReader = require('line-by-line'); @@ -92,21 +92,25 @@ export class WorkspaceD extends EventEmitter implements console.log("WorkspaceD ended with an error:"); console.log(err); if (err && (err).code == "ENOENT") { - vscode.window.showErrorMessage("workspace-d is not installed or points to a folder", "Install workspace-d", "Open User Settings", "Retry").then(s => { - if (s == "Retry") - self.startWorkspaceD.call(self); - else if (s == "Open User Settings") - vscode.commands.executeCommand("workbench.action.openGlobalSettings"); - else if (s == "Install workspace-d") - installWorkspaceD(self.processEnv); - }); + vscode.window.showErrorMessage( + localize("d.ext.workspacedENOENT", "workspace-d is not installed or points to a folder"), + localize("d.ext.workspacedENOENT.install", "Install workspace-d"), + localize("d.ext.openUserSettings", "Open User Settings"), + localize("d.ext.workspacedENOENT.retry", "Retry")).then(s => { + if (s == localize("d.ext.workspacedENOENT.retry", "Retry")) + self.startWorkspaceD.call(self); + else if (s == localize("d.ext.openUserSettings", "Open User Settings")) + vscode.commands.executeCommand("workbench.action.openGlobalSettings"); + else if (s == localize("d.ext.workspacedENOENT.install", "Install workspace-d")) + installWorkspaceD(self.processEnv); + }); self.workspaced = false; } }); this.instance.on("exit", function (code) { console.log("WorkspaceD ended with code " + code); - vscode.window.showWarningMessage("Workspace-D crashed. Please kill dcd-server if neccessary!", "Restart").then(s => { - if (s == "Restart") + vscode.window.showWarningMessage(localize("d.ext.workspacedCrash", "workspace-d crashed. Please kill dcd-server if neccessary!"), localize("d.ext.workspaced.restart", "Restart")).then(s => { + if (s == localize("d.ext.workspaced.restart", "Restart")) self.startWorkspaceD.call(self); }); }); @@ -150,7 +154,7 @@ export class WorkspaceD extends EventEmitter implements if (!match) continue; return Promise.resolve([{ - title: "Import " + match[1], + title: localize("d.ext.importModule", "Import {0}", match[1]), command: "code-d.addImport", arguments: [match[1], document.offsetAt(range.start)] }]); @@ -198,7 +202,7 @@ export class WorkspaceD extends EventEmitter implements }, () => { for (var i = 0; i < modules.length; i++) { rets.push({ - title: "Import " + modules[i], + title: localize("d.ext.importModule", "Import {0}", modules[i]), command: "code-d.addImport", arguments: [modules[i], document.offsetAt(range.start)] }); @@ -586,8 +590,8 @@ export class WorkspaceD extends EventEmitter implements } } else - vscode.window.showInformationMessage("No import paths available for this project. Autocompletion could be broken!", "Switch Configuration").then((s) => { - if (s == "Switch Configuration") { + vscode.window.showInformationMessage(localize("d.ext.noImportPaths.project", "No import paths available for this project. Autocompletion could be broken!"), localize("d.action.switchConfiguration", "Switch Configuration")).then((s) => { + if (s == localize("d.action.switchConfiguration", "Switch Configuration")) { vscode.commands.executeCommand("code-d.switchConfiguration"); } }); @@ -611,8 +615,8 @@ export class WorkspaceD extends EventEmitter implements } } else - vscode.window.showErrorMessage("Could not switch compiler", "Switch Compiler").then((s) => { - if (s == "Switch Compiler") { + vscode.window.showErrorMessage(localize("d.ext.compilerFail", "Could not switch compiler"), localize("d.action.switchCompiler", "Switch Compiler")).then((s) => { + if (s == localize("d.action.switchCompiler", "Switch Compiler")) { vscode.commands.executeCommand("code-d.switchCompiler"); } }); @@ -634,19 +638,18 @@ export class WorkspaceD extends EventEmitter implements if (success) this.emit("arch-type-change", arch); else - vscode.window.showInformationMessage("Could not switch arch type", "Switch Arch Type").then((s) => { - if (s == "Switch Arch Type") { + vscode.window.showInformationMessage(localize("d.ext.archFail", "Could not switch arch type"), localize("d.action.switchArchType", "Switch Arch Type")).then((s) => { + if (s == localize("d.action.switchArchType", "Switch Arch Type")) { vscode.commands.executeCommand("code-d.switchArchType"); } }); return success; - }, - err => { - console.error(err); - vscode.window.showErrorMessage("Failed to switch arch type. See console for details."); - return false; - }); + }, (err) => { + console.error(err); + vscode.window.showErrorMessage(localize("d.ext.ultimateArchFail", "Failed to switch arch type. See console for details.")); + return false; + }); } listBuildTypes(): Thenable { @@ -664,11 +667,13 @@ export class WorkspaceD extends EventEmitter implements this.emit("build-type-change", config); } else - vscode.window.showInformationMessage("No import paths available for this build type. Autocompletion could be broken!", "Switch Build Type").then((s) => { - if (s == "Switch Build Type") { - vscode.commands.executeCommand("code-d.switchBuildType"); - } - }); + vscode.window.showInformationMessage( + localize("d.ext.noImportPaths.buildType", "No import paths available for this build type. Autocompletion could be broken!"), + localize("d.action.switchBuildType", "Switch Build Type")).then((s) => { + if (s == localize("d.action.switchBuildType", "Switch Build Type")) { + vscode.commands.executeCommand("code-d.switchBuildType"); + } + }); return success; }); } @@ -698,7 +703,7 @@ export class WorkspaceD extends EventEmitter implements this.listImports().then(console.log); }, reject); } else { - vscode.window.showWarningMessage("Could not update DCD. Please restart DCD if its not working properly"); + vscode.window.showWarningMessage(localize("d.ext.dcdUpdateFail", "Could not update DCD. Please restart DCD if its not working properly")); resolve(true); } }, reject); @@ -750,18 +755,20 @@ export class WorkspaceD extends EventEmitter implements public checkResponsiveness(): Thenable { return new Promise((resolve) => { var unresponsiveTimeout = setTimeout(() => { - vscode.window.showWarningMessage("Workspace-D is unresponsive. Auto completion might not work", "Restart").then(s => { - if (s == "Restart") { - this.shouldRestart = true; - try { - process.kill(-this.instance.pid); - } - catch (e) { - vscode.window.showErrorMessage("Could not kill workspace-d. Please manually kill it! PID: " + this.instance.pid); + vscode.window.showWarningMessage( + localize("d.ext.workspacedUnresponsive", "workspace-d is unresponsive. Auto completion could be broken!"), + localize("d.ext.workspaced.restart", "Restart")).then(s => { + if (s == localize("d.ext.workspaced.restart", "Restart")) { + this.shouldRestart = true; + try { + process.kill(-this.instance.pid); + } + catch (e) { + vscode.window.showErrorMessage(localize("d.ext.workspacedUnkillable", "Could not kill workspace-d. Please manually kill it! PID: {0}", this.instance.pid)); + } + this.startWorkspaceD(); } - this.startWorkspaceD(); - } - }); + }); resolve(false); }, 10 * 1000); this.request({ cmd: "version" }).then(version => { @@ -772,27 +779,37 @@ export class WorkspaceD extends EventEmitter implements } public checkVersion() { + var installNewest = localize("d.ext.workspacedOutdated.install", "Install newest version"); + let callback = (r) => { + if (r == installNewest) + installWorkspaceD(this.processEnv); + }; this.request({ cmd: "version" }).then((version) => { - let callback = (r) => { - if (r == "Install newest version") - installWorkspaceD(this.processEnv); - }; console.log("workspace-d version: " + formatVersion([version.major, version.minor, version.patch])); if (version.major < TARGET_VERSION[0]) - return vscode.window.showErrorMessage("workspace-d is outdated! Please update to continue using this plugin. (target=" - + formatVersion(TARGET_VERSION) + ", workspaced=" + formatVersion([version.major, version.minor, version.patch]) + ")", - "Install newest version").then(callback); + return vscode.window.showErrorMessage( + localize("d.ext.workspacedOutdated.major", + "workspace-d is outdated! Please update to continue using this plugin. (target={0}, workspaced={1})", + formatVersion(TARGET_VERSION), + formatVersion([version.major, version.minor, version.patch])), + installNewest).then(callback); if (version.major == TARGET_VERSION[0] && version.minor < TARGET_VERSION[1]) - vscode.window.showWarningMessage("workspace-d might be outdated! Please update if things are not working as expected. (target=" - + formatVersion(TARGET_VERSION) + ", workspaced=" + formatVersion([version.major, version.minor, version.patch]) + ")", - "Install newest version").then(callback); + vscode.window.showWarningMessage( + localize("d.ext.workspacedOutdated.minor", + "workspace-d might be outdated! Please update if things are not working as expected. (target={0}, workspaced={1})", + formatVersion(TARGET_VERSION), + formatVersion([version.major, version.minor, version.patch])), + installNewest).then(callback); if (version.major == TARGET_VERSION[0] && version.minor == TARGET_VERSION[1] && version.patch < TARGET_VERSION[2]) - vscode.window.showInformationMessage("workspace-d has a new optional update! Please update before submitting a bug report. (target=" - + formatVersion(TARGET_VERSION) + ", workspaced=" + formatVersion([version.major, version.minor, version.patch]) + ")", - "Install newest version").then(callback); + vscode.window.showInformationMessage( + localize("d.ext.workspacedOutdated.minor", + "workspace-d has a new optional update! Please update before submitting a bug report. (target={0}, workspaced={1})", + formatVersion(TARGET_VERSION), + formatVersion([version.major, version.minor, version.patch])), + installNewest).then(callback); this.setupDub(); }, () => { - vscode.window.showErrorMessage("Could not identify workspace-d version. Please update workspace-d!"); + vscode.window.showErrorMessage(localize("d.ext.workspacedOutdated.unknown", "Could not identify workspace-d version. Please update workspace-d!"), installNewest).then(callback); }); } @@ -819,12 +836,12 @@ export class WorkspaceD extends EventEmitter implements this.setupImporter(); this.listConfigurations().then((configs) => { if (configs.length == 0) { - vscode.window.showInformationMessage("No configurations available for this project. Autocompletion could be broken!"); + vscode.window.showInformationMessage(localize("d.ext.noConfigurations.project", "No configurations available for this project. Autocompletion could be broken!")); } else { var defaultConfig = config().get("dubConfiguration", ""); if (defaultConfig) { if (configs.indexOf(defaultConfig) == -1) { - vscode.window.showErrorMessage("Configuration '" + defaultConfig + "' which is specified in the config is not available!"); + vscode.window.showErrorMessage(localize("d.ext.config.invalid.configuration", "Configuration '{0}' which is specified in the config is not available!", defaultConfig)); return this.setConfiguration(configs[0]); } else { @@ -843,24 +860,24 @@ export class WorkspaceD extends EventEmitter implements if (defaultArchType) { this.setArchType(defaultArchType).then(success => { if (!success) - vscode.window.showErrorMessage("Arch Type '" + defaultArchType + "' which is specified in the config is not available!"); + vscode.window.showErrorMessage(localize("d.ext.config.invalid.archType", "Arch Type '{0}' which is specified in the config is not available!", defaultArchType)); }); } if (defaultBuildType) { this.setBuildType(defaultBuildType).then(success => { if (!success) - vscode.window.showErrorMessage("Build Type '" + defaultBuildType + "' which is specified in the config is not available!"); + vscode.window.showErrorMessage(localize("d.ext.config.invalid.buildType", "Build Type '{0}' which is specified in the config is not available!", defaultBuildType)); }); } if (defaultCompiler) { this.setCompiler(defaultCompiler).then(success => { if (!success) - vscode.window.showErrorMessage("Compiler '" + defaultCompiler + "' which is specified in the config is not available!"); + vscode.window.showErrorMessage(localize("d.ext.config.invalid.compiler", "Compiler '{0}' which is specified in the config is not available!", defaultCompiler)); }); } }); }, (err) => { - vscode.window.showWarningMessage("Could not initialize dub. Falling back to limited functionality!"); + vscode.window.showWarningMessage(localize("d.ext.dubFail", "Could not initialize dub. Falling back to limited functionality!")); this.setupCustomWorkspace(); }); } @@ -900,7 +917,7 @@ export class WorkspaceD extends EventEmitter implements this.setupDlangUI(); this.setupImporter(); }, (err) => { - vscode.window.showErrorMessage("Could not initialize fsworkspace. See console for details!"); + vscode.window.showErrorMessage(localize("d.ext.fsworkspaceFail", "Could not initialize fsworkspace. See console for details!")); }); } @@ -924,7 +941,7 @@ export class WorkspaceD extends EventEmitter implements }).then((data) => { this.startDCD(); }, (err) => { - vscode.window.showErrorMessage("Could not initialize DCD. See console for details!"); + vscode.window.showErrorMessage(localize("d.ext.dcdFail", "Could not initialize DCD. See console for details!")); }); } @@ -988,13 +1005,13 @@ export class WorkspaceD extends EventEmitter implements }); }); } else { - vscode.window.showWarningMessage("Could not update DCD. Please restart DCD if its not working properly"); + vscode.window.showWarningMessage(localize("d.ext.dcdUpdateFail", "Could not update DCD. Please restart DCD if its not working properly")); } }, (err) => { - vscode.window.showErrorMessage("Could not initialize DCD. See console for details!"); + vscode.window.showErrorMessage(localize("d.ext.dcdFail", "Could not initialize DCD. See console for details!")); }); }, (err) => { - vscode.window.showErrorMessage("Could not initialize DCD. See console for details!"); + vscode.window.showErrorMessage(localize("d.ext.dcdFail", "Could not initialize DCD. See console for details!")); }); } From d99ee88c176acbefa1f51e818520ea89de88a747 Mon Sep 17 00:00:00 2001 From: WebFreak001 Date: Tue, 3 Jan 2017 20:23:57 +0100 Subject: [PATCH 2/6] Localize everything! (mostly) --- package.json | 2 +- package.nls.de.json | 51 +++++++++++++-- package.nls.json | 47 ++++++++++++- src/compile-buttons.ts | 10 +-- src/coverage.ts | 7 +- src/dfmt-check.ts | 1 + src/dub-editor.ts | 55 ++++++++-------- src/dub-json.ts | 7 +- src/extension.ts | 2 - src/gcprofiler.ts | 5 +- src/installer.ts | 145 +++++++++++++++++++++++------------------ src/project-creator.ts | 41 +++++++----- src/statusbar.ts | 9 +-- 13 files changed, 247 insertions(+), 135 deletions(-) diff --git a/package.json b/package.json index c70c891..24e1732 100644 --- a/package.json +++ b/package.json @@ -422,7 +422,7 @@ "ncp": "^2.0.0", "rmdir": "^1.2.0", "line-by-line": "^0.1.5", - "vscode-nls": "^2.0.1" + "vscode-nls": "WebFreak001/vscode-nls#9954e54" }, "devDependencies": { "typescript": "^2.0.6", diff --git a/package.nls.de.json b/package.nls.de.json index 959b4a0..aff2069 100644 --- a/package.nls.de.json +++ b/package.nls.de.json @@ -11,16 +11,16 @@ "d.action.killServer": "DCD Server zwangshaft beenden", "d.restartServer": "code-d: DCD Server neustarten", "d.action.restartServer": "DCD Server neustarten", - "d.reloadImports": "code-d: Import Pfäde neuladen", - "d.action.reloadImports": "Import Pfäde neuladen", + "d.reloadImports": "code-d: Import Pfäde neu laden", + "d.action.reloadImports": "Import Pfäde neu laden", "d.run": "code-d: Projekt Ausführen", "d.action.run": "Projekt Ausführen", "d.build": "code-d: Projekt Erstellen", "d.action.build": "Projekt Erstellen", "d.stop": "code-d: Ausführung Stoppen", "d.action.stop": "Ausführung Stoppen", - "d.debug": "code-d: Projekt mit code-debug debuggen", - "d.action.debug": "Projekt mit code-debug debuggen", + "d.debug": "code-d: Projekt Debuggen", + "d.action.debug": "Projekt Debuggen", "d.uploadSelection": "code-d: Auswahl auf dpaste.com hochladen", "d.action.uploadSelection": "Auswahl auf dpaste.com hochladen", "d.insertDscanner": "code-d: Vorgefertigte dscanner.ini Datei einfügen", @@ -92,5 +92,46 @@ "d.ext.config.invalid.compiler": "Der Compiler '{0}' welcher in den Einstellungen angegeben wurde, wurde nicht gefunden!", "d.ext.dubFail": "Konnte dub nicht starten. Funktionalität begrenzt!", "d.ext.fsworkspaceFail": "Konnte fsworkspace nicht starten. In die Entwicklertools umschalten für Details.", - "d.ext.dcdFail": "Konnte DCD nicht starten. In die Entwicklertools umschalten für Details." + "d.ext.dcdFail": "Konnte DCD nicht starten. In die Entwicklertools umschalten für Details.", + "d.ext.gcLens": "{0} Bytes allocated / {1} Allocation", + + "d.projects.readFail": "Konnte template Liste nicht lesen", + "d.projects.selectFolderInstruction": "Wählen Sie einen leeren Ordner indem das Projekt erstellt werden soll aus", + "d.projects.selectFolder": "Ordner auswählen", + "d.projects.selectOtherFolder": "Anderen Ordner wählen", + "d.projects.mergeFolder": "Mit existierenden Dateien mischen", + "d.projects.folderNotEmpty": "Der aktuelle Ordner ist nicht leer!", + "d.projects.reloadFail": "Konnte Fenster nicht erneut laden. Bitte manuell neu laden und einen code-d Befehl ausführen!", + "d.projects.copyFail": "Konnte Projekttemplate nicht kopieren", + "d.projects.dubFail": "Konnte dub.json Datei nicht generieren", + + "d.installer.noPrebuiltWorkspaced": "Keine ausführbare workspace-d Datei für diese Platform/Architektur vorhanden", + "d.installer.noPrebuiltDub": "Keine dub Version für die aktuelle Platform vorhanden", + "d.installer.compileFromSource": "Aus Quellcode Kompilieren", + "d.installer.title": "Installation von {0}", + "d.installer.installingInto": "Installiere in {0}", + "d.installer.downloadingFrom": "Installiere von {0} in {1}", + "d.installer.downloadProgress": "{0}% heruntergeladen {1}", + "d.installer.extracting": "Entpacke {0}", + "d.installer.deleting": "Lösche {0}", + "d.installer.success": "{0} erfolgreich installiert", + "d.installer.reload": "Neu laden", + "d.installer.extractTarXzFail": "Fehler beim entpacken des .tar.xz Archivs", + "d.installer.extractTarGzFail": "Fehler beim entpacken des .tar.gz Archivs", + "d.installer.error": "Fehler beim Installieren von {0} (Fehlercode {1})", + "d.installer.compileDone": "Erfolgreich kompiliert", + "d.installer.removingOld": "Entferne alte Version", + "d.installer.removedOld": "alte Version entfernt", + + "d.dub.notFound": "Package nicht gefunden", + "d.dub.noVersions": "Keine Versionen vorhanden", + "d.dub.packageRelease": "Veröffentlicht am {0}", + "d.dub.docDirty": "Bitte alle geöffneten dub.json Dateien speichern oder schließen und erneut versuchen", + "d.dub.dubJsonFail": "dub.json ist keine gültige json Datei", + "d.dub.generateFail": "Konnte dub.json nicht generieren", + "d.dub.updateFail": "Konnte dub.json nicht überschreiben", + "d.dub.override": "Ohne Backup überschreiben", + + "d.coverage.statusText": "{0}% Coverage", + "d.coverage.tooltip": "Testabdeckung in dieser Datei wurde aus der zugehörigen .lst Datei generiert" } \ No newline at end of file diff --git a/package.nls.json b/package.nls.json index 38fd56d..61cfca5 100644 --- a/package.nls.json +++ b/package.nls.json @@ -19,8 +19,8 @@ "d.action.build": "Build project", "d.stop": "code-d: Stop project", "d.action.stop": "Stop project", - "d.debug": "code-d: Debug project using code-debug", - "d.action.debug": "Debug project using code-debug", + "d.debug": "code-d: Debug project", + "d.action.debug": "Debug project", "d.uploadSelection": "code-d: Upload selection to dpaste.com", "d.action.uploadSelection": "Upload selection to dpaste.com", "d.insertDscanner": "code-d: Insert default dscanner.ini content", @@ -92,5 +92,46 @@ "d.ext.config.invalid.compiler": "Compiler '{0}' which is specified in the config is not available!", "d.ext.dubFail": "Could not initialize dub. Falling back to limited functionality!", "d.ext.fsworkspaceFail": "Could not initialize fsworkspace. See console for details!", - "d.ext.dcdFail": "Could not initialize DCD. See console for details!" + "d.ext.dcdFail": "Could not initialize DCD. See console for details!", + "d.ext.gcLens": "{0} bytes allocated / {1} allocations", + + "d.projects.readFail": "Failed to read template list", + "d.projects.selectFolderInstruction": "Select an empty folder to create the project in", + "d.projects.selectFolder": "Select Folder", + "d.projects.selectOtherFolder": "Select other Folder", + "d.projects.mergeFolder": "Merge into Folder", + "d.projects.folderNotEmpty": "The current workspace is not empty!", + "d.projects.reloadFail": "Failed to reload. Reload manually and run some code-d command!", + "d.projects.copyFail": "Failed to copy template", + "d.projects.dubFail": "Failed to generate dub.json", + + "d.installer.noPrebuiltWorkspaced": "No precompiled workspace-d binary for this platform/architecture", + "d.installer.noPrebuiltDub": "dub is not available for your platform", + "d.installer.compileFromSource": "Compile from source", + "d.installer.title": "{0} installation progress", + "d.installer.installingInto": "Installing into {0}", + "d.installer.downloadingFrom": "Downloading from {0} into {1}", + "d.installer.downloadProgress": "Downloaded {0}% {1}", + "d.installer.extracting": "Extracting {0}", + "d.installer.deleting": "Deleting {0}", + "d.installer.success": "{0} successfully installed", + "d.installer.reload": "Reload", + "d.installer.extractTarXzFail": "Failed to extract .tar.xz release", + "d.installer.extractTarGzFail": "Failed to extract .tar.gz release", + "d.installer.error": "Failed to install {0} (Error code {1})", + "d.installer.compileDone": "Done compiling", + "d.installer.removingOld": "Removing old version", + "d.installer.removedOld": "Removed old version", + + "d.dub.notFound": "Package not found", + "d.dub.noVersions": "No versions found", + "d.dub.packageRelease": "Released on {0}", + "d.dub.docDirty": "Please save or close all instances of this dub.json file and try again", + "d.dub.dubJsonFail": "dub.json is not a valid json file", + "d.dub.generateFail": "Failed to generate dub.json", + "d.dub.updateFail": "Failed to update dub.json", + "d.dub.override": "Override without Backup", + + "d.coverage.statusText": "{0}% Coverage", + "d.coverage.tooltip": "Coverage in this file generated from the according .lst file" } \ No newline at end of file diff --git a/src/compile-buttons.ts b/src/compile-buttons.ts index 909e758..fecbc98 100644 --- a/src/compile-buttons.ts +++ b/src/compile-buttons.ts @@ -2,7 +2,7 @@ import * as vscode from "vscode" import * as ChildProcess from "child_process" import * as path from "path" import { WorkspaceD } from "./workspace-d" -import { config } from "./extension" +import { config, localize } from "./extension" export class CompileButtons implements vscode.Disposable { buildButton: vscode.StatusBarItem; @@ -31,9 +31,9 @@ export class CompileButtons implements vscode.Disposable { this.startButton.text = " $(triangle-right) "; this.debugButton.text = "$(bug)"; - this.buildButton.tooltip = "Build project"; - this.startButton.tooltip = "Run project"; - this.debugButton.tooltip = "Debug project"; + this.buildButton.tooltip = localize("d.action.build", "Build project"); + this.startButton.tooltip = localize("d.action.run", "Run project"); + this.debugButton.tooltip = localize("d.action.debug", "Debug project"); this.buildButton.command = "code-d.build"; this.startButton.command = "code-d.run"; @@ -165,7 +165,7 @@ export class CompileButtons implements vscode.Disposable { }, err => { vscode.window.showErrorMessage("Couldn't start debugging. Make sure you have a GDB extension installed!", "Install Extensions").then(result => { if (result == "Install Extensions") { - vscode.commands.executeCommand("workbench.extensions.action.installExtension"); + vscode.commands.executeCommand("workbench.extensions.action.installExtensions"); } }); }); diff --git a/src/coverage.ts b/src/coverage.ts index e615912..0b7ebd9 100644 --- a/src/coverage.ts +++ b/src/coverage.ts @@ -1,6 +1,7 @@ import * as vscode from "vscode" import * as path from "path" import * as fs from "fs" +import { localize } from "./extension" interface CoverageLine { hits: number; @@ -37,8 +38,8 @@ export class CoverageAnalyzer implements vscode.TextDocumentContentProvider { isWholeLine: true }); this.coverageStat = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left, 0.72136); - this.coverageStat.text = "0.00% Coverage"; - this.coverageStat.tooltip = "Coverage in this file generated from the according .lst file"; + this.coverageStat.text = localize("d.coverage.statusText", "{0}% Coverage", "0.00"); + this.coverageStat.tooltip = localize("d.coverage.tooltip", "Coverage in this file generated from the according .lst file"); this.coverageStat.command = "code-d.generateCoverageReport"; } @@ -119,7 +120,7 @@ export class CoverageAnalyzer implements vscode.TextDocumentContentProvider { } } } - this.coverageStat.text = info.totalCov + "% Coverage"; + this.coverageStat.text = localize("d.coverage.statusText", "{0}% Coverage", info.totalCov); this.coverageStat.show(); } else diff --git a/src/dfmt-check.ts b/src/dfmt-check.ts index 699087a..c2fde4e 100644 --- a/src/dfmt-check.ts +++ b/src/dfmt-check.ts @@ -19,6 +19,7 @@ export function lintDfmt(doc: vscode.TextDocument, code = doc.getText()) { let match = validDfmt.exec(part); if (!match) { let pos = doc ? doc.positionAt(location) : new vscode.Position(0, 0); + // localizing code/"compiler" error messages? That goes too far. issues.push(new vscode.Diagnostic(new vscode.Range(pos, pos.translate(0, 100)), "Not a valid dfmt command (try //dfmt off or //dfmt on instead)", vscode.DiagnosticSeverity.Warning)); } else { if (match[1] == "off") { diff --git a/src/dub-editor.ts b/src/dub-editor.ts index a17ff36..1525ccd 100644 --- a/src/dub-editor.ts +++ b/src/dub-editor.ts @@ -2,6 +2,7 @@ import * as vscode from "vscode" import * as path from "path" import * as fs from "fs" import * as os from "os" +import { localize } from "./extension" function getEditorUrl(uri: vscode.Uri) { return uri.with({ @@ -19,27 +20,27 @@ function isDubPackage(uri: vscode.Uri) { } function copyFile(source, target, cb) { - var cbCalled = false; - - var rd = fs.createReadStream(source); - rd.on("error", function (err) { - done(err); - }); - var wr = fs.createWriteStream(target); - wr.on("error", function (err) { - done(err); - }); - wr.on("close", function (ex) { - done(); - }); - rd.pipe(wr); - - function done(err?) { - if (!cbCalled) { - cb(err); - cbCalled = true; - } - } + var cbCalled = false; + + var rd = fs.createReadStream(source); + rd.on("error", function (err) { + done(err); + }); + var wr = fs.createWriteStream(target); + wr.on("error", function (err) { + done(err); + }); + wr.on("close", function (ex) { + done(); + }); + rd.pipe(wr); + + function done(err?) { + if (!cbCalled) { + cb(err); + cbCalled = true; + } + } } const pathSeparator = " >_> "; @@ -110,7 +111,7 @@ export class DubEditor implements vscode.TextDocumentContentProvider { let uri = vscode.Uri.parse(arg.file); vscode.workspace.openTextDocument(uri).then(doc => { if (doc.isDirty) { - vscode.window.showErrorMessage("Please save or close all instances of this dub.json file and try again"); + vscode.window.showErrorMessage(localize("d.dub.docDirty", "Please save or close all instances of this dub.json file and try again")); return; } var text = doc.getText(); @@ -121,7 +122,7 @@ export class DubEditor implements vscode.TextDocumentContentProvider { jsonContent = JSON.parse(text.trim()); } catch (e) { - vscode.window.showErrorMessage("dub.json is not a valid json file"); + vscode.window.showErrorMessage(localize("d.dub.dubJsonFail", "dub.json is not a valid json file")); console.error(e); return; } @@ -140,20 +141,20 @@ export class DubEditor implements vscode.TextDocumentContentProvider { updateDubJson(uri: vscode.Uri, content: JSON) { if (!content || typeof content !== "object") - return vscode.window.showErrorMessage("Failed to generate dub.json"); + return vscode.window.showErrorMessage(localize("d.dub.generateFail", "Failed to generate dub.json")); fs.stat(uri.fsPath + ".bak", function (err, stats) { var prepareWrite = function (err) { var performWrite = function () { fs.writeFile(uri.fsPath, JSON.stringify(content, null, "\t"), function (err) { if (err) { - vscode.window.showErrorMessage("Failed to update dub.json"); + vscode.window.showErrorMessage(localize("d.dub.updateFail", "Failed to update dub.json")); console.error(err); } }); }; if (err) - vscode.window.showWarningMessage("Failed to backup dub.json", "Override without Backup").then(r => { - if (r == "Override without Backup") + vscode.window.showWarningMessage("Failed to backup dub.json", localize("d.dub.override", "Override without Backup")).then(r => { + if (r == localize("d.dub.override", "Override without Backup")) performWrite(); }); else diff --git a/src/dub-json.ts b/src/dub-json.ts index 9ac0729..56fbf2e 100644 --- a/src/dub-json.ts +++ b/src/dub-json.ts @@ -1,6 +1,7 @@ import { IJSONContribution, ISuggestionsCollector } from "./json-contributions"; import * as vscode from "vscode"; import { Location } from "jsonc-parser"; +import { localize } from "./extension"; import { searchDubPackages, listPackages, getPackageInfo, getLatestPackageInfo } from "./dub-api" var semverRegex = /(\d+)\.(\d+)\.(\d+)/; @@ -84,7 +85,7 @@ export class DubJSONContribution implements IJSONContribution { }); resolve(); }, err => { - result.error("Package not found"); + result.error(localize("d.dub.notFound", "Package not found")); resolve(); }); } @@ -126,12 +127,12 @@ export class DubJSONContribution implements IJSONContribution { getPackageInfo(currentKey).then(json => { var versions = json.versions; if (!versions || !versions.length) { - result.error("No versions found"); + result.error(localize("d.dub.noVersions", "No versions found")); return resolve(); } for (var i = versions.length - 1; i >= 0; i--) { var item = new vscode.CompletionItem(versions[i].version); - item.detail = "Released on " + new Date(versions[i].date).toLocaleDateString(); + item.detail = localize("d.dub.packageRelease", "Released on {0}", new Date(versions[i].date).toLocaleDateString()); item.kind = vscode.CompletionItemKind.Class; item.insertText = JSON.stringify("{{}}" + versions[i].version); var sortText = "999999999"; diff --git a/src/extension.ts b/src/extension.ts index 2d68f58..67f0c35 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -32,8 +32,6 @@ export function config() { export function activate(context: vscode.ExtensionContext) { extensionContext = context; setContext(context); - console.log(vscode.env.language); - console.log(context.asAbsolutePath("package")); localize = nls.config({ locale: vscode.env.language })(context.asAbsolutePath("package")); if (context.globalState.get("restorePackageBackup", false)) { diff --git a/src/gcprofiler.ts b/src/gcprofiler.ts index 4293202..5c8cb19 100644 --- a/src/gcprofiler.ts +++ b/src/gcprofiler.ts @@ -1,6 +1,7 @@ import * as vscode from "vscode"; import * as fs from "fs"; import * as path from "path"; +import { localize } from "./extension"; var spaces = /[^\S\n]+/g; var filelineRegex = /(\S+):(\d+)$/; @@ -18,7 +19,7 @@ export class GCProfiler implements vscode.CodeLensProvider { lens.command = { arguments: [], command: "", - title: profile.bytesAllocated + " bytes allocated / " + profile.allocationCount + " allocations" + title: localize("d.ext.gcLens", "{0} bytes allocated / {1} allocations", profile.bytesAllocated, profile.allocationCount) }; lenses.push(lens); } @@ -61,7 +62,7 @@ export class GCProfiler implements vscode.CodeLensProvider { this.profiles.forEach(profile => { items.push({ description: profile.type, - detail: profile.bytesAllocated + " bytes allocated / " + profile.allocationCount + " allocations", + detail: localize("d.ext.gcLens", "{0} bytes allocated / {1} allocations", profile.bytesAllocated, profile.allocationCount), label: profile.displayFile + ":" + profile.line, profile: profile }); diff --git a/src/installer.ts b/src/installer.ts index 711e4e6..e0ff69c 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -2,6 +2,7 @@ import * as ChildProcess from "child_process" import * as vscode from "vscode" import * as path from "path" import * as fs from "fs" +import { localize } from "./extension" import { TARGET_VERSION } from "./workspace-d" import { req } from "./util" var unzip = require("unzip"); @@ -35,36 +36,40 @@ export function installWorkspaceD(env) { ext = ".zip"; } else - return vscode.window.showErrorMessage("No precompiled workspace-d binary for this platform/architecture", "Compile from source").then((r) => { - if (r == "Compile from source") - compileWorkspaceD(env); - }); - var output = vscode.window.createOutputChannel("workspace-d installation progress"); + return vscode.window.showErrorMessage( + localize("d.installer.noPrebuiltWorkspaced", "No precompiled workspace-d binary for this platform/architecture"), + localize("d.installer.compileFromSource", "Compile from source")).then((r) => { + if (r == localize("d.installer.compileFromSource", "Compile from source")) + compileWorkspaceD(env); + }); + var output = vscode.window.createOutputChannel(localize("d.installer.title", "{0} installation progress", "workspace-d")); extensionContext.subscriptions.push(output); output.show(true); var outputFolder = path.join(extensionContext.extensionPath, "bin"); var finalDestination = path.join(outputFolder, "workspace-d" + (process.platform == "win32" ? ".exe" : "")); - output.appendLine("Installing into " + outputFolder); + output.appendLine(localize("d.installer.installingInto", "Installing into {0}", outputFolder)); fs.exists(outputFolder, function (exists) { if (!exists) fs.mkdirSync(outputFolder); if (fs.existsSync(finalDestination)) fs.unlinkSync(finalDestination); - output.appendLine("Downloading from " + url + " into " + outputFolder); + output.appendLine(localize("d.installer.downloadingFrom", "Downloading from {0} into {1}", url, outputFolder)); var outputPath = path.join(outputFolder, "workspace-d" + ext); progress(req()(url)).on("progress", (state) => { - output.appendLine("Downloaded " + (state.percentage * 100).toFixed(2) + "%" + (state.time.remaining ? " (ETA " + state.time.remaining.toFixed(1) + "s)" : "")); + output.appendLine(localize("d.installer.downloadProgress", "Downloaded {0}% {1}", (state.percentage * 100).toFixed(2), state.time.remaining ? "(ETA " + state.time.remaining.toFixed(1) + "s)" : "")); }).pipe(fs.createWriteStream(outputPath)).on("finish", () => { - output.appendLine("Extracting workspace-d"); + output.appendLine(localize("d.installer.extracting", "Extracting {0}", "workspace-d")); if (ext == ".zip") { fs.createReadStream(outputPath).pipe(unzip.Extract({ path: outputFolder })).on("finish", () => { config().update("workspacedPath", finalDestination, true); - output.appendLine("Deleting " + outputPath); + output.appendLine(localize("d.installer.deleting", "Deleting {0}", outputPath)); fs.unlink(outputPath); - vscode.window.showInformationMessage("workspace-d successfully installed", "Reload").then((r) => { - if (r == "Reload") - vscode.commands.executeCommand("workbench.action.reloadWindow"); - }); + vscode.window.showInformationMessage( + localize("d.installer.success", "{0} successfully installed", "workspace-d"), + localize("d.installer.reload", "Reload")).then((r) => { + if (r == localize("d.installer.reload", "Reload")) + vscode.commands.executeCommand("workbench.action.reloadWindow"); + }); }); } else if (ext == ".tar.xz") { @@ -73,17 +78,21 @@ export function installWorkspaceD(env) { cwd: outputFolder }).on("exit", function (code) { if (code != 0) - return vscode.window.showErrorMessage("Failed to extract .tar.xz release", "Compile from source").then((r) => { - if (r == "Compile from source") - compileWorkspaceD(env); - }); + return vscode.window.showErrorMessage( + localize("d.installer.extractTarXzFail", "Failed to extract .tar.xz release"), + localize("d.installer.compileFromSource", "Compile from source")).then((r) => { + if (r == localize("d.installer.compileFromSource", "Compile from source")) + compileWorkspaceD(env); + }); config().update("workspacedPath", finalDestination, true); - output.appendLine("Deleting " + outputPath); + output.appendLine(localize("d.installer.deleting", "Deleting {0}", outputPath)); fs.unlink(outputPath); - vscode.window.showInformationMessage("workspace-d successfully installed", "Reload").then((r) => { - if (r == "Reload") - vscode.commands.executeCommand("workbench.action.reloadWindow"); - }); + vscode.window.showInformationMessage( + localize("d.installer.success", "{0} successfully installed", "workspace-d"), + localize("d.installer.reload", "Reload")).then((r) => { + if (r == localize("d.installer.reload", "Reload")) + vscode.commands.executeCommand("workbench.action.reloadWindow"); + }); }); } }); @@ -114,31 +123,33 @@ export function downloadDub(env) { ext = ".tar.gz"; } else - return vscode.window.showErrorMessage("dub is not available for your platform"); - var output = vscode.window.createOutputChannel("dub installation progress"); + return vscode.window.showErrorMessage(localize("d.installer.noPrebuiltDub", "dub is not available for your platform")); + var output = vscode.window.createOutputChannel(localize("d.installer.title", "{0} installation progress", "dub")); extensionContext.subscriptions.push(output); output.show(true); var outputFolder = path.join(extensionContext.extensionPath, "bin"); var finalDestination = path.join(outputFolder, "dub" + (process.platform == "win32" ? ".exe" : "")); - output.appendLine("Installing into " + outputFolder); + output.appendLine(localize("d.installer.installingInto", "Installing into {0}", outputFolder)); fs.exists(outputFolder, function (exists) { if (!exists) fs.mkdirSync(outputFolder); - output.appendLine("Downloading from " + url + " into " + outputFolder); + output.appendLine(localize("d.installer.downloadingFrom", "Downloading from {0} into {1}", url, outputFolder)); var outputPath = path.join(outputFolder, "dub" + ext); progress(req()(url)).on("progress", (state) => { - output.appendLine("Downloaded " + (state.percentage * 100).toFixed(2) + "%" + (state.time.remaining ? " (ETA " + state.time.remaining.toFixed(1) + "s)" : "")); + output.appendLine(localize("d.installer.downloadProgress", "Downloaded {0}% {1}", (state.percentage * 100).toFixed(2), state.time.remaining ? "(ETA " + state.time.remaining.toFixed(1) + "s)" : "")); }).pipe(fs.createWriteStream(outputPath)).on("finish", () => { - output.appendLine("Extracting dub"); + output.appendLine(localize("d.installer.extracting", "Extracting {0}", "dub")); if (ext == ".zip") { fs.createReadStream(outputPath).pipe(unzip.Extract({ path: outputFolder })).on("finish", () => { config().update("dubPath", finalDestination, true); - output.appendLine("Deleting " + outputPath); + output.appendLine(localize("d.installer.deleting", "Deleting {0}", outputPath)); fs.unlink(outputPath); - vscode.window.showInformationMessage("dub successfully installed", "Reload").then((r) => { - if (r == "Reload") - vscode.commands.executeCommand("workbench.action.reloadWindow"); - }); + vscode.window.showInformationMessage( + localize("d.installer.success", "{0} successfully installed", "dub"), + localize("d.installer.reload", "Reload")).then((r) => { + if (r == localize("d.installer.reload", "Reload")) + vscode.commands.executeCommand("workbench.action.reloadWindow"); + }); }); } else if (ext == ".tar.gz") { @@ -147,14 +158,16 @@ export function downloadDub(env) { cwd: outputFolder }).on("exit", function (code) { if (code != 0) - return vscode.window.showErrorMessage("Failed to extract .tar.gz release"); + return vscode.window.showErrorMessage(localize("d.installer.extractTarGzFail", "Failed to extract .tar.gz release")); config().update("dubPath", finalDestination, true); - output.appendLine("Deleting " + outputPath); + output.appendLine(localize("d.installer.deleting", "Deleting {0}", outputPath)); fs.unlink(outputPath); - vscode.window.showInformationMessage("dub successfully installed", "Reload").then((r) => { - if (r == "Reload") - vscode.commands.executeCommand("workbench.action.reloadWindow"); - }); + vscode.window.showInformationMessage( + localize("d.installer.success", "{0} successfully installed", "dub"), + localize("d.installer.reload", "Reload")).then((r) => { + if (r == localize("d.installer.reload", "Reload")) + vscode.commands.executeCommand("workbench.action.reloadWindow"); + }); }); } }); @@ -176,10 +189,12 @@ export function compileWorkspaceD(env) { var finalDestination = path.join(outputFolder, "workspace-d", "workspace-d" + (process.platform == "win32" ? ".exe" : "")); config().update("workspacedPath", finalDestination, true); - vscode.window.showInformationMessage("workspace-d successfully installed", "Reload").then((r) => { - if (r == "Reload") - vscode.commands.executeCommand("workbench.action.reloadWindow"); - }); + vscode.window.showInformationMessage( + localize("d.installer.success", "{0} successfully installed", "workspace-d"), + localize("d.installer.reload", "Reload")).then((r) => { + if (r == localize("d.installer.reload", "Reload")) + vscode.commands.executeCommand("workbench.action.reloadWindow"); + }); }, env); }); } @@ -196,10 +211,12 @@ export function compileDScanner(env) { var finalDestination = path.join(outputFolder, "Dscanner", "bin", "dscanner" + (process.platform == "win32" ? ".exe" : "")); config().update("dscannerPath", finalDestination, true); - vscode.window.showInformationMessage("Dscanner successfully installed", "Reload").then((r) => { - if (r == "Reload") - vscode.commands.executeCommand("workbench.action.reloadWindow"); - }); + vscode.window.showInformationMessage( + localize("d.installer.success", "{0} successfully installed", "Dscanner"), + localize("d.installer.reload", "Reload")).then((r) => { + if (r == localize("d.installer.reload", "Reload")) + vscode.commands.executeCommand("workbench.action.reloadWindow"); + }); }, env); }); } @@ -216,10 +233,12 @@ export function compileDfmt(env) { var finalDestination = path.join(outputFolder, "dfmt", "bin", "dfmt" + (process.platform == "win32" ? ".exe" : "")); config().update("dfmtPath", finalDestination, true); - vscode.window.showInformationMessage("dfmt successfully installed", "Reload").then((r) => { - if (r == "Reload") - vscode.commands.executeCommand("workbench.action.reloadWindow"); - }); + vscode.window.showInformationMessage( + localize("d.installer.success", "{0} successfully installed", "dfmt"), + localize("d.installer.reload", "Reload")).then((r) => { + if (r == localize("d.installer.reload", "Reload")) + vscode.commands.executeCommand("workbench.action.reloadWindow"); + }); }, env); }); } @@ -238,10 +257,12 @@ export function compileDCD(env) { config().update("dcdClientPath", finalDestinationClient, true); config().update("dcdServerPath", finalDestinationServer, true); - vscode.window.showInformationMessage("DCD successfully installed", "Reload").then((r) => { - if (r == "Reload") - vscode.commands.executeCommand("workbench.action.reloadWindow"); - }); + vscode.window.showInformationMessage( + localize("d.installer.success", "{0} successfully installed", "DCD"), + localize("d.installer.reload", "Reload")).then((r) => { + if (r == localize("d.installer.reload", "Reload")) + vscode.commands.executeCommand("workbench.action.reloadWindow"); + }); }, env); }); } @@ -261,12 +282,12 @@ function spawnCommand(output: vscode.OutputChannel, cmd: string, args: string[], } export function compileDependency(cwd, name, gitPath, commands, callback, env) { - var output = vscode.window.createOutputChannel(name + " installation progress"); + var output = vscode.window.createOutputChannel(localize("d.installer.title", "{0} installation progress", name)); extensionContext.subscriptions.push(output); output.show(true); - output.appendLine("Installing into " + cwd); + output.appendLine(localize("d.installer.installingInto", "Installing into {0}", cwd)); var error = function (err) { - output.appendLine("Failed to install " + name + " (Error code " + err + ")"); + output.appendLine(localize("d.installer.error", "Failed to install {0} (Error code {1})", name, err)); }; var newCwd = path.join(cwd, name); var startCompile = () => { @@ -282,17 +303,17 @@ export function compileDependency(cwd, name, gitPath, commands, callback, env) { }, function (err) { if (err) return error(err); - output.appendLine("Done compiling"); + output.appendLine(localize("d.installer.compileDone", "Done compiling")); callback(); }); }); }; if (fs.existsSync(newCwd)) { - output.appendLine("Removing old version"); + output.appendLine(localize("d.installer.removingOld", "Removing old version")); rmdir(newCwd, function (err: Error, dirs, files) { if (err) output.appendLine(err.toString()); - output.appendLine("Removed old version"); + output.appendLine(localize("d.installer.removedOld", "Removed old version")); startCompile(); }); } diff --git a/src/project-creator.ts b/src/project-creator.ts index c16629a..b08e9bc 100644 --- a/src/project-creator.ts +++ b/src/project-creator.ts @@ -1,6 +1,7 @@ import * as vscode from "vscode" import * as path from "path" import * as fs from "fs" +import { localize } from "./extension" var ncp = require("ncp").ncp; @@ -17,7 +18,7 @@ export function getTemplates(context: vscode.ExtensionContext): Thenable { if (!vscode.workspace.rootPath) - return vscode.window.showInformationMessage("Select an empty folder to create the project in", "Select Folder").then(r => { - if (r == "Select Folder") { + return vscode.window.showInformationMessage(localize("d.projects.selectFolderInstruction", "Select an empty folder to create the project in"), localize("d.projects.selectFolder", "Select Folder")).then(r => { + if (r == localize("d.projects.selectFolder", "Select Folder")) { context.globalState.update("create-template", template.id); openFolderWithExtension(context); } @@ -54,33 +55,37 @@ export function showProjectCreator(context: vscode.ExtensionContext) { vscode.commands.executeCommand("workbench.action.reloadWindow"); }); else - return vscode.window.showWarningMessage("The current workspace is not empty!", "Select other Folder", "Merge into Folder").then(r => { - if (r == "Select other Folder") { - context.globalState.update("create-template", template.id); - openFolderWithExtension(context); - } else if (r == "Merge into Folder") { - performTemplateCopy(context, template.id, template.json, vscode.workspace.rootPath, function () { - vscode.commands.executeCommand("workbench.action.reloadWindow"); - }); - } - }); + return vscode.window.showWarningMessage( + localize("d.projects.folderNotEmpty", "The current workspace is not empty!"), + localize("d.projects.selectOtherFolder", "Select other Folder"), + localize("d.projects.mergeFolder", "Merge into Folder")).then(r => { + if (r == localize("d.projects.selectOtherFolder", "Select other Folder")) { + context.globalState.update("create-template", template.id); + openFolderWithExtension(context); + } else if (r == localize("d.projects.mergeFolder", "Merge into Folder")) { + performTemplateCopy(context, template.id, template.json, vscode.workspace.rootPath, function () { + vscode.commands.executeCommand("workbench.action.reloadWindow"); + }); + } + }); }); }); } export function openFolderWithExtension(context: vscode.ExtensionContext) { var pkgPath = path.join(context.extensionPath, "package.json"); + var reloadFail = localize("d.projects.reloadFail", "Failed to reload. Reload manually and run some code-d command!"); fs.readFile(pkgPath, function (err, data) { if (err) - return vscode.window.showErrorMessage("Failed to reload. Reload manually and run some code-d command!"); + return vscode.window.showErrorMessage(reloadFail); fs.writeFile(pkgPath + ".bak", data, function (err) { if (err) - return vscode.window.showErrorMessage("Failed to reload. Reload manually and run some code-d command!"); + return vscode.window.showErrorMessage(reloadFail); var json = JSON.parse(data.toString()); json.activationEvents = ["*"]; fs.writeFile(pkgPath, JSON.stringify(json), function (err) { if (err) - return vscode.window.showErrorMessage("Failed to reload. Reload manually and run some code-d command!"); + return vscode.window.showErrorMessage(reloadFail); context.globalState.update("restorePackageBackup", true); vscode.commands.executeCommand("vscode.openFolder"); }); @@ -107,12 +112,12 @@ export function performTemplateCopy(context: vscode.ExtensionContext, templateNa ncp(path.join(context.extensionPath, "templates", templateName), resultPath, { clobber: false }, function (err) { if (err) { console.log(err); - return vscode.window.showErrorMessage("Failed to copy template"); + return vscode.window.showErrorMessage(localize("d.projects.copyFail", "Failed to copy template")); } fs.writeFile(path.join(resultPath, "dub.json"), JSON.stringify(dubJson, null, '\t'), function (err) { if (err) { console.log(err); - return vscode.window.showErrorMessage("Failed to generate dub.json"); + return vscode.window.showErrorMessage(localize("d.projects.dubFail", "Failed to generate dub.json")); } callback(); }); diff --git a/src/statusbar.ts b/src/statusbar.ts index 313432e..0f4785c 100644 --- a/src/statusbar.ts +++ b/src/statusbar.ts @@ -1,6 +1,7 @@ import * as vscode from 'vscode'; import { D_MODE } from "./dmode" import { WorkspaceD } from "./workspace-d" +import { localize } from "./extension" export function setup(workspaced: WorkspaceD): vscode.Disposable { let subscriptions: vscode.Disposable[] = []; @@ -24,7 +25,7 @@ class ConfigSelector implements vscode.Disposable { private create() { this.item = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left, 0.92145); this.item.command = "code-d.switchConfiguration"; - this.item.tooltip = "Switch Configuration"; + this.item.tooltip = localize("d.action.switchConfiguration", "Switch Configuration"); this.item.show(); this.workspaced.on("configuration-change", config => { this.item.text = config; @@ -50,7 +51,7 @@ class ArchSelector implements vscode.Disposable { private create() { this.item = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left, 0.92144); this.item.command = "code-d.switchArchType"; - this.item.tooltip = "Switch Arch Type"; + this.item.tooltip = localize("d.action.switchArchType", "Switch Arch Type"); this.item.show(); this.workspaced.on("arch-type-change", arch => { this.item.text = arch; @@ -76,7 +77,7 @@ class BuildSelector implements vscode.Disposable { private create() { this.item = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left, 0.92143); this.item.command = "code-d.switchBuildType"; - this.item.tooltip = "Switch Build Type"; + this.item.tooltip = localize("d.action.switchBuildType", "Switch Build Type"); this.item.show(); this.workspaced.on("build-type-change", config => { this.item.text = config; @@ -102,7 +103,7 @@ class CompilerSelector implements vscode.Disposable { private create() { this.item = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left, 0.92142); this.item.command = "code-d.switchCompiler"; - this.item.tooltip = "Switch Compiler"; + this.item.tooltip = localize("d.action.switchCompiler", "Switch Compiler"); this.item.show(); this.workspaced.on("compiler-change", config => { this.item.text = config; From e8aa005c2a633e9f8abe81e53e8efffd466978e6 Mon Sep 17 00:00:00 2001 From: WebFreak001 Date: Tue, 3 Jan 2017 22:23:44 +0100 Subject: [PATCH 3/6] Added missing translations for extension.ts --- package.nls.de.json | 30 ++++++++++++- package.nls.json | 28 +++++++++++++ src/extension.ts | 100 +++++++++++++++++++++++--------------------- 3 files changed, 110 insertions(+), 48 deletions(-) diff --git a/package.nls.de.json b/package.nls.de.json index aff2069..f411014 100644 --- a/package.nls.de.json +++ b/package.nls.de.json @@ -66,7 +66,7 @@ "d.config.dfmt.templateConstraintStyle": "Formatierung von Template Constraints einstellen.", "d.ext.openUserSettings": "Benutzereinstellungen öffnen", - "d.ext.workspacedENOENT": "workspace-d ist nicht installed oder Einstellung zeigt auf einen Ordner", + "d.ext.workspacedENOENT": "workspace-d ist nicht installiert oder Pfad zeigt auf keine ausführbare Datei", "d.ext.workspacedENOENT.retry": "Wiederholen", "d.ext.workspacedENOENT.install": "workspace-d installieren", "d.ext.workspacedCrash": "workspace-d ist abgestürtzt. Falls der dcd-server Prozess noch läuft, bitte töten!", @@ -94,6 +94,33 @@ "d.ext.fsworkspaceFail": "Konnte fsworkspace nicht starten. In die Entwicklertools umschalten für Details.", "d.ext.dcdFail": "Konnte DCD nicht starten. In die Entwicklertools umschalten für Details.", "d.ext.gcLens": "{0} Bytes allocated / {1} Allocation", + "d.ext.stdlibNoPhobosNoDRuntime": "d.stdlibPath Einstellung enthält keinen Eintrag für phobos und druntime. Autovervollständigung könnte Lücken aufweisen!", + "d.ext.stdlibNoPhobos": "d.stdlibPath Einstellung enthält keinen Eintrag für phobos. Autovervollständigung könnte Lücken aufweisen!", + "d.ext.stdlibNoDRuntime": "d.stdlibPath Einstellung enthält keinen Eintrag für druntime. Autovervollständigung könnte Lücken aufweisen!", + "d.ext.stdlibInvalidPath": "Ein Eintrag in der d.stdlibPath Einstellung existiert nicht. Autovervollständigung könnte Lücken aufweisen!", + "d.ext.exeIsDir": "{0} zeigt auf einen Ordner", + "d.ext.exeENOENT": "{0} ist nicht installiert oder konnte nicht gefunden werden", + "d.ext.compileProgram": "{0} Kompilieren", + "d.ext.downloadProgram": "{0} Downloaden", + "d.ext.dubUpgradeFail": "Konnte nicht dub upgrade durchführen", + "d.ext.dubImportFail": "Konnte keine Importpfäde finden. Bitte Einstellungen in der Statusleiste überprüfen.", + "d.ext.configSwitchFail": "Konfiguration konnte nicht gewechselt werden. In die Entwicklertools umschalten für Details.", + "d.ext.archSwitchFail": "Architektur konnte nicht gewechselt werden. In die Entwicklertools umschalten für Details.", + "d.ext.buildTypeSwitchFail": "Build Type konnte nicht gewechselt werden. In die Entwicklertools umschalten für Details.", + "d.ext.compilerPrompt": "Enter compiler identifier. (e.g. dmd, ldc2, gdc)", + "d.ext.compilerSwitchFail": "Compiler konnte nicht gewechselt werden. In die Entwicklertools umschalten für Details.", + "d.ext.dcd.restart": "Neustarten", + "d.ext.dcdKillFail": "Konnte nicht DCD-Server beenden. In die Entwicklertools umschalten für Details.", + "d.ext.dcdRestarted": "DCD-Server neugestartet", + "d.ext.importsReloaded": "Importpfäde erfolgreich neugeladen", + "d.ext.importsEmpty": "Keine Importpfäde vorhanden!", + "d.ext.manualReloadFail": "Konnte Importpfäde nicht neu laden. dub ist vielleicht noch nicht komplett initialisiert!", + "d.ext.workspacedNotReady": "workspace-d ist noch nicht bereit", + "d.ext.importAddFail": "import konnte nicht hinzugefügt werden", + "d.ext.rdmdTitle": "rdmd Ausgabe", + "d.ext.uploader.noCode": "Keinen code ausgewählt", + "d.ext.uploader.success": "Code hochgeladen auf {0}", + "d.ext.uploader.fail": "Fehler beim Hochladen der Auswahl. In die Entwicklertools umschalten für Details.", "d.projects.readFail": "Konnte template Liste nicht lesen", "d.projects.selectFolderInstruction": "Wählen Sie einen leeren Ordner indem das Projekt erstellt werden soll aus", @@ -122,6 +149,7 @@ "d.installer.compileDone": "Erfolgreich kompiliert", "d.installer.removingOld": "Entferne alte Version", "d.installer.removedOld": "alte Version entfernt", + "d.installer.restoreFail": "Konnte code-d Extension nicht wiederherstellen! code-d bitte bei Problemen vor dem Melden neu installieren!", "d.dub.notFound": "Package nicht gefunden", "d.dub.noVersions": "Keine Versionen vorhanden", diff --git a/package.nls.json b/package.nls.json index 61cfca5..753a8f4 100644 --- a/package.nls.json +++ b/package.nls.json @@ -94,6 +94,33 @@ "d.ext.fsworkspaceFail": "Could not initialize fsworkspace. See console for details!", "d.ext.dcdFail": "Could not initialize DCD. See console for details!", "d.ext.gcLens": "{0} bytes allocated / {1} allocations", + "d.ext.stdlibNoPhobosNoDRuntime": "Your d.stdlibPath setting doesn't contain a path to phobos or druntime. Auto completion might lack some symbols!", + "d.ext.stdlibNoPhobos": "Your d.stdlibPath setting doesn't contain a path to phobos. Auto completion might lack some symbols!", + "d.ext.stdlibNoDRuntime": "Your d.stdlibPath setting doesn't contain a path to druntime. Auto completion might lack some symbols!", + "d.ext.stdlibInvalidPath": "A path in your d.stdlibPath setting doesn't exist. Auto completion might lack some symbols!", + "d.ext.exeIsDir": "{0} points to a directory", + "d.ext.exeENOENT": "{0} is not installed or couldn't be found", + "d.ext.compileProgram": "Compile {0}", + "d.ext.downloadProgram": "Download {0}", + "d.ext.dubUpgradeFail": "Could not upgrade dub project", + "d.ext.dubImportFail": "Could not update import paths. Please check your build settings in the status bar.", + "d.ext.configSwitchFail": "Failed to switch configuration. See console for details.", + "d.ext.archSwitchFail": "Failed to switch arch type. See console for details.", + "d.ext.buildTypeSwitchFail": "Failed to switch build type. See console for details.", + "d.ext.compilerPrompt": "Enter compiler identifier. (e.g. dmd, ldc2, gdc)", + "d.ext.compilerSwitchFail": "Failed to switch compiler. See console for details.", + "d.ext.dcd.restart": "Restart", + "d.ext.dcdKillFail": "Failed to kill DCD-Server. See console for details.", + "d.ext.dcdRestarted": "Restarted DCD-Server", + "d.ext.importsReloaded": "Successfully reloaded import paths", + "d.ext.importsEmpty": "Import paths are empty!", + "d.ext.manualReloadFail": "Could not update imports. dub might not be initialized yet!", + "d.ext.workspacedNotReady": "workspace-d not ready yet", + "d.ext.importAddFail": "Could not add import", + "d.ext.rdmdTitle": "rdmd Output", + "d.ext.uploader.noCode": "No code selected", + "d.ext.uploader.success": "Code pasted on {0}", + "d.ext.uploader.fail": "Failed to upload selection. See console for details.", "d.projects.readFail": "Failed to read template list", "d.projects.selectFolderInstruction": "Select an empty folder to create the project in", @@ -122,6 +149,7 @@ "d.installer.compileDone": "Done compiling", "d.installer.removingOld": "Removing old version", "d.installer.removedOld": "Removed old version", + "d.installer.restoreFail": "Failed to restore after reload! Please reinstall code-d if problems occur before reporting!", "d.dub.notFound": "Package not found", "d.dub.noVersions": "No versions found", diff --git a/src/extension.ts b/src/extension.ts index d5a0e2b..ebc955b 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -37,12 +37,13 @@ export function activate(context: vscode.ExtensionContext) { if (context.globalState.get("restorePackageBackup", false)) { context.globalState.update("restorePackageBackup", false); var pkgPath = path.join(context.extensionPath, "package.json"); + var restoreFail = localize("d.installer.restoreFail", "Failed to restore after reload! Please reinstall code-d if problems occur before reporting!"); fs.readFile(pkgPath + ".bak", function (err, data) { if (err) - return vscode.window.showErrorMessage("Failed to restore after reload! Please reinstall code-d if problems occur before reporting!"); + return vscode.window.showErrorMessage(restoreFail); fs.writeFile(pkgPath, data, function (err) { if (err) - return vscode.window.showErrorMessage("Failed to restore after reload! Please reinstall code-d if problems occur before reporting!"); + return vscode.window.showErrorMessage(restoreFail); fs.unlink(pkgPath + ".bak", function (err) { console.error(err); }); @@ -50,13 +51,14 @@ export function activate(context: vscode.ExtensionContext) { }); } + var openUserSettings = localize("d.ext.openUserSettings", "Open User Settings"); { var phobosPath = config().get("stdlibPath", ["/usr/include/dmd/druntime/import", "/usr/include/dmd/phobos"]); var foundCore = false; var foundStd = false; var someError = false; var userSettings = (r) => { - if (r == "Open User Settings") + if (r == openUserSettings) vscode.commands.executeCommand("workbench.action.openGlobalSettings"); }; var i = 0; @@ -73,16 +75,16 @@ export function activate(context: vscode.ExtensionContext) { fn(); else { if (!foundStd && !foundCore) - vscode.window.showWarningMessage("Your d.stdlibPath setting doesn't contain a path to phobos or druntime. Auto completion might lack some symbols!", "Open User Settings").then(userSettings); + vscode.window.showWarningMessage(localize("d.ext.stdlibNoPhobosNoDRuntime", "Your d.stdlibPath setting doesn't contain a path to phobos or druntime. Auto completion might lack some symbols!"), openUserSettings).then(userSettings); else if (!foundStd) - vscode.window.showWarningMessage("Your d.stdlibPath setting doesn't contain a path to phobos. Auto completion might lack some symbols!", "Open User Settings").then(userSettings); + vscode.window.showWarningMessage(localize("d.ext.stdlibNoPhobos", "Your d.stdlibPath setting doesn't contain a path to phobos. Auto completion might lack some symbols!"), openUserSettings).then(userSettings); else if (!foundCore) - vscode.window.showWarningMessage("Your d.stdlibPath setting doesn't contain a path to druntime. Auto completion might lack some symbols!", "Open User Settings").then(userSettings); + vscode.window.showWarningMessage(localize("d.ext.stdlibNoDRuntime", "Your d.stdlibPath setting doesn't contain a path to druntime. Auto completion might lack some symbols!"), openUserSettings).then(userSettings); } }); } else - vscode.window.showWarningMessage("A path in your d.stdlibPath setting doesn't exist. Auto completion might lack some symbols!", "Open User Settings").then(userSettings); + vscode.window.showWarningMessage(localize("d.ext.stdlibInvalidPath", "A path in your d.stdlibPath setting doesn't exist. Auto completion might lack some symbols!"), openUserSettings).then(userSettings); }); }; fn(); @@ -150,24 +152,25 @@ export function activate(context: vscode.ExtensionContext) { extensionContext.globalState.update("dub_path", ""); } - function checkProgram(configName, defaultPath, name, installFunc, btn = "Compile") { + function checkProgram(configName, defaultPath, name, installFunc, action = "compile") { var version = ""; ChildProcess.spawn(config().get(configName, defaultPath), ["--version"], { cwd: vscode.workspace.rootPath, env: env }).on("error", function (err) { if (err && (err).code == "ENOENT") { var isDirectory = false; try { isDirectory = fs.statSync(config().get(configName, "")).isDirectory(); - } catch (e) {} + } catch (e) { } if (isDirectory) { - vscode.window.showErrorMessage(name + " points to a directory", "Open User Settings").then(s => { - if (s == "Open User Settings") + vscode.window.showErrorMessage(localize("d.ext.exeIsDir", "{0} points to a directory", name), openUserSettings).then(s => { + if (s == openUserSettings) vscode.commands.executeCommand("workbench.action.openGlobalSettings"); }); } else { - vscode.window.showErrorMessage(name + " is not installed or couldn't be found", btn + " " + name, "Open User Settings").then(s => { - if (s == "Open User Settings") + var actionBtn = localize("d.ext." + action + "Program", action + " {0}", name); + vscode.window.showErrorMessage(localize("d.ext.exeENOENT", "{0} is not installed or couldn't be found", name), actionBtn, openUserSettings).then(s => { + if (s == openUserSettings) vscode.commands.executeCommand("workbench.action.openGlobalSettings"); - else if (s == btn + " " + name) + else if (s == actionBtn) installFunc(env); }); } @@ -182,16 +185,16 @@ export function activate(context: vscode.ExtensionContext) { checkProgram("dfmtPath", "dfmt", "dfmt", compileDfmt); // client is good enough checkProgram("dcdClientPath", "dcd-client", "DCD", compileDCD); - checkProgram("dubPath", "dub", "dub", downloadDub, "Download"); + checkProgram("dubPath", "dub", "dub", downloadDub, "download"); } function upgradeDubPackage(document: vscode.TextDocument) { if (path.relative(vscode.workspace.rootPath, document.fileName) == "dub.json" || path.relative(vscode.workspace.rootPath, document.fileName) == "dub.sdl") { workspaced.upgrade().then(() => { }, (err) => { - vscode.window.showWarningMessage("Could not upgrade dub project"); + vscode.window.showWarningMessage(localize("d.ext.dubUpgradeFail", "Could not upgrade dub project")); }); workspaced.updateImports().then(() => { }, (err) => { - vscode.window.showWarningMessage("Could not update import paths. Please check your build settings in the status bar."); + vscode.window.showWarningMessage(localize("d.ext.dubImportFail", "Could not update import paths. Please check your build settings in the status bar.")); }); } } @@ -273,7 +276,7 @@ export function activate(context: vscode.ExtensionContext) { }); }, (err) => { console.error(err); - vscode.window.showErrorMessage("Failed to switch configuration. See console for details."); + vscode.window.showErrorMessage(localize("d.ext.configSwitchFail", "Failed to switch configuration. See console for details.")); })); context.subscriptions.push(vscode.commands.registerCommand("code-d.switchArchType", () => { @@ -283,7 +286,7 @@ export function activate(context: vscode.ExtensionContext) { }); }, (err) => { console.error(err); - vscode.window.showErrorMessage("Failed to switch arch type. See console for details."); + vscode.window.showErrorMessage(localize("d.ext.archSwitchFail", "Failed to switch arch type. See console for details.")); })); context.subscriptions.push(vscode.commands.registerCommand("code-d.switchBuildType", () => { @@ -293,57 +296,57 @@ export function activate(context: vscode.ExtensionContext) { }); }, (err) => { console.error(err); - vscode.window.showErrorMessage("Failed to switch build type. See console for details."); + vscode.window.showErrorMessage(localize("d.ext.buildTypeSwitchFail", "Failed to switch build type. See console for details.")); })); context.subscriptions.push(vscode.commands.registerCommand("code-d.switchCompiler", () => { workspaced.getCompiler().then(compiler => { - vscode.window.showInputBox({ value: compiler, prompt: "Enter compiler identifier. (e.g. dmd, ldc2, gdc)" }).then(compiler => { + vscode.window.showInputBox({ value: compiler, prompt: localize("d.ext.compilerPrompt", "Enter compiler identifier. (e.g. dmd, ldc2, gdc)") }).then(compiler => { if (compiler) workspaced.setCompiler(compiler); }); }, (err) => { console.error(err); - vscode.window.showErrorMessage("Failed to switch compiler. See console for details."); + vscode.window.showErrorMessage(localize("d.ext.compilerSwitchFail", "Failed to switch compiler. See console for details.")); }); })); context.subscriptions.push(vscode.commands.registerCommand("code-d.killServer", () => { workspaced.killServer().then((res) => { - vscode.window.showInformationMessage("Killed DCD-Server", "Restart").then((pick) => { - if (pick == "Restart") + vscode.window.showInformationMessage("Killed DCD-Server", localize("d.ext.dcd.restart", "Restart")).then((pick) => { + if (pick == localize("d.ext.dcd.restart", "Restart")) vscode.commands.executeCommand("code-d.restartServer"); }); }, (err) => { console.error(err); - vscode.window.showErrorMessage("Failed to kill DCD-Server. See console for details."); + vscode.window.showErrorMessage(localize("d.ext.dcdKillFail", "Failed to kill DCD-Server. See console for details.")); }); })); context.subscriptions.push(vscode.commands.registerCommand("code-d.restartServer", () => { workspaced.restartServer().then((res) => { - vscode.window.showInformationMessage("Restarted DCD-Server"); + vscode.window.showInformationMessage(localize("d.ext.dcdRestarted", "Restarted DCD-Server")); }, (err) => { console.error(err); - vscode.window.showErrorMessage("Failed to kill DCD-Server. See console for details."); + vscode.window.showErrorMessage(localize("d.ext.dcdKillFail", "Failed to kill DCD-Server. See console for details.")); }); })); context.subscriptions.push(vscode.commands.registerCommand("code-d.reloadImports", () => { workspaced.updateImports().then((success) => { if (success) - vscode.window.showInformationMessage("Successfully reloaded import paths"); + vscode.window.showInformationMessage(localize("d.ext.importsReloaded", "Successfully reloaded import paths")); else - vscode.window.showWarningMessage("Import paths are empty!"); + vscode.window.showWarningMessage(localize("d.ext.importsEmpty", "Import paths are empty!")); }, (err) => { - vscode.window.showErrorMessage("Could not update imports. dub might not be initialized yet!"); + vscode.window.showErrorMessage(localize("d.ext.manualReloadFail", "Could not update imports. dub might not be initialized yet!")); }); })); context.subscriptions.push(vscode.commands.registerTextEditorCommand("code-d.addImport", (editor, edit, name, location) => { workspaced.addImport(editor.document.getText(), name, location).then((change) => { if (!workspaced.importerReady) - return vscode.window.showWarningMessage("workspace-d not ready yet"); + return vscode.window.showWarningMessage(localize("d.ext.workspacedNotReady", "workspace-d not ready yet")); console.log("Importer resolve: " + JSON.stringify(change)); if (change.rename) // no renames from addImport command return; @@ -360,7 +363,7 @@ export function activate(context: vscode.ExtensionContext) { console.log("Done"); }); }, (err) => { - vscode.window.showErrorMessage("Could not add import"); + vscode.window.showErrorMessage(localize("d.ext.importAddFail", "Could not add import")); console.error(err); }); })); @@ -429,7 +432,7 @@ export function activate(context: vscode.ExtensionContext) { args = [vscode.window.activeTextEditor.document.fileName]; if (!rdmdTerminal) - rdmdTerminal = vscode.window.createTerminal("rdmd Output"); + rdmdTerminal = vscode.window.createTerminal(localize("d.ext.rdmdTitle", "rdmd Output")); rdmdTerminal.show(); rdmdTerminal.sendText("rdmd " + args.join(" ")); })); @@ -443,7 +446,7 @@ export function activate(context: vscode.ExtensionContext) { context.globalState.update("create-template", undefined); fs.readFile(path.join(context.extensionPath, "templates", "info.json"), function (err, data) { if (err) - return vscode.window.showErrorMessage("Failed to parse templates"); + return vscode.window.showErrorMessage(localize("d.projects.readFail", "Failed to read template list")); var templates = JSON.parse(data.toString()); for (var i = 0; i < templates.length; i++) if (templates[i].path == id) { @@ -453,16 +456,19 @@ export function activate(context: vscode.ExtensionContext) { vscode.commands.executeCommand("workbench.action.reloadWindow"); }); else - vscode.window.showWarningMessage("The current workspace is not empty!", "Select other Folder", "Merge into Folder").then(r => { - if (r == "Select other Folder") { - context.globalState.update("create-template", id); - openFolderWithExtension(context); - } else if (r == "Merge into Folder") { - performTemplateCopy(context, id, templates[i].dub, vscode.workspace.rootPath, function () { - vscode.commands.executeCommand("workbench.action.reloadWindow"); - }); - } - }); + vscode.window.showWarningMessage( + localize("d.projects.folderNotEmpty", "The current workspace is not empty!"), + localize("d.projects.selectOtherFolder", "Select other Folder"), + localize("d.projects.mergeFolder", "Merge into Folder")).then(r => { + if (r == localize("d.projects.selectOtherFolder", "Select other Folder")) { + context.globalState.update("create-template", id); + openFolderWithExtension(context); + } else if (r == localize("d.projects.mergeFolder", "Merge into Folder")) { + performTemplateCopy(context, id, templates[i].dub, vscode.workspace.rootPath, function () { + vscode.commands.executeCommand("workbench.action.reloadWindow"); + }); + } + }); }); return; } @@ -471,18 +477,18 @@ export function activate(context: vscode.ExtensionContext) { context.subscriptions.push(vscode.commands.registerCommand("code-d.uploadSelection", () => { if (vscode.window.activeTextEditor.selection.isEmpty) - vscode.window.showErrorMessage("No code selected"); + vscode.window.showErrorMessage(localize("d.ext.uploader.noCode", "No code selected")); else { let code = vscode.window.activeTextEditor.document.getText(vscode.window.activeTextEditor.selection); let name = path.basename(vscode.window.activeTextEditor.document.fileName); let syntax = vscode.window.activeTextEditor.document.languageId; uploadCode(name, syntax, code).then((url) => { - vscode.window.showInformationMessage("Code pasted on " + url); + vscode.window.showInformationMessage(localize("d.ext.uploader.success", "Code pasted on {0}", url)); }); } }, (err) => { console.error(err); - vscode.window.showErrorMessage("Failed to switch configuration. See console for details."); + vscode.window.showErrorMessage(localize("d.ext.uploader.fail", "Failed to upload selection. See console for details.")); })); context.subscriptions.push(vscode.commands.registerCommand("code-d.insertDscanner", () => { From 0a1ae49733eb8bedfba8aaa9475f03a407087e8a Mon Sep 17 00:00:00 2001 From: Seiji Fujita Date: Sun, 29 Jan 2017 12:20:07 +0900 Subject: [PATCH 4/6] add package.nls.ja.json --- package.nls.ja.json | 97 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 package.nls.ja.json diff --git a/package.nls.ja.json b/package.nls.ja.json new file mode 100644 index 0000000..51d73b5 --- /dev/null +++ b/package.nls.ja.json @@ -0,0 +1,97 @@ +{ + "d.switchConfiguration": "code-d: 設定の切替", + "d.action.switchConfiguration": "設定の切替", + "d.switchArchType": "code-d: アーキテクチャタイプの切替", + "d.action.switchArchType": "アーキテクチャタイプの切替", + "d.switchBuildType": "code-d: ビルドタイプの切替", + "d.action.switchBuildType": "ビルドタイプの切替", + "d.switchCompiler": "code-d: コンパイラの切替", + "d.action.switchCompiler": "コンパイラの切替", + "d.killServer": "code-d: DCD Server の強制終了", + "d.action.killServer": "DCD Server の強制終了", + "d.restartServer": "code-d: DCD Server の再起動", + "d.action.restartServer": "DCD Server の再起動", + "d.reloadImports": "code-d: インポートパスの再読み込み", + "d.action.reloadImports": "インポートパスの再読み込み", + "d.run": "code-d: プロジェクトを実行", + "d.action.run": "プロジェクトを実行", + "d.build": "code-d: プロジェクトをビルド", + "d.action.build": "プロジェクトをビルド", + "d.stop": "code-d: ビルドを停止", + "d.action.stop": "ビルドを停止", + "d.debug": "code-d: code-debug を使用してプロジェクトをデバッグ", + "d.action.debug": "code-debug を使用してプロジェクトをデバッグ", + "d.uploadSelection": "code-d: エディタで選択した部分を dpaste.com にアップロード", + "d.action.uploadSelection": "エディタで選択した部分を dpaste.com にアップロード", + "d.insertDscanner": "code-d: デフォルトの dscanner.ini を挿入する", + "d.action.insertDscanner": "デフォルトの dscanner.ini を挿入する", + "d.rdmdCurrent": "rdmd で実行", + "d.generateCoverageReport": "code-d: コードカバレッジレポートを生成", + "d.action.generateCoverageReport": "コードカバレッジレポートを生成", + "d.showGCCalls": "code-d: GCコールを表示する(profilegc.log)", + "d.action.showGCCalls": "GCコールを表示する(pofilegc.log)", + "dub.openSettingsEditor": "code-d/dub: プロジェクト設定を開く", + "dub.action.openSettingsEditor": "プロジェクト設定を開く", + "dub.closeSettingsEditor": "code-d/dub: プロジェクト設定を閉じる", + "dub.action.closeSettingsEditor": "プロジェクト設定を閉じる", + "d.createProject": "code-d: 新しいプロジェクトを作成", + "d.action.createProject": "新しいプロジェクトを作成", + + "d.config.workspacedPath": "workspace-d のファイルのパスを設定します 環境変数PATHに設定されている、または code-d でインストールした場合は省略できます", + "d.config.stdlibPath": "標準ライブラリ(Phobos,D Runtime)のフルパスの配列を設定します、指定しない場合はオートコンプレートは動作できません", + "d.config.dcdClientPath": "dcd-client のファイルのパスを設定します 環境変数PATHに設定されている、または code-d でインストールした場合は省略できます", + "d.config.dcdServerPath": "dcd-server のファイルのパスを設定します 環境変数PATHに設定されている、または code-d でインストールした場合は省略できます", + "d.config.dscannerPath": "dscanner のファイルのパスを設定します 環境変数PATHに設定されている、または code-d でインストールした場合は省略できます", + "d.config.dfmtPath": "dfmt のファイルのパスを設定します 環境変数PATHに設定されている、または code-d でインストールした場合は省略できます", + "d.config.dubPath": "dub のファイルのパスを設定します 環境変数PATHに設定されている、または code-d でインストールした場合は省略できます", + "d.config.enableLinting": "構文チェック(Linting)を有効にします", + "d.config.enableSDLLinting": "dub.sdl ファイルの構文チェック(Linting)を有効にします", + "d.config.enableDubLinting": "dub が行う構文チェック(Linting)を有効にします", + "d.config.enableAutoComplete": "オートコンプレートの dcd-server/dcd-client をスタートアップします", + + "d.config.neverUseDub": "true の場合は、projectImportPaths を有効化します", + "d.config.projectImportPaths": "通常のソースパスは source, src に固定されていますが、この設定を行うとこによりソースパスを変更することができます neverUseDub を true に設定する事により有効化します", + + "d.config.dubConfiguration": "dub のデフォルトを設定します", + "d.config.dubArchType": "dub arch type のデフォルト値を設定します", + "d.config.dubBuildType": "dub build type のデフォルト値を設定します", + "d.config.dubCompiler": "dub compiler のデフォルト値を設定します", + "d.config.disableWorkspaceD": "code-d の機能を無効にします(debug用)", + "d.config.overrideDfmtEditorconfig": "dfmt の設定をvscodeの設定で上書きします(maxLineLength,softMaxLineLength)", + "d.config.dfmt.alignSwitchStatements": "dfmt はまだ未実装です", + "d.config.dfmt.braceStyle": "dfmt インデントスタイルを選択します[allman, otbs, stroustrup] 詳しくは https://en.wikipedia.org/wiki/Brace_style ", + "d.config.dfmt.outdentAttributes": "dfmt はまだ未実装です", + "d.config.dfmt.spaceAfterCast": "dfmt cast()式 のあとにスペースを入れます", + "d.config.dfmt.splitOperatorAtLineEnd": "dfmt 行の分割するときは、前の行に演算子を配置します", + "d.config.dfmt.selectiveImportSpace": "dfmt import文のモジュール指定のセパレータ(:)にスベースを挿入します", + "d.config.dfmt.compactLabeledStatements": "dfmt switch, for, foreach, while文と同じラインにラベルを配置します", + "d.config.dfmt.templateConstraintStyle": "dfmt template文のフォーマットの動作を指定します", + "d.ext.openUserSettings": "ユーザ設定を開く", + "d.ext.workspacedENOENT": "workspace-d が起動できません", + "d.ext.workspacedENOENT.retry": "リトライ", + "d.ext.workspacedENOENT.install": "workspace-d をインストールする", + "d.ext.workspacedCrash": "workspace-d クラッシュしました もし必要があれば dcd-server 再起動してください", + "d.ext.workspaced.restart": "リスタート", + "d.ext.importModule": "Import {0}", + "d.ext.noImportPaths.project": "このプロジェクトで使用できるインポートパスはありません オートコンプリートが機能していない可能性があります", + "d.ext.noImportPaths.buildType": "このビルドタイプで使用できるインポートパスはありません オートコンプリートが機能していない可能性があります", + "d.ext.noConfigurations.project": "このプロジェクトで使用できる設定はありません オートコンプリートが機能していない可能性があります", + "d.ext.compilerFail": "コンパイラの設定を切り替えられませんでした", + "d.ext.archFail": "アーキテクチャタイプの設定を切り替えられませんでした", + "d.ext.ultimateArchFail": "アーキテクチャタイプの設定を切り替えることができませんでした 詳細については console を参照してください", + "d.ext.dcdUpdateFail": "DCDを更新できませんでした。 正しく動作しない場合はDCDを再起動してください", + "d.ext.workspacedUnresponsive": "workspace-d が応答しません オートコンプリートが機能していない可能性があります", + "d.ext.workspacedUnkillable": "workspace-d を強制終了できませんでした 手動で強制停止(kill)してください! PID: {0}", + "d.ext.workspacedOutdated.major": "workspace-d は古い可能性があります 更新してください (target={0}, workspaced={1})", + "d.ext.workspacedOutdated.minor": "workspace-d は古い可能性があります 正常に機能しない場合は更新してください (target={0}, workspaced={1})", + "d.ext.workspacedOutdated.patch": "workspace-d には新しいオプションのアップデートがあります!更新してください (target={0}, workspaced={1})", + "d.ext.workspacedOutdated.unknown": "workspace-d のバージョンを特定できませんでした workspace-d を更新してください!", + "d.ext.workspacedOutdated.install": "最新バージョンをインストールする", + "d.ext.config.invalid.configuration": "指定された設定 '{0}' は利用できませんでした", + "d.ext.config.invalid.archType": "アーキテクチャタイプの設定 '{0}' は利用できませんでした", + "d.ext.config.invalid.buildType": "ビルドタイプの設定 '{0}' は利用できませんでした", + "d.ext.config.invalid.compiler": "コンパイラの設定 '{0}' は利用できませんでした", + "d.ext.dubFail": "dub の初期化に失敗しました", + "d.ext.fsworkspaceFail": "fsworkspace を初期化できませんでした 詳細はコンソールを参照してください", + "d.ext.dcdFail": "DCDを初期化できませんでした 詳細はコンソールを参照してください" +} \ No newline at end of file From 4e1dd471caab33af49339e5319aa54aa3d5eb1e4 Mon Sep 17 00:00:00 2001 From: Seiji Fujita Date: Tue, 31 Jan 2017 01:38:15 +0900 Subject: [PATCH 5/6] add new translation 01/30 --- package.nls.ja.json | 82 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 75 insertions(+), 7 deletions(-) diff --git a/package.nls.ja.json b/package.nls.ja.json index 51d73b5..e1e8095 100644 --- a/package.nls.ja.json +++ b/package.nls.ja.json @@ -11,8 +11,8 @@ "d.action.killServer": "DCD Server の強制終了", "d.restartServer": "code-d: DCD Server の再起動", "d.action.restartServer": "DCD Server の再起動", - "d.reloadImports": "code-d: インポートパスの再読み込み", - "d.action.reloadImports": "インポートパスの再読み込み", + "d.reloadImports": "code-d: インポートパスの再読込み", + "d.action.reloadImports": "インポートパスの再読込み", "d.run": "code-d: プロジェクトを実行", "d.action.run": "プロジェクトを実行", "d.build": "code-d: プロジェクトをビルド", @@ -28,8 +28,8 @@ "d.rdmdCurrent": "rdmd で実行", "d.generateCoverageReport": "code-d: コードカバレッジレポートを生成", "d.action.generateCoverageReport": "コードカバレッジレポートを生成", - "d.showGCCalls": "code-d: GCコールを表示する(profilegc.log)", - "d.action.showGCCalls": "GCコールを表示する(pofilegc.log)", + "d.showGCCalls": "code-d: profilegc.log を表示", + "d.action.showGCCalls": "profilegc.log を表示", "dub.openSettingsEditor": "code-d/dub: プロジェクト設定を開く", "dub.action.openSettingsEditor": "プロジェクト設定を開く", "dub.closeSettingsEditor": "code-d/dub: プロジェクト設定を閉じる", @@ -48,10 +48,8 @@ "d.config.enableSDLLinting": "dub.sdl ファイルの構文チェック(Linting)を有効にします", "d.config.enableDubLinting": "dub が行う構文チェック(Linting)を有効にします", "d.config.enableAutoComplete": "オートコンプレートの dcd-server/dcd-client をスタートアップします", - "d.config.neverUseDub": "true の場合は、projectImportPaths を有効化します", "d.config.projectImportPaths": "通常のソースパスは source, src に固定されていますが、この設定を行うとこによりソースパスを変更することができます neverUseDub を true に設定する事により有効化します", - "d.config.dubConfiguration": "dub のデフォルトを設定します", "d.config.dubArchType": "dub arch type のデフォルト値を設定します", "d.config.dubBuildType": "dub build type のデフォルト値を設定します", @@ -66,6 +64,7 @@ "d.config.dfmt.selectiveImportSpace": "dfmt import文のモジュール指定のセパレータ(:)にスベースを挿入します", "d.config.dfmt.compactLabeledStatements": "dfmt switch, for, foreach, while文と同じラインにラベルを配置します", "d.config.dfmt.templateConstraintStyle": "dfmt template文のフォーマットの動作を指定します", + "d.ext.openUserSettings": "ユーザ設定を開く", "d.ext.workspacedENOENT": "workspace-d が起動できません", "d.ext.workspacedENOENT.retry": "リトライ", @@ -93,5 +92,74 @@ "d.ext.config.invalid.compiler": "コンパイラの設定 '{0}' は利用できませんでした", "d.ext.dubFail": "dub の初期化に失敗しました", "d.ext.fsworkspaceFail": "fsworkspace を初期化できませんでした 詳細はコンソールを参照してください", - "d.ext.dcdFail": "DCDを初期化できませんでした 詳細はコンソールを参照してください" + "d.ext.dcdFail": "DCDを初期化できませんでした 詳細はコンソールを参照してください", + "d.ext.gcLens": "{0} bytes allocated / {1} allocations", + "d.ext.stdlibNoPhobosNoDRuntime": "d.stdlibPath の設定に phobos, druntimeへのパスが含まれていません オートコンプリートが機能していない可能性があります", + "d.ext.stdlibNoPhobos": "d.stdlibPath の設定に phobos へのパスが含まれていません オートコンプリートが機能していない可能性があります", + "d.ext.stdlibNoDRuntime": "d.stdlibPath の設定に druntime へのパスが含まれていません オートコンプリートが機能していない可能性があります", + "d.ext.stdlibInvalidPath": "d.stdlibPath の設定したパスが存在しません オートコンプリートが機能していない可能性があります", + "d.ext.exeIsDir": "{0} はディレクトリを指しています", + "d.ext.exeENOENT": "{0} がインストールされていないか見つかりませんでした", + "d.ext.compileProgram": "コンパイル {0}", + "d.ext.downloadProgram": "ダウンロード {0}", + "d.ext.dubUpgradeFail": "dub プロジェクトをアップグレードできませんでした", + "d.ext.dubImportFail": "dub のインポートパスを更新できませんでした ステータスバーのビルド設定を確認してください", + "d.ext.configSwitchFail": "設定の切替に失敗しました 詳細は console を参照してください", + "d.ext.archSwitchFail": "アーキテクチャタイプの切替に失敗しました 詳細は console を参照してください", + "d.ext.buildTypeSwitchFail": "ビルドタイプの切替に失敗しました 詳細は console を参照してください", + "d.ext.compilerPrompt": "コンパイラの指定(dmd, ldc2, gdc)", + "d.ext.compilerSwitchFail": "コンパイラの切替に失敗しました 詳細は console を参照してください", + "d.ext.dcd.restart": "リスタート", + "d.ext.dcdKillFail": "dcd-Server の強制終了に失敗しました 詳細は console を参照してください", + "d.ext.dcdRestarted": "dcd-server を再起動しました", + "d.ext.importsReloaded": "インポートパスの再読込みに成功しました", + "d.ext.importsEmpty": "インポートの読込みに失敗しました", + "d.ext.manualReloadFail": "インポートの更新ができませんでした dub の初期化に失敗した可能性があります", + "d.ext.workspacedNotReady": "workspace-d まだ準備ができていません", + "d.ext.importAddFail": "インポートの追加に失敗しました", + "d.ext.rdmdTitle": "rdmd アウトプット", + "d.ext.uploader.noCode": "ソースコードが選択されていません", + "d.ext.uploader.success": "アップロード成功 {0}", + "d.ext.uploader.fail": "アップロードに失敗しました 詳細は Console を参照してください", + + "d.projects.readFail": "テンプレートリストの読み込みに失敗しました", + "d.projects.selectFolderInstruction": "プロジェクトを作成するための空のフォルダを選択してください", + "d.projects.selectFolder": "フォルダを選択", + "d.projects.selectOtherFolder": "他のフォルダを選択", + "d.projects.mergeFolder": "フォルダにマージ", + "d.projects.folderNotEmpty": "現在の作業領域は空ではありません", + "d.projects.reloadFail": "プロジェクトの再読み込みに失敗しました", + "d.projects.copyFail": "テンプレートのコピーに失敗しました", + "d.projects.dubFail": "dub.jsonの作成に失敗しました", + + "d.installer.noPrebuiltWorkspaced": "このプラットフォーム用の workspace-d は用意されていません", + "d.installer.noPrebuiltDub": "このプラットフォームでは dub は用意されていません", + "d.installer.compileFromSource": "ソースからコンパイルする", + "d.installer.title": "インストール中 {0}", + "d.installer.installingInto": "インストール中 {0}", + "d.installer.downloadingFrom": "ダウンロード中 {0} - {1}", + "d.installer.downloadProgress": "ダウンロード中 {0}% {1}", + "d.installer.extracting": "展開中 {0}", + "d.installer.deleting": "削除中 {0}", + "d.installer.success": "インストールに成功しました {0}", + "d.installer.reload": "リロード", + "d.installer.extractTarXzFail": ".tar.xz の展開に失敗しました", + "d.installer.extractTarGzFail": ".tar.gz の展開に失敗しました", + "d.installer.error": "インストールに失敗しました {0} (Error code {1})", + "d.installer.compileDone": "コンパイルが終了しました", + "d.installer.removingOld": "古いバージョンを削除中", + "d.installer.removedOld": "古いバージョンを削除しました", + + "d.installer.restoreFail": "code-d のインストールに失敗しました 環境を変更し再度インストールを行ってください", + "d.dub.notFound": "dub パッケージが見つかりません", + "d.dub.noVersions": "dub 適切なバージョンが見つかりません", + "d.dub.packageRelease": "リリース {0}", + "d.dub.docDirty": "dub.json ファイルを保存または閉じて再試行してください", + "d.dub.dubJsonFail": "dub.json は不正な json 形式です", + "d.dub.generateFail": "dub.json の作成に失敗しました", + "d.dub.updateFail": "dub.json のアップデートに失敗しました", + "d.dub.override": "バックアップをしないで上書き", + + "d.coverage.statusText": "{0}% コードカバレッジ", + "d.coverage.tooltip": "コードカバッレジレポート" } \ No newline at end of file From e20811808ea1433859923eca07b1e4a8fe430726 Mon Sep 17 00:00:00 2001 From: Seiji Fujita Date: Tue, 31 Jan 2017 19:47:59 +0900 Subject: [PATCH 6/6] replaced 152 and 153 lines. --- package.nls.ja.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.nls.ja.json b/package.nls.ja.json index e1e8095..224434f 100644 --- a/package.nls.ja.json +++ b/package.nls.ja.json @@ -149,8 +149,8 @@ "d.installer.compileDone": "コンパイルが終了しました", "d.installer.removingOld": "古いバージョンを削除中", "d.installer.removedOld": "古いバージョンを削除しました", - "d.installer.restoreFail": "code-d のインストールに失敗しました 環境を変更し再度インストールを行ってください", + "d.dub.notFound": "dub パッケージが見つかりません", "d.dub.noVersions": "dub 適切なバージョンが見つかりません", "d.dub.packageRelease": "リリース {0}",