Skip to content

Commit dbf1af5

Browse files
authoredJan 22, 2018
Fully-functional editor page (sb#6)
* Style imported * All UI in react components now * Optimize layout * Replace ace editor with monaco editor * Completion Service * Show diagnostics in UI * Add all buttons * Fix CI
1 parent d6f122b commit dbf1af5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+1150
-1427
lines changed
 

‎build/generate-loc-strings.ts

+2-18
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,15 @@
11
import { convertFilePromise } from "./gulp-helpers";
2-
import * as path from "path";
32

43
function generateContents(identifier: string, entries: { [entryName: string]: string }): string {
54
return `// This file is generated through a build task. Do not edit by hand.
65
76
export module ${identifier} {
8-
export enum Keys {
9-
${Object.keys(entries).map(entryName => ` ${entryName}`).join(",\n")}
10-
}
11-
12-
export function toString(key: Keys): string {
13-
switch (key) {${Object.keys(entries).map(entryName => `
14-
case Keys.${entryName}:
15-
return "${entries[entryName]}";`).join("")}
16-
default:
17-
throw new Error("Key not found: " + key);
18-
}
19-
}
7+
${Object.keys(entries).map(entryName => ` export const ${entryName} = "${entries[entryName]}";`).join("\n")}
208
}
219
`;
2210
}
2311

24-
export function generateLocStrings(identifier: string, resource: string): Promise<void> {
25-
const language = "en";
26-
const inputPath = path.resolve(__dirname, `./strings/${language}/${resource}.json`);
27-
const outputPath = path.resolve(__dirname, `../src/compiler/strings/${resource}.ts`);
28-
12+
export function generateLocStrings(identifier: string, inputPath: string, outputPath: string): Promise<void> {
2913
return convertFilePromise(inputPath, outputPath, value => {
3014
return Promise.resolve(generateContents(identifier, JSON.parse(value)));
3115
});

‎build/strings/en/app/editor.json

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"ToolbarButton_New_Title": "New",
3+
"ToolbarButton_New_Description": "Clears the editor and starts a new program",
4+
"ToolbarButton_Publish_Title": "Publish",
5+
"ToolbarButton_Publish_Description": "Get a publish url to share with friends",
6+
"ToolbarButton_Cut_Title": "Cut",
7+
"ToolbarButton_Cut_Description": "Cut selected text",
8+
"ToolbarButton_Copy_Title": "Copy",
9+
"ToolbarButton_Copy_Description": "Copy selected text",
10+
"ToolbarButton_Paste_Title": "Paste",
11+
"ToolbarButton_Paste_Description": "Paste copied text",
12+
"ToolbarButton_Undo_Title": "Undo",
13+
"ToolbarButton_Undo_Description": "Undo last action",
14+
"ToolbarButton_Redo_Title": "Redo",
15+
"ToolbarButton_Redo_Description": "Redo last undone action",
16+
"ToolbarButton_Run_Title": "Run",
17+
"ToolbarButton_Run_Description": "Run this program",
18+
"Modal_ConfirmNew_Text": "Are you sure you want to erase all code and start a new program?",
19+
"Modal_Button_Yes": "Yes",
20+
"Modal_Button_No": "No"
21+
}

0 commit comments

Comments
 (0)
Please sign in to comment.