/src/Samples/Xmlt.Sample/Scripts/extended/Seadragon/Seadragon.Strings.debug.js

# · JavaScript · 65 lines · 53 code · 11 blank · 1 comment · 6 complexity · 0de18166f3e3b36d1fa9284b7fe6b3be MD5 · raw file

  1. // (c) 2010 CodePlex Foundation
  2. Type.registerNamespace('Sys.Extended.UI');
  3. Type.registerNamespace('Seadragon');
  4. Sys.Extended.UI.Seadragon.Strings = {
  5. Errors: {
  6. Failure: "Sorry, but Seadragon Ajax can't run on your browser!\n" +
  7. "Please try using IE 7 or Firefox 3.\n",
  8. Dzc: "Sorry, we don't support Deep Zoom Collections!",
  9. Dzi: "Hmm, this doesn't appear to be a valid Deep Zoom Image.",
  10. Xml: "Hmm, this doesn't appear to be a valid Deep Zoom Image.",
  11. Empty: "You asked us to open nothing, so we did just that.",
  12. ImageFormat: "Sorry, we don't support {0}-based Deep Zoom Images.",
  13. Security: "It looks like a security restriction stopped us from " +
  14. "loading this Deep Zoom Image.",
  15. Status: "This space unintentionally left blank ({0} {1}).",
  16. Unknown: "Whoops, something inexplicably went wrong. Sorry!"
  17. },
  18. Messages: {
  19. Loading: "Loading..."
  20. },
  21. Tooltips: {
  22. FullPage: "Toggle full page",
  23. Home: "Go home",
  24. ZoomIn: "Zoom in",
  25. ZoomOut: "Zoom out"
  26. },
  27. getString: function(prop) {
  28. var props = prop.split('.');
  29. var string = Sys.Extended.UI.Seadragon.Strings;
  30. for (var i = 0; i < props.length; i++) {
  31. string = string[props[i]] || {}; // in case not a subproperty
  32. }
  33. if (typeof (string) != "string") {
  34. string = "";
  35. }
  36. var args = arguments;
  37. return string.replace(/\{\d+\}/g, function(capture) {
  38. var i = parseInt(capture.match(/\d+/)) + 1;
  39. return i < args.length ? args[i] : "";
  40. });
  41. },
  42. setString: function(prop, value) {
  43. var props = prop.split('.');
  44. var container = Seadragon.Strings;
  45. for (var i = 0; i < props.length - 1; i++) {
  46. if (!container[props[i]]) {
  47. container[props[i]] = {};
  48. }
  49. container = container[props[i]];
  50. }
  51. container[props[i]] = value;
  52. }
  53. }
  54. Seadragon.Strings = Sys.Extended.UI.Seadragon.Strings;