Permalink
Browse files

Externalize UI strings found in menus

  • Loading branch information...
sgtcoolguy committed Jan 13, 2012
1 parent d913d2b commit 23f0f3291140b1e83fff87033741e3f330e48cc2
Showing with 64 additions and 40 deletions.
  1. +23 −23 bundle.rb
  2. +1 −1 commands/copy_as_bookmarklet_to_clipboard.rb
  3. +1 −1 commands/documentation_for_word.rb
  4. +1 −1 commands/format.rb
  5. +24 −0 config/locales/en.yml
  6. +14 −14 snippets/snippets.rb
View
@@ -3,7 +3,7 @@
bundle do |bundle|
bundle.author = 'Christopher Williams'
bundle.copyright = "Copyright 2010 Aptana Inc. Distributed under the MIT license."
- bundle.display_name = 'JavaScript'
+ bundle.display_name = t(:bundle_name)
bundle.description = "Javascript bundle for RadRails, ported from the TextMate bundle"
bundle.repository = "git://github.com/aptana/js.ruble.git"
# Set up folding. Folding is now done in Java code for this language
@@ -16,49 +16,49 @@
bundle.indent["source.js"] = increase_indent_pattern, decrease_indent_pattern
# most commands install into a dedicated JS menu
- bundle.menu "JavaScript" do |js_menu|
+ bundle.menu t(:bundle_name) do |js_menu|
# this menu should be shown when any of the following scopes is active:
js_menu.scope = [ "source.js" ]
# command/snippet names must be unique within bundle and are case insensitive
- js_menu.menu "Core" do |core_menu|
- core_menu.menu "Control" do |control_menu|
- control_menu.command "if"
- control_menu.command "if ... else"
+ js_menu.menu t(:core) do |core_menu|
+ core_menu.menu t(:control) do |control_menu|
+ control_menu.command t(:if)
+ control_menu.command t(:if_else)
control_menu.separator
- control_menu.command "for (...) {...}"
- control_menu.command "for (...) {...} (Improved Native For-Loop)"
+ control_menu.command t(:for)
+ control_menu.command t(:for_native)
end
- core_menu.menu "Language" do |language_menu|
- language_menu.command "Object key - key: \"value\""
- language_menu.command "Object Value JS"
+ core_menu.menu t(:language) do |language_menu|
+ language_menu.command t(:object_key)
+ language_menu.command t(:object_value)
language_menu.separator
- language_menu.command "Prototype"
+ language_menu.command t(:prototype)
end
- core_menu.menu "Function" do |function_menu|
- function_menu.command "Anonymous Function"
- function_menu.command "Function"
+ core_menu.menu t(:function) do |function_menu|
+ function_menu.command t(:anonymous_function)
+ function_menu.command t(:function)
function_menu.separator
- function_menu.command "New Function"
- function_menu.command "New Method"
+ function_menu.command t(:new_function)
+ function_menu.command t(:new_method)
function_menu.separator
- function_menu.command "Object Method"
- function_menu.command "Object Method String"
+ function_menu.command t(:object_method)
+ function_menu.command t(:object_method_string)
end
end
# js_menu.menu "DOM" do |dom_menu|
# dom_menu.command "Get Elements"
# end
- js_menu.menu "BOM" do |bom_menu|
- bom_menu.command "setTimeout function"
+ js_menu.menu t(:bom) do |bom_menu|
+ bom_menu.command t(:setTimeout)
end
- js_menu.command "Documentation for Word"
+ js_menu.command t(:doc_for_word)
js_menu.separator
- js_menu.command "Copy as Bookmarklet to Clipboard"
+ js_menu.command t(:copy_as_bookmarklet)
end
end
@@ -1,6 +1,6 @@
require 'ruble'
-command "Copy as Bookmarklet to Clipboard" do |cmd|
+command t(:copy_as_bookmarklet) do |cmd|
cmd.key_binding = "CTRL+SHIFT+H"
cmd.output = :copy_to_clipboard
cmd.input = :selection
@@ -1,7 +1,7 @@
require 'ruble'
require 'ruble/ui'
-command "Documentation for Word" do |cmd|
+command t(:doc_for_word) do |cmd|
#cmd.key_binding = "M4+H"
cmd.output = :show_as_html
cmd.input = :selection
View
@@ -1,6 +1,6 @@
require 'ruble'
-command "Reformat Document" do |cmd|
+command t(:reformat_document) do |cmd|
cmd.key_binding = "CTRL+SHIFT+H"
cmd.output = :replace_selection
cmd.input = :selection, :document
View
@@ -0,0 +1,24 @@
+en:
+ bundle_name: 'JavaScript'
+ core: "Core"
+ control: "Control"
+ if: "if"
+ if_else: "if ... else"
+ for: "for (...) {...}"
+ for_native: "for (...) {...} (Improved Native For-Loop)"
+ language: "Language"
+ object_key: 'Object key - key: "value"'
+ object_value: "Object Value JS"
+ prototype: "Prototype"
+ function: "Function"
+ anonymous_function: "Anonymous Function"
+ new_function: "New Function"
+ new_method: "New Method"
+ object_method: "Object Method"
+ object_method_string: "Object Method String"
+ bom: "BOM"
+ setTimeout: "setTimeout function"
+ doc_for_word: "Documentation for Word"
+ copy_as_bookmarklet: "Copy as Bookmarklet to Clipboard"
+ reformat_document: "Reformat Document"
+
View
@@ -2,87 +2,87 @@
with_defaults :scope => "source.js" do
- snippet "Object Method" do |s|
+ snippet t(:object_method) do |s|
s.trigger = ":f"
s.expansion = "${1:method_name}: function(${2:attribute}){
$0
}${3:,}"
end
- snippet "Function" do |s|
+ snippet t(:function) do |s|
s.trigger = "fun"
s.expansion = "function ${1:function_name} (${2:argument}) {
${0:// body...}
}"
end
- snippet "New Function" do |s|
+ snippet t(:new_function) do |s|
s.trigger = "fun"
s.expansion = "function (${1:args}) {
${0:// body...}
}"
end
- snippet "New Method" do |s|
+ snippet t(:new_method) do |s|
s.trigger = ":"
s.expansion = ": function (${1:args}) {
$0
},"
end
- snippet "Prototype" do |s|
+ snippet t(:prototype) do |s|
s.trigger = "proto"
s.expansion = "${1:class_name}.prototype.${2:method_name} = function(${3:first_argument}) {
${0:// body...}
};
"
end
- snippet "Anonymous Function" do |s|
+ snippet t(:anonymous_function) do |s|
s.trigger = "f"
s.expansion = "function($1) {${0:$TM_SELECTED_TEXT}};"
end
- snippet "if" do |s|
+ snippet t(:if) do |s|
s.trigger = "if"
s.expansion = "if (${1:true}) {${0:$TM_SELECTED_TEXT}};"
end
- snippet "if ... else" do |s|
+ snippet t(:if_else) do |s|
s.trigger = "ife"
s.expansion = "if (${1:true}) {${0:$TM_SELECTED_TEXT}} else{};"
end
- snippet "for (...) {...}" do |s|
+ snippet t(:for) do |s|
s.trigger = "for"
s.expansion = "for (var ${2:i}=0; ${2:i} < ${1:Things}.length; ${2:i}++) {
${1:Things}[${2:i}]
};"
end
- snippet "for (...) {...} (Improved Native For-Loop)" do |s|
+ snippet t(:for_native) do |s|
s.trigger = "for"
s.expansion = "for (var ${2:i} = ${1:Things}.length - 1; ${2:i} >= 0; ${2:i}--){
${1:Things}[${2:i}]
};"
end
- snippet "Object Value JS" do |s|
+ snippet t(:object_value) do |s|
s.trigger = ":,"
s.expansion = "${1:value_name}:${0:value},"
end
- snippet "Object key - key: \"value\"" do |s|
+ snippet t(:object_key) do |s|
s.trigger = ":"
s.expansion = '${1:key}: ${2:"${3:value}"}${4:, }'
end
- snippet "setTimeout function" do |s|
+ snippet t(:setTimeout) do |s|
s.trigger = "timeout"
s.expansion = "setTimeout(function() {$0}, ${1:10});"
end
- snippet "Object Method String" do |s|
+ snippet t(:object_method_string) do |s|
s.trigger = '":f'
s.expansion = "'${1:${2:#thing}:${3:click}}': function(element){
$0

0 comments on commit 23f0f32

Please sign in to comment.