Made many more localization fixes/additions

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1895 eee81c28-f429-11dd-99c0-75d572ba1ddd
master
Alexis Deveria 2011-01-03 18:45:36 +00:00
parent 0bc65d35c6
commit 73a4490b1d
5 changed files with 198 additions and 81 deletions

View File

@ -9,6 +9,8 @@
svgEditor.addExtension("imagelib", function() {
var uiStrings = svgEditor.uiStrings;
var img_libs = [{
name: 'Demo library (local)',
url: 'extensions/imagelib/index.html',
@ -89,7 +91,9 @@ svgEditor.addExtension("imagelib", function() {
pending[cur_meta.id] = cur_meta;
var message = 'Retrieving "' + (cur_meta.name || 'file') + '"...';
var name = (cur_meta.name || 'file');
var message = uiStrings.notification.retrieving.replace('%s', name);
if(mode != 'm') {
$.process_cancel(message, function() {
@ -261,13 +265,14 @@ svgEditor.addExtension("imagelib", function() {
}
function showBrowser() {
var browser = $('#imgbrowse');
if(!browser.length) {
$('<div id=imgbrowse_holder><div id=imgbrowse class=toolbar_button>\
</div></div>').insertAfter('#svg_docprops');
browser = $('#imgbrowse');
var all_libs = 'Select an image library';
var all_libs = uiStrings.imagelib.select_lib;
var lib_opts = $('<ul id=imglib_opts>').appendTo(browser);
var frame = $('<iframe/>').prependTo(browser).hide().wrap('<div id=lib_framewrap>');
@ -279,7 +284,7 @@ svgEditor.addExtension("imagelib", function() {
width: '100%'
});
var cancel = $('<button>Cancel</button>').appendTo(browser).click(function() {
var cancel = $('<button>' + uiStrings.common.cancel + '</button>').appendTo(browser).click(function() {
$('#imgbrowse_holder').hide();
}).css({
position: 'absolute',
@ -289,16 +294,19 @@ svgEditor.addExtension("imagelib", function() {
var leftBlock = $('<span>').css({position:'absolute',top:5,left:10}).appendTo(browser);
var back = $('<button hidden>Show library list</button>').appendTo(leftBlock).click(function() {
var back = $('<button hidden>' + uiStrings.imagelib.show_list + '</button>').appendTo(leftBlock).click(function() {
frame.attr('src', 'about:blank').hide();
lib_opts.show();
header.text(all_libs);
back.hide();
}).css({
'margin-right': 5
});
}).hide();
var type = $('<select><option value=s>Import single</option><option value=m>Import multiple</option><option value=o>Open as new document</option></select>').appendTo(leftBlock).change(function() {
var type = $('<select><option value=s>' +
uiStrings.imagelib.import_single + '</option><option value=m>' +
uiStrings.imagelib.import_multi + '</option><option value=o>' +
uiStrings.imagelib.open + '</option></select>').appendTo(leftBlock).change(function() {
mode = $(this).val();
switch (mode) {
case 's':

View File

@ -6,8 +6,9 @@
"key_del": "delete",
"key_down": "down",
"key_up": "up",
"layer": "Layer"
"layer": "Layer",
"more_opts": "More Options",
"url": "URL"
},
misc: {
"copyrightLabel": "Powered by"
@ -130,6 +131,8 @@
"tool_delete": "Delete Element",
"tool_delete_multi": "Delete Selected Elements",
"tool_group": "Group Elements",
"tool_make_link": "Make (hyper)link",
"tool_link_url": "Set link URL (leave empty to remove)",
"tool_topath": "Convert to Path",
"tool_reorient": "Reorient path",
"tool_ungroup": "Ungroup Elements",
@ -149,7 +152,20 @@
"tool_source_save": "Apply Changes",
"tool_eyedropper": "Eye Dropper Tool",
"mode_connect": "Connect two objects"
"mode_connect": "Connect two objects",
"tools_shapelib_show": "Shape library",
"cut": "Cut",
"copy": "Copy",
"paste": "Paste",
"paste_in_place": "Paste in Place",
"delete": "Delete",
"group": "Group",
"ungroup": "Ungroup",
"move_front": "Bring to Front",
"move_up": "Bring Forward",
"move_down": "Send Backward",
"move_back": "Send to Back"
},
layers: {
"layersLabel": "Layers:",
@ -158,9 +174,12 @@
"layer_new": "New Layer",
"layer_rename": "Rename Layer",
"layer_up": "Move Layer Up",
"dupe": "Duplicate Layer",
"merge_down": "Merge Down",
"merge_all": "Merge All",
"selLayerLabel": "Move elements to:",
"selLayerNames": "Move selected elements to a different layer",
"sidepanel_handle": "L a y e r s", // "title": "Drag left/right to resize side panel"},
"sidepanel_handle": "L a y e r s" // "title": "Drag left/right to resize side panel"},
},
config: {
@ -170,10 +189,15 @@
"svginfo_width": "Width:",
"svginfo_height": "Height:",
"includedImages": "Included Images",
"image_opt_embed": "Embed data (local files)",
"image_opt_ref": "Use file reference",
"svginfo_editor_prefs": "Editor Preferences",
"svginfo_icons": "Icon size",
"svginfo_lang": "Language",
"svginfo_change_background": "Editor Background",
"image_url": "Image URL",
"svginfo_bg_note": "Note: Background will not be saved with image.",
"icon_large": "Large",
"icon_medium": "Medium",
@ -182,9 +206,38 @@
"selectedPredefined": "Select predefined:",
"includedImages": "Included Images",
"image_opt_embed": "Embed data (local files)",
"image_opt_ref": "Use file reference"
units_and_rulers: "Units & Rulers",
show_rulers: "Show rulers",
base_unit: "Base Unit:",
grid: "Grid",
snapping_onoff: "Snapping on/off",
snapping_stepsize: "Snapping Step-Size:"
},
shape_cats: {
basic: 'Basic',
object: 'Objects',
symbol: 'Symbols',
arrow: 'Arrows',
flowchart: 'Flowchart',
animal: 'Animals',
game: 'Cards & Chess',
dialog_balloon: 'Dialog balloons',
electronics: 'Electronics',
math: 'Mathematical',
music: 'Music',
misc: 'Miscellaneous',
raphael_1: 'raphaeljs.com set 1',
raphael_2: 'raphaeljs.com set 2'
},
imagelib: {
select_lib: 'Select an image library',
show_list: 'Show library list',
import_single: 'Import single',
import_multi: 'Import multiple',
open: 'Open as new document'
},
notification: {
"invalidAttrValGiven":"Invalid value given",
@ -209,6 +262,7 @@
"enterNewLinkURL": "Enter the new hyperlink URL",
"errorLoadingSVG": "Error: Unable to load SVG data",
"URLloadFail": "Unable to load from URL",
"retrieving": 'Retrieving "%s"...',
"ok":"OK",
"cancel":"Cancel",
"key_up":"Up",

View File

@ -27,14 +27,14 @@ var svgEditor = (function($, Editor) {
for(var i = 0; i < elem.childNodes.length; i++) {
var node = elem.childNodes[i];
if(node.nodeType === 3 && node.textContent.replace(/\s/g,'')) {
node.textContent = '!!!' + val;
node.textContent = val;
break;
}
}
break;
case 'title':
elem.title = '!!!' + val;
elem.title = val;
break;
}
@ -129,6 +129,7 @@ var svgEditor = (function($, Editor) {
smallest_object: tools.smallest_object,
straight_segments: properties.straight_segments,
svginfo_bg_url: config.image_url + ":",
svginfo_bg_note: config.svginfo_bg_note,
svginfo_change_background: config.svginfo_change_background,
svginfo_dim: config.svginfo_dim,
@ -145,6 +146,10 @@ var svgEditor = (function($, Editor) {
tool_source_cancel: common.cancel,
tool_source_save: common.ok,
tool_prefs_cancel: common.cancel,
tool_prefs_save: common.ok,
sidepanel_handle: layers.sidepanel_handle,
tool_clear: tools.tool_clear,
@ -153,10 +158,44 @@ var svgEditor = (function($, Editor) {
tool_import: tools.tool_import,
tool_imagelib: tools.tool_imagelib,
tool_open: tools.tool_open,
tool_save: tools.tool_save
tool_save: tools.tool_save,
svginfo_units_rulers: config.units_and_rulers,
svginfo_rulers_onoff: config.show_rulers,
svginfo_unit: config.base_unit,
svginfo_grid_settings: config.grid,
svginfo_snap_onoff: config.snapping_onoff,
svginfo_snap_step: config.snapping_stepsize,
}, true);
// Shape categories
var cats = {};
for (var o in langData.shape_cats) {
cats['#shape_cats [data-cat="' + o + '"]'] = langData.shape_cats[o];
}
// TODO: Find way to make this run after shapelib ext has loaded
setTimeout(function() {
setStrings('content', cats);
}, 2000);
// Context menus
var opts = {};
$.each(['cut','copy','paste', 'paste_in_place', 'delete', 'group', 'ungroup', 'move_front', 'move_up', 'move_down', 'move_back'], function() {
opts['#cmenu_canvas a[href="#' + this + '"]'] = tools[this];
});
$.each(['dupe','delete','merge_down', 'merge_all'], function() {
opts['#cmenu_layers a[href="#' + this + '"]'] = layers[this];
});
opts['#cmenu_layers a[href="#delete"]'] = layers.layer_delete;
setStrings('content', opts);
setStrings('title', {
align_relative_to: tools.align_relative_to,
bkgnd_color: tools.bkgnd_color,
@ -178,6 +217,7 @@ var svgEditor = (function($, Editor) {
layer_down: layers.layer_down,
layer_new: layers.layer_new,
layer_rename: layers.layer_rename,
layer_moreopts: common.more_opts,
layer_up: layers.layer_up,
line_x1: properties.line_x1,
line_x2: properties.line_x2,
@ -191,6 +231,7 @@ var svgEditor = (function($, Editor) {
linejoin_round: properties.linejoin_round,
main_icon: tools.main_icon,
mode_connect: tools.mode_connect,
tools_shapelib_show: tools.tools_shapelib_show,
palette: ui.palette,
zoom_panel: ui.zoom_panel,
path_node_x: properties.path_node_x,
@ -229,6 +270,8 @@ var svgEditor = (function($, Editor) {
tool_fhrect: tools.tool_fhrect,
tool_font_size: properties.tool_font_size,
tool_group: tools.tool_group,
tool_make_link: tools.tool_make_link,
tool_link_url: tools.tool_link_url,
tool_image: tools.tool_image,
tool_italic: properties.tool_italic,
tool_line: tools.tool_line,
@ -252,7 +295,7 @@ var svgEditor = (function($, Editor) {
tool_undo: tools.tool_undo,
tool_ungroup: tools.tool_ungroup,
tool_wireframe: tools.tool_wireframe,
tool_view_grid: tools.view_grid,
view_grid: tools.view_grid,
tool_zoom: tools.tool_zoom,
url_notice: tools.url_notice
@ -261,6 +304,8 @@ var svgEditor = (function($, Editor) {
Editor.setLang(lang_param, langData);
// $.each(langData, function(i, data) {
// if(data.id) {
// var elem = $('#svg_editor').parent().find('#'+data.id)[0];

View File

@ -60,6 +60,16 @@
showRulers: true
},
uiStrings = Editor.uiStrings = {
common: {
"ok":"OK",
"cancel":"Cancel",
"key_up":"Up",
"key_down":"Down",
"key_backspace":"Backspace",
"key_del":"Del"
},
notification: {
"invalidAttrValGiven":"Invalid value given",
"noContentToFitTo":"No content to fit to",
"layer":"Layer",
@ -82,12 +92,8 @@
"enterNewLinkURL": "Enter the new hyperlink URL",
"errorLoadingSVG": "Error: Unable to load SVG data",
"URLloadFail": "Unable to load from URL",
"ok":"OK",
"cancel":"Cancel",
"key_up":"Up",
"key_down":"Down",
"key_backspace":"Backspace",
"key_del":"Del"
"retrieving": 'Retrieving "%s" ...'
}
};
var curPrefs = {}; //$.extend({}, defaultPrefs);
@ -515,10 +521,10 @@
.toggleClass('prompt',(type=='prompt'));
btn_holder.empty();
var ok = $('<input type="button" value="' + uiStrings.ok + '">').appendTo(btn_holder);
var ok = $('<input type="button" value="' + uiStrings.common.ok + '">').appendTo(btn_holder);
if(type != 'alert') {
$('<input type="button" value="' + uiStrings.cancel + '">')
$('<input type="button" value="' + uiStrings.common.cancel + '">')
.appendTo(btn_holder)
.click(function() { box.hide();callback(false)});
}
@ -612,12 +618,12 @@
var done = $.pref('save_notice_done');
if(done !== "all") {
var note = uiStrings.saveFromBrowser.replace('%s', 'SVG');
var note = uiStrings.notification.saveFromBrowser.replace('%s', 'SVG');
// Check if FF and has <defs/>
if(ua.indexOf('Gecko/') !== -1) {
if(svg.indexOf('<defs') !== -1) {
note += "\n\n" + uiStrings.defsFailOnSave;
note += "\n\n" + uiStrings.notification.defsFailOnSave;
$.pref('save_notice_done', 'all');
done = "all";
} else {
@ -648,12 +654,12 @@
exportWindow.location.href = datauri;
var done = $.pref('export_notice_done');
if(done !== "all") {
var note = uiStrings.saveFromBrowser.replace('%s', 'PNG');
var note = uiStrings.notification.saveFromBrowser.replace('%s', 'PNG');
// Check if there's issues
if(issues.length) {
var pre = "\n \u2022 ";
note += ("\n\n" + uiStrings.noteTheseIssues + pre + issues.join(pre));
note += ("\n\n" + uiStrings.notification.noteTheseIssues + pre + issues.join(pre));
}
// Note that this will also prevent the notice even though new issues may appear later.
@ -939,6 +945,8 @@
var setFlyoutTitles = function() {
$('.tools_flyout').each(function() {
var shower = $('#' + this.id + '_show');
if(shower.data('isLibrary')) return;
var tooltips = [];
$(this).children().each(function() {
tooltips.push(this.title);
@ -1812,7 +1820,7 @@
var promptMoveLayerOnce = false;
$('#selLayerNames').change(function(){
var destLayer = this.options[this.selectedIndex].value;
var confirm_str = uiStrings.QmoveElemsToLayer.replace('%s',destLayer);
var confirm_str = uiStrings.notification.QmoveElemsToLayer.replace('%s',destLayer);
var moveToLayer = function(ok) {
if(!ok) return;
promptMoveLayerOnce = true;
@ -1859,7 +1867,7 @@
var valid = svgedit.units.isValidUnit(attr, val);
if(!valid) {
$.alert(uiStrings.invalidAttrValGiven);
$.alert(uiStrings.notification.invalidAttrValGiven);
this.value = selectedElement.getAttribute(attr);
return false;
}
@ -2439,7 +2447,7 @@
var makeHyperlink = function() {
if (selectedElement != null || multiselected) {
$.prompt(uiStrings.enterNewLinkURL, "http://", function(url) {
$.prompt(uiStrings.notification.enterNewLinkURL, "http://", function(url) {
if(url) svgCanvas.makeHyperlink(url);
});
}
@ -2514,7 +2522,7 @@
var clickClear = function(){
var dims = curConfig.dimensions;
$.confirm(uiStrings.QwantToClear, function(ok) {
$.confirm(uiStrings.notification.QwantToClear, function(ok) {
if(!ok) return;
setSelectMode();
svgCanvas.clear();
@ -2551,7 +2559,7 @@
var clickExport = function() {
// Open placeholder window (prevents popup)
if(!customHandlers.pngsave) {
var str = uiStrings.loadingImage;
var str = uiStrings.notification.loadingImage;
exportWindow = window.open("data:text/html;charset=utf-8,<title>" + str + "<\/title><h1>" + str + "<\/h1>");
}
@ -2740,7 +2748,7 @@
}
if (!svgCanvas.setSvgString($('#svg_source_textarea').val())) {
$.confirm(uiStrings.QerrorsRevertToSource, function(ok) {
$.confirm(uiStrings.notification.QerrorsRevertToSource, function(ok) {
if(!ok) return false;
saveChanges();
});
@ -2772,7 +2780,7 @@
var height = $('#canvas_height'), h = height.val();
if(w != "fit" && !svgedit.units.isValidUnit('width', w)) {
$.alert(uiStrings.invalidAttrValGiven);
$.alert(uiStrings.notification.invalidAttrValGiven);
width.parent().addClass('error');
return false;
}
@ -2780,7 +2788,7 @@
width.parent().removeClass('error');
if(h != "fit" && !svgedit.units.isValidUnit('height', h)) {
$.alert(uiStrings.invalidAttrValGiven);
$.alert(uiStrings.notification.invalidAttrValGiven);
height.parent().addClass('error');
return false;
}
@ -2788,7 +2796,7 @@
height.parent().removeClass('error');
if(!svgCanvas.setResolution(w, h)) {
$.alert(uiStrings.noContentToFitTo);
$.alert(uiStrings.notification.noContentToFitTo);
return false;
}
@ -3127,7 +3135,7 @@
if (editingsource) {
if (orig_source !== $('#svg_source_textarea').val()) {
$.confirm(uiStrings.QignoreSourceChanges, function(ok) {
$.confirm(uiStrings.notification.QignoreSourceChanges, function(ok) {
if(ok) hideSourceEditor();
});
} else {
@ -3192,7 +3200,7 @@
function promptImgURL() {
var curhref = svgCanvas.getHref(selectedElement);
curhref = curhref.indexOf("data:") === 0?"":curhref;
$.prompt(uiStrings.enterNewImgURL, curhref, function(url) {
$.prompt(uiStrings.notification.enterNewImgURL, curhref, function(url) {
if(url) setImageURL(url);
});
}
@ -3477,7 +3485,7 @@
$('#image_save_opts [value=embed]').attr('disabled','disabled');
$('#image_save_opts input').val(['ref']);
curPrefs.img_save = 'ref';
$('#image_opt_embed').css('color','#666').attr('title',uiStrings.featNotSupported);
$('#image_opt_embed').css('color','#666').attr('title',uiStrings.notification.featNotSupported);
}
});
},1000);
@ -3528,13 +3536,13 @@
$('#layer_new').click(function() {
var i = svgCanvas.getNumLayers();
do {
var uniqName = uiStrings.layer + " " + ++i;
var uniqName = uiStrings.notification.layer + " " + ++i;
} while(svgCanvas.hasLayer(uniqName));
$.prompt(uiStrings.enterUniqueLayerName,uniqName, function(newName) {
$.prompt(uiStrings.notification.enterUniqueLayerName,uniqName, function(newName) {
if (!newName) return;
if (svgCanvas.hasLayer(newName)) {
$.alert(uiStrings.dupeLayerName);
$.alert(uiStrings.notification.dupeLayerName);
return;
}
svgCanvas.createLayer(newName);
@ -3558,10 +3566,10 @@
function cloneLayer() {
var name = svgCanvas.getCurrentLayer() + ' copy';
$.prompt(uiStrings.enterUniqueLayerName, name, function(newName) {
$.prompt(uiStrings.notification.enterUniqueLayerName, name, function(newName) {
if (!newName) return;
if (svgCanvas.hasLayer(newName)) {
$.alert(uiStrings.dupeLayerName);
$.alert(uiStrings.notification.dupeLayerName);
return;
}
svgCanvas.cloneLayer(newName);
@ -3600,10 +3608,10 @@
$('#layer_rename').click(function() {
var curIndex = $('#layerlist tr.layersel').prevAll().length;
var oldName = $('#layerlist tr.layersel td.layername').text();
$.prompt(uiStrings.enterNewLayerName,"", function(newName) {
$.prompt(uiStrings.notification.enterNewLayerName,"", function(newName) {
if (!newName) return;
if (oldName == newName || svgCanvas.hasLayer(newName)) {
$.alert(uiStrings.layerHasThatName);
$.alert(uiStrings.notification.layerHasThatName);
return;
}
@ -4215,7 +4223,7 @@
// show_save_warning is set to "false" when the page is saved.
if(!curConfig.no_save_warning && show_save_warning) {
// Browser already asks question about closing the page
return uiStrings.unsavedChanges;
return uiStrings.notification.unsavedChanges;
}
};
@ -4224,7 +4232,7 @@
if(undoMgr.getUndoStackSize() === 0) {
func(true);
} else {
$.confirm(uiStrings.QwantToOpen, func);
$.confirm(uiStrings.notification.QwantToOpen, func);
}
}
@ -4564,18 +4572,20 @@
$('#lang_select').val(lang);
if(allStrings) {
var strings = allStrings.notification;
var notif = allStrings.notification;
// $.extend will only replace the given strings
var oldLayerName = $('#layerlist tr.layersel td.layername').text();
var rename_layer = (oldLayerName == uiStrings.layer + ' 1');
var rename_layer = (oldLayerName == uiStrings.common.layer + ' 1');
$.extend(uiStrings,strings);
svgCanvas.setUiStrings(strings);
$.extend(uiStrings, allStrings);
svgCanvas.setUiStrings(allStrings);
Actions.setTitles();
if(rename_layer) {
svgCanvas.renameCurrentLayer(uiStrings.layer + ' 1');
svgCanvas.renameCurrentLayer(uiStrings.common.layer + ' 1');
populateLayers();
}
@ -4613,7 +4623,7 @@
if(success) {
callback(true);
} else {
$.alert(uiStrings.errorLoadingSVG, function() {
$.alert(uiStrings.notification.errorLoadingSVG, function() {
callback(false);
});
}
@ -4658,7 +4668,7 @@
if(xhr.status != 404 && xhr.responseText) {
loadSvgString(xhr.responseText, cb);
} else {
$.alert(uiStrings.URLloadFail + ": \n"+err+'', cb);
$.alert(uiStrings.notification.URLloadFail + ": \n"+err+'', cb);
}
}
});

View File

@ -7569,7 +7569,7 @@ this.getVersion = function() {
// Parameters:
// strs - Object with strings (see uiStrings for examples)
this.setUiStrings = function(strs) {
$.extend(uiStrings, strs);
$.extend(uiStrings, strs.notification);
}
// Function: setConfig