Commit e8f6eb0d authored by Jonathan Wilkes's avatar Jonathan Wilkes
Browse files

First draft of i18n, plus cleanup of iemgui properties dialogs

parent b0f5f2fe
......@@ -22,6 +22,9 @@
pdgui.set_pd_window(this);
pdgui.set_app_quitfn(app_quit);
// For translations
var l = pdgui.get_local_string;
console.log("Hello from " + pwd);
function app_quit () {
......@@ -154,22 +157,24 @@ function nw_create_pd_window_menus () {
// Add to window menu
windowMenu.append(new nw.MenuItem({
label: 'File',
label: l('menu.file'),
submenu: fileMenu
}));
// File sub-entries
fileMenu.append(new nw.MenuItem({
label: 'New',
label: l('menu.new'),
click: pdgui.menu_new,
key: 'n',
modifiers: "ctrl"
modifiers: 'ctrl',
tooltip: l('menu.new.tt')
}));
fileMenu.append(new nw.MenuItem({
label: 'Open',
label: l('menu.open'),
key: 'o',
modifiers: "ctrl",
tooltip: l('menu.open.tt'),
click: function (){
var chooser = document.querySelector('#fileDialog');
chooser.click();
......@@ -178,7 +183,8 @@ function nw_create_pd_window_menus () {
if (pdgui.k12_mode == 1) {
fileMenu.append(new nw.MenuItem({
label: 'K12 Demos',
label: l('menu.k12.demos'),
tooltip: l('menu.k12.demos_tt'),
click: pdgui.menu_k12_open_demos
}));
}
......@@ -189,18 +195,20 @@ function nw_create_pd_window_menus () {
// Note: this must be different for the main Pd window
fileMenu.append(new nw.MenuItem({
label: 'Save',
label: l('menu.save'),
click: function () {},
enabled: false,
key: 's',
tooltip: l('menu.save.tt'),
modifiers: "ctrl"
}));
fileMenu.append(new nw.MenuItem({
label: 'Save as...',
label: l('menu.saveas'),
click: function (){},
enabled: false,
key: 'S',
tooltip: l('menu.saveas_tt'),
modifiers: "ctrl"
}));
......@@ -211,10 +219,11 @@ function nw_create_pd_window_menus () {
}
fileMenu.append(new nw.MenuItem({
label: 'Message...',
label: l('menu.message'),
click: pdgui.menu_send,
key: 'm',
modifiers: "ctrl"
modifiers: "ctrl",
tooltip: l('menu.message_tt')
}));
if (pdgui.k12_mode == 0) {
......@@ -229,17 +238,18 @@ function nw_create_pd_window_menus () {
// Note: there's no good reason to have this here
fileMenu.append(new nw.MenuItem({
label: 'Close',
label: l('menu.close'),
click: function () {},
enabled: false,
}));
// Quit Pd
fileMenu.append(new nw.MenuItem({
label: 'Quit',
label: l('menu.quit'),
click: pdgui.menu_quit,
key: 'q',
modifiers: "ctrl"
modifiers: "ctrl",
tooltip: l('menu.quit_tt')
}));
......@@ -248,25 +258,27 @@ function nw_create_pd_window_menus () {
// Add to window menu
windowMenu.append(new nw.MenuItem({
label: 'Edit',
label: l('menu.edit'),
submenu: editMenu
}));
// Edit sub-entries
editMenu.append(new nw.MenuItem({
label: 'Copy',
label: l('menu.copy'),
click: pdmenu_copy,
key: 'c',
modifiers: "ctrl"
modifiers: "ctrl",
tooltip: l('menu.copy_tt')
}));
editMenu.append(new nw.MenuItem({
label: 'Select All',
label: l('menu.selectall'),
click: function () {
document.selectAllChildren(document);
},
key: 'a',
modifiers: "ctrl"
modifiers: "ctrl",
tooltip: l('menu.selectall_tt')
}));
editMenu.append(new nw.MenuItem({
......@@ -274,30 +286,33 @@ function nw_create_pd_window_menus () {
}));
editMenu.append(new nw.MenuItem({
label: 'Zoom In',
label: l('menu.zoomin'),
click: function () {
nw.Window.get().zoomLevel += 1;
pdgui.gui_post("zoom level is " + nw.Window.get().zoomLevel);
},
key: '=',
modifiers: "ctrl"
modifiers: "ctrl",
tooltip: l('menu.zoomin_tt')
}));
editMenu.append(new nw.MenuItem({
label: 'Zoom Out',
label: l('menu.zoomout'),
click: function () {
nw.Window.get().zoomLevel -= 1;
pdgui.gui_post("zoom level is " + nw.Window.get().zoomLevel);
},
key: '-',
modifiers: "ctrl"
modifiers: "ctrl",
tooltip: l('menu.zoomout_tt')
}));
editMenu.append(new nw.MenuItem({
label: 'Preferences...',
label: l('menu.preferences'),
click: pdmenu_preferences,
key: 'a',
modifiers: "ctrl"
modifiers: "ctrl",
tooltip: l('menu.preferences_tt')
}));
......@@ -306,23 +321,25 @@ function nw_create_pd_window_menus () {
// Add to windows menu
windowMenu.append(new nw.MenuItem({
label: 'Windows',
label: l('menu.windows'),
submenu: winmanMenu
}));
// Winman sub-entries
winmanMenu.append(new nw.MenuItem({
label: 'Next Window',
label: l('menu.nextwin'),
click: pdmenu_next_win,
key: 'c',
modifiers: "ctrl"
modifiers: "ctrl",
tooltip: l('menu.nextwin_tt')
}));
winmanMenu.append(new nw.MenuItem({
label: 'Previous Window',
label: l('menu.prevwin'),
click: pdmenu_previous_win,
key: 'a',
modifiers: "ctrl"
modifiers: "ctrl",
tooltip: l('menu.prevwin_tt')
}));
winmanMenu.append(new nw.MenuItem({
......@@ -330,17 +347,19 @@ function nw_create_pd_window_menus () {
}));
winmanMenu.append(new nw.MenuItem({
label: 'Parent Window',
label: l('menu.parentwin'),
click: pdmenu_parent_win,
key: 'a',
modifiers: "ctrl"
modifiers: "ctrl",
tooltip: l('menu.parentwin_tt')
}));
winmanMenu.append(new nw.MenuItem({
label: 'Pd & Console',
label: l('menu.pdwin'),
click: pdmenu_console_win,
key: 'a',
modifiers: "ctrl"
modifiers: "ctrl",
tooltip: l('menu.pdwin_tt')
}));
// Media menu
......@@ -348,27 +367,29 @@ function nw_create_pd_window_menus () {
// Add to window menu
windowMenu.append(new nw.MenuItem({
label: 'Media',
label: l('menu.media'),
submenu: mediaMenu
}));
// Media sub-entries
mediaMenu.append(new nw.MenuItem({
label: 'Audio On',
label: l('menu.audio_on'),
click: function() {
pdgui.pdsend("pd dsp 1");
},
key: 'c',
modifiers: "ctrl"
modifiers: "ctrl",
tooltip: l('menu.audio_on_tt')
}));
mediaMenu.append(new nw.MenuItem({
label: 'Audio Off',
label: l('menu.audio_off'),
click: function() {
pdgui.pdsend("pd dsp 0");
},
key: 'a',
modifiers: "ctrl"
modifiers: "ctrl",
tooltip: l('menu.audio_off_tt')
}));
mediaMenu.append(new nw.MenuItem({
......@@ -376,17 +397,19 @@ function nw_create_pd_window_menus () {
}));
mediaMenu.append(new nw.MenuItem({
label: 'Test Audio and Midi',
label: l('menu.test'),
click: pdmenu_test_audio,
key: 'a',
modifiers: "ctrl"
modifiers: "ctrl",
tooltip: l('menu.test_tt')
}));
mediaMenu.append(new nw.MenuItem({
label: 'Load Meter',
label: l('menu.loadmeter'),
click: pdmenu_load_meter,
key: 'a',
modifiers: "ctrl"
modifiers: "ctrl",
tooltip: l('menu.loadmeter_tt')
}));
// Help menu
......@@ -394,30 +417,33 @@ function nw_create_pd_window_menus () {
// Add to window menu
windowMenu.append(new nw.MenuItem({
label: 'Help',
label: l('menu.help'),
submenu: helpMenu
}));
// Help sub-entries
helpMenu.append(new nw.MenuItem({
label: 'About Pd-L2ork',
label: l('menu.about'),
click: pdmenu_about_pd,
key: 'c',
modifiers: "ctrl"
modifiers: "ctrl",
tooltip: l('menu.about_tt')
}));
helpMenu.append(new nw.MenuItem({
label: 'Manual',
label: l('menu.manual'),
click: pdmenu_manual,
key: 'a',
modifiers: "ctrl"
modifiers: "ctrl",
tooltip: l('menu.manual_tt')
}));
helpMenu.append(new nw.MenuItem({
label: 'Help Browser',
label: l('menu.browser'),
click: pdmenu_help_browser,
key: 'a',
modifiers: "ctrl"
modifiers: "ctrl",
tooltip: l('menu.browser_tt')
}));
helpMenu.append(new nw.MenuItem({
......@@ -425,31 +451,35 @@ function nw_create_pd_window_menus () {
}));
helpMenu.append(new nw.MenuItem({
label: 'Pd-L2ork Mailing List',
label: l('menu.l2ork_list'),
click: pdmenu_l2ork_mailinglist,
key: 'a',
modifiers: "ctrl"
modifiers: "ctrl",
tooltip: l('menu.l2ork_list_tt')
}));
helpMenu.append(new nw.MenuItem({
label: 'Pure Data Mailing Lists',
label: l('menu.pd_list'),
click: pdmenu_pd_mailinglists,
key: 'a',
modifiers: "ctrl"
modifiers: "ctrl",
tooltip: l('menu.pd_list_tt')
}));
helpMenu.append(new nw.MenuItem({
label: 'Forums',
label: l('menu.forums'),
click: pdmenu_forums,
key: 'a',
modifiers: "ctrl"
modifiers: "ctrl",
tooltip: l('menu.forums_tt')
}));
helpMenu.append(new nw.MenuItem({
label: 'IRC Chat',
label: l('menu.irc'),
click: pdmenu_irc,
key: 'a',
modifiers: "ctrl"
modifiers: "ctrl",
tooltip: l('menu.irc_tt')
}));
// Assign to window
......
{
"hello": "world",
"iem": {
"prop": {
"heading": {
"size": "size and behavior",
"messages": "messages",
"label": "label",
"colors": "colors"
},
"size_tt": "size of the iemgui",
"size": "size",
"select_size": "selection size",
"select_size_tt": "size of the selection rectangle used to select and drag the object",
"visible_width": "width",
"visible_width_tt": "width of the rectangle",
"visible_height": "height",
"visible_height_tt": "height of the rectangle",
"nonzero_value": "nonzero value",
"nonzero_value_tt": "value to output when the toggle shows an 'x'",
"flash_interrupt": "flash interrupt",
"flash_interrupt_tt": "the amount of time (in milliseconds) that Pd will wait before interrupting the flashing of the button",
"flash_hold": "hold",
"flash_hold_tt": "the amount of time (in milliseconds) that Pd will display the flash animation",
"vu_scale": "scale",
"vu_scale_tt": "display scale (numbers) next to the meter",
"width": "width",
"width_tt": "width of the iemgui in pixels",
"height": "height",
"height_tt": "height of the iemgui in pixels",
"minimum": "minimum",
"minimum_tt": "smallest number to output. Anything lower will be replaced by this number",
"maximum": "maximum",
"maximum_tt": "largest number to output. Anything bigger will be replaced by this number",
"number": "number",
"number_tt": "total number of buttons",
"init": "init",
"init_tt": "save the state of the iemgui with the patch, and output a saved value when loaded (as if you had a [loadbang] connected to the input)",
"log_scale": "logarithmic scaling",
"log_scale_tt": "use logarithmic scale for values along the slider",
"log_height": "log height",
"log_height_tt": "the framus intersects with the ramistan approximately at the podernoster",
"steady": "steady on click",
"steady_tt": "don't move the slider when clicked. Only move it when dragging the mouse",
"send": "send symbol",
"send_tt": "symbol to send wireless messages to other iemguis or objects",
"receive": "receive symbol",
"receive_tt": "symbol to receive wireless messages from other iemguis or objects",
"label": "text",
"label_tt": "text to display next to this iemgui",
"xoffset": "x",
"xoffset_tt": "horizontal offset of the text relative to the top-left corner of the iemgui",
"yoffset": "y",
"yoffset_tt": "vertical offset for the text relative to the top-left corner of the iemgui",
"font": "font",
"font_tt": "which font to use when displaying the label text",
"fontsize": "size",
"fontsize_tt": "size of the font for the label",
"bgcolor": "background",
"bgcolor_tt": "background fill color for the iemgui",
"fgcolor": "foreground",
"fgcolor_tt": "foreground color for the iemgui",
"label_color": "label",
"label_color_tt": "color for the text label",
"ok": "Ok",
"ok_tt": "Apply the settings and close this dialog window",
"apply": "Apply",
"apply_tt": "Apply the settings without closing the dialog",
"cancel": "Cancel",
"cancel_tt": "Close the dialog window"
}
},
"menu": {
"file": "File",
"new": "New",
"new_tt": "Create an empty Pd patch",
"open": "Open",
"open_tt": "Open one or more Pd files",
"k12_demos": "K12 Demos",
"k12_demos_tt": "Demo patches for use with K12 Mode",
"save": "Save",
"save_tt": "Save a Pd patch to disk",
"saveas": "Save as...",
"saveas_tt": "Save a Pd patch by manually choosing a filename",
"message": "Message...",
"message_tt": "Send a message directly to the running Pd instance",
"close": "Close",
"close_tt": "Close patch",
"quit": "Quit",
"quit_tt": "Close all patches and quit the program",
"edit": "Edit",
"undo": "Undo",
"undo_tt": "Undo the last action performed on this patch",
"redo": "Redo",
"redo_tt": "if you clicked undo, this will restore the action that you performed",
"cut": "Cut",
"cut_tt": "Remove the currently selected object or objects on the canvas",
"copy": "Copy",
"copy_tt": "Copy selected objects to the clipboard",
"paste": "Paste",
"paste_tt": "Add any objects to the canvas which wer previously cut or copied",
"duplicate": "Duplicate",
"duplicate_tt": "Paste a copy of the current selection on the canvas (doesn't use clipboard)",
"selectall": "Select All",
"selectall_tt": "Select all objects in a patch",
"reselect": "Reselect",
"reselect_tt": "Restore the previous selection",
"zoomin": "Zoom In",
"zoomin_tt": "Make the patch visually larger",
"zoomout": "Zoom Out",
"zoomout_tt": "Make the patch visually smaller",
"tidyup": "Tidy Up",
"tidyup_tt": "Line up the selected objects in straight rows and columns",
"tofront": "Bring to Front",
"tofront_tt": "Bring the selected object visually in front of all other objects",
"toback": "Send to Back",
"toback_tt": "Send the selected object visually behind all other objects",
"font": "Font",
"font_tt": "Font settings for this patch",
"cordinspector": "Cord Inspector",
"cordinspector_tt": "Move the mouse over cords to inspect the data moving between objects",
"find": "Find",
"find_tt": "Search for an object in this patch",
"findagain": "Find Again",
"findagain_tt": "Search for the next object matching the string you typed",
"finderror": "Find Last Error",
"finderror_tt": "If possible, find the last object which caused an error",
"autotips": "Autotips",
"autotips_tt": "Turn on tooltips in the patch",
"editmode": "Editmode",
"autotips_tt": "Toggle Editmode",
"preferences": "Preferences",
"preferences_tt": "Open a dialog window to configure the running instance of Pd",
"put": "Put",
"object": "Object",
"object_tt": "Add an empty object box to the canvas",
"msgbox": "Message",
"msg_tt": "Add a message box to the canvas",
"number": "Number",
"number_tt": "Add a box to type, scroll, and display a number on the canvas",
"symbol": "Symbol",
"symbol_tt": "Add a box to type and display a symbol on the canvas",
"comment": "Comment",
"comment_tt": "Write a comment on the canvas",
"bang": "Bang",
"bang_tt": "Add a graphical button to the canvas for sending bang messages",
"bang": "Toggle",
"bang_tt": "Add a graphical checkbox to the canvas for toggling between two values",
"number2": "Number2",
"number2_tt": "Add a fancy graphical box to the canvas for displaying and scrolling numbers",
"vslider": "Vslider",
"vslider_tt": "Add a vertical slider to the canvas for scrolling numbers",
"hslider": "Hslider",
"hslider_tt": "Add a horizontal slider to the canvas for scrolling numbers",
"vradio": "Vradio",
"vradio_tt": "Add a vertical group of radio buttons to the canvas for selecting a value",
"hradio": "Hradio",
"hradio_tt": "Add horizontal group of radio buttons to the canvas for selecting a value",
"vu": "VU",
"vu_tt": "Add a Vu Meter to the canvas",
"cnv": "Canvas Rectangle",
"cnv_tt": "Add a boring rectangle to the canvas for displaying a rectangle",
"graph": "Graph",
"graph_tt": "Add an empty graph to the canvas",
"array": "Array",
"array_tt": "Add a visual array object to the canvas (with dialog for settings)",
"windows": "Windows",
"nextwin": "Next Window",
"nextwin_tt": "Give focus to the next open window in the stacking order",
"prevwin": "Previous Window",
"prevwin_tt": "Give focus to the previous window in the stacking order",
"parentwin": "Parent Window",
"parentwin_tt": "give focus to the parent window of the current window",
"pdwin": "Pd & Console",
"pdwin_tt": "Give focus to the main Pd window",
"media": "Media",
"audio_on": "Audio On",
"audio_on_tt": "Turn audio on",
"audio_off": "Audio Off",
"audio_off_tt": "Turn audio off",
"test": "Test Audio and Midi",
"test_tt": "Open a patch to test your audio and midi are configured and functioning correctly",
"loadmeter": "Load Meter",
"loadmeter_tt": "Open a patch to monitor the CPU load of Pd (note: doesn't include the GUI)",
"help": "Help",
"about": "About Pd-L2ork",
"about_tt": "Get information about this version of Pd",
"manual": "Manual",
"manual_tt": "Open the HTML manual for Pd",
"browser": "Help Browser",
"browser_tt": "Open a help browser to search for documentation and objects",
"l2ork_list": "Pd-L2ork Mailing List",
"l2ork_list_tt": "Open a link in a browser for Pd-L2ork Mailing List",
"pd_list": "Pure Data Mailing Lists",
"pd_list_tt": "Open a link in a browser for Pure Data Mailing Lists",
"forums": "Forums",
"forums_tt": "Open a link in a browser for the Pd Forum",
"irc": "IRC Chat",
"irc_tt": "Open a link in a browser for IRC Chat"
}
}
This diff is collapsed.
......@@ -15,11 +15,10 @@ exports.get_pwd = function() {
var fs = require('fs'); // for fs.existsSync
var path = require('path'); // for path.dirname path.extname
var flub = { flash_interrupt_label: "this thing does stuff" };
exports.tr = function(arg) {
return flub[arg];
}
// local strings
var lang = require('./pdlang.js');
exports.get_local_string = lang.get_local_string;
var pd_window;
exports.pd_window;
......@@ -2926,7 +2925,7 @@ function gui_iemgui_dialog(did, attr_array) {
for (var i = 0; i < attr_array.length; i++) {
attr_array[i] = '"' + attr_array[i] + '"';
}
dialogwin[did] = nw_create_window(did, 'pd-properties', 235, 430, 20, 20, 0,
dialogwin[did