diff --git a/bin/vagrant b/bin/vagrant index 31bb4ca930e..9b983c7f323 100755 --- a/bin/vagrant +++ b/bin/vagrant @@ -14,7 +14,7 @@ begin # Kick start the CLI Vagrant::CLI.start(ARGV, :env => env) rescue Vagrant::Errors::VagrantError => e - opts = { :_translate => false, :_prefix => false } + opts = { :_prefix => false } env.ui.error e.message, opts if e.message env.ui.error e.backtrace.join("\n"), opts if ENV["VAGRANT_DEBUG"] exit e.status_code if e.respond_to?(:status_code) diff --git a/lib/vagrant/action.rb b/lib/vagrant/action.rb index 98c390ae271..c43e4bceca8 100644 --- a/lib/vagrant/action.rb +++ b/lib/vagrant/action.rb @@ -56,11 +56,11 @@ def run(callable, options=nil) # chain has been run. int_callback = lambda do if action_environment.interrupted? - env.ui.error "vagrant.actions.runner.exit_immediately" + env.ui.error I18n.t("vagrant.actions.runner.exit_immediately") abort end - env.ui.warn "vagrant.actions.runner.waiting_cleanup" if !@@reported_interrupt + env.ui.warn I18n.t("vagrant.actions.runner.waiting_cleanup") if !@@reported_interrupt action_environment.interrupt! @@reported_interrupt = true end diff --git a/lib/vagrant/action/box/destroy.rb b/lib/vagrant/action/box/destroy.rb index dfe6767dd0f..005affda9f9 100644 --- a/lib/vagrant/action/box/destroy.rb +++ b/lib/vagrant/action/box/destroy.rb @@ -10,7 +10,7 @@ def initialize(app, env) end def call(env) - env.ui.info "vagrant.actions.box.destroy.destroying", :name => env["box"].name + env.ui.info I18n.t("vagrant.actions.box.destroy.destroying", :name => env["box"].name) FileUtils.rm_rf(env["box"].directory) @app.call(env) diff --git a/lib/vagrant/action/box/download.rb b/lib/vagrant/action/box/download.rb index db50c9c0079..7b0774594a7 100644 --- a/lib/vagrant/action/box/download.rb +++ b/lib/vagrant/action/box/download.rb @@ -28,7 +28,7 @@ def call(env) def instantiate_downloader @env["download.classes"].each do |klass| if klass.match?(@env["box"].uri) - @env.ui.info "vagrant.actions.box.download.with", :class => klass.to_s + @env.ui.info I18n.t("vagrant.actions.box.download.with", :class => klass.to_s) @downloader = klass.new(@env) end end @@ -48,7 +48,7 @@ def download def recover(env) if temp_path && File.exist?(temp_path) - env.ui.info "vagrant.actions.box.download.cleaning" + env.ui.info I18n.t("vagrant.actions.box.download.cleaning") File.unlink(temp_path) end end @@ -64,7 +64,7 @@ def box_temp_path end def download_to(f) - @env.ui.info "vagrant.actions.box.download.copying" + @env.ui.info I18n.t("vagrant.actions.box.download.copying") @downloader.download!(@env["box"].uri, f) end end diff --git a/lib/vagrant/action/box/unpackage.rb b/lib/vagrant/action/box/unpackage.rb index 2b4f436acbd..00f5bbbb3e6 100644 --- a/lib/vagrant/action/box/unpackage.rb +++ b/lib/vagrant/action/box/unpackage.rb @@ -45,7 +45,7 @@ def setup_box_directory def decompress Dir.chdir(@env["box"].directory) do - @env.ui.info "vagrant.actions.box.unpackage.extracting" + @env.ui.info I18n.t("vagrant.actions.box.unpackage.extracting") Archive::Tar::Minitar.unpack(@env["download.temp_path"], @env["box"].directory.to_s) end end diff --git a/lib/vagrant/action/box/verify.rb b/lib/vagrant/action/box/verify.rb index 19600323615..40ed305f2f9 100644 --- a/lib/vagrant/action/box/verify.rb +++ b/lib/vagrant/action/box/verify.rb @@ -9,7 +9,7 @@ def initialize(app, env) def call(env) begin - env.ui.info "vagrant.actions.box.verify.verifying" + env.ui.info I18n.t("vagrant.actions.box.verify.verifying") VirtualBox::Appliance.new(env["box"].ovf_file.to_s) rescue Exception raise Errors::BoxVerificationFailed.new diff --git a/lib/vagrant/action/general/package.rb b/lib/vagrant/action/general/package.rb index 438647df145..8dc5da016b1 100644 --- a/lib/vagrant/action/general/package.rb +++ b/lib/vagrant/action/general/package.rb @@ -66,7 +66,7 @@ def verify_files_to_copy # the actual box def copy_include_files files_to_copy.each do |from, to| - @env.ui.info "vagrant.actions.general.package.packaging", :file => from + @env.ui.info I18n.t("vagrant.actions.general.package.packaging", :file => from) FileUtils.mkdir_p(to.parent) FileUtils.cp(from, to) end @@ -74,7 +74,7 @@ def copy_include_files # Compress the exported file into a package def compress - @env.ui.info "vagrant.actions.general.package.compressing", :tar_path => tar_path + @env.ui.info I18n.t("vagrant.actions.general.package.compressing", :tar_path => tar_path) File.open(tar_path, Platform.tar_file_options) do |tar| Archive::Tar::Minitar::Output.open(tar) do |output| begin diff --git a/lib/vagrant/action/vm/boot.rb b/lib/vagrant/action/vm/boot.rb index f969b34ad29..ed801f53804 100644 --- a/lib/vagrant/action/vm/boot.rb +++ b/lib/vagrant/action/vm/boot.rb @@ -17,16 +17,16 @@ def call(env) end def boot - @env.ui.info "vagrant.actions.vm.boot.booting" + @env.ui.info I18n.t("vagrant.actions.vm.boot.booting") @env["vm"].vm.start(@env.env.config.vm.boot_mode) end def wait_for_boot - @env.ui.info "vagrant.actions.vm.boot.waiting" + @env.ui.info I18n.t("vagrant.actions.vm.boot.waiting") @env.env.config.ssh.max_tries.to_i.times do |i| if @env["vm"].ssh.up? - @env.ui.info "vagrant.actions.vm.boot.ready" + @env.ui.info I18n.t("vagrant.actions.vm.boot.ready") return true end @@ -37,7 +37,7 @@ def wait_for_boot sleep 5 if !@env["vagrant.test"] end - @env.ui.error "vagrant.actions.vm.boot.failed" + @env.ui.error I18n.t("vagrant.actions.vm.boot.failed") false end end diff --git a/lib/vagrant/action/vm/check_box.rb b/lib/vagrant/action/vm/check_box.rb index 1e4a8abc02a..c7e3befb690 100644 --- a/lib/vagrant/action/vm/check_box.rb +++ b/lib/vagrant/action/vm/check_box.rb @@ -14,7 +14,7 @@ def call(env) box_url = env["config"].vm.box_url raise Errors::BoxSpecifiedDoesntExist.new(:name => box_name) if !box_url - env.ui.info "vagrant.actions.vm.check_box.not_found", :name => box_name + env.ui.info I18n.t("vagrant.actions.vm.check_box.not_found", :name => box_name) Vagrant::Box.add(env.env, box_name, box_url) env.env.load_box! end diff --git a/lib/vagrant/action/vm/check_guest_additions.rb b/lib/vagrant/action/vm/check_guest_additions.rb index 34a2c308d5a..5a053647e6a 100644 --- a/lib/vagrant/action/vm/check_guest_additions.rb +++ b/lib/vagrant/action/vm/check_guest_additions.rb @@ -14,11 +14,11 @@ def call(env) # doesn't support guest properties (due to cross platform issues) version = env["vm"].vm.interface.get_guest_property_value("/VirtualBox/GuestAdd/Version") if version.empty? - env.ui.warn "vagrant.actions.vm.check_guest_additions.not_detected" + env.ui.warn I18n.t("vagrant.actions.vm.check_guest_additions.not_detected") elsif version != VirtualBox.version - env.ui.warn("vagrant.actions.vm.check_guest_additions.version_mismatch", + env.ui.warn(I18n.t("vagrant.actions.vm.check_guest_additions.version_mismatch", :guest_version => version, - :virtualbox_version => VirtualBox.version) + :virtualbox_version => VirtualBox.version)) end # Continue diff --git a/lib/vagrant/action/vm/clear_forwarded_ports.rb b/lib/vagrant/action/vm/clear_forwarded_ports.rb index 452c6d7cb46..81ba48cd625 100644 --- a/lib/vagrant/action/vm/clear_forwarded_ports.rb +++ b/lib/vagrant/action/vm/clear_forwarded_ports.rb @@ -19,7 +19,7 @@ def call(env) def clear if used_ports.length > 0 - @env.ui.info "vagrant.actions.vm.clear_forward_ports.deleting" + @env.ui.info I18n.t("vagrant.actions.vm.clear_forward_ports.deleting") clear_ports @env["vm"].reload! end diff --git a/lib/vagrant/action/vm/clear_shared_folders.rb b/lib/vagrant/action/vm/clear_shared_folders.rb index f088ebdde42..c3988ca2e93 100644 --- a/lib/vagrant/action/vm/clear_shared_folders.rb +++ b/lib/vagrant/action/vm/clear_shared_folders.rb @@ -16,7 +16,7 @@ def call(env) def clear_shared_folders if @env["vm"].vm.shared_folders.length > 0 - @env.ui.info "vagrant.actions.vm.clear_shared_folders.deleting" + @env.ui.info I18n.t("vagrant.actions.vm.clear_shared_folders.deleting") folders = @env["vm"].vm.shared_folders.dup folders.each do |shared_folder| diff --git a/lib/vagrant/action/vm/customize.rb b/lib/vagrant/action/vm/customize.rb index 4cfd4d1f632..a7f05f8aeae 100644 --- a/lib/vagrant/action/vm/customize.rb +++ b/lib/vagrant/action/vm/customize.rb @@ -8,7 +8,7 @@ def initialize(app, env) def call(env) if !env.env.config.vm.proc_stack.empty? - env.ui.info "vagrant.actions.vm.customize.running" + env.ui.info I18n.t("vagrant.actions.vm.customize.running") env.env.config.vm.run_procs!(env["vm"].vm) env["vm"].vm.save end diff --git a/lib/vagrant/action/vm/destroy.rb b/lib/vagrant/action/vm/destroy.rb index db19f22208b..eb9bba4097a 100644 --- a/lib/vagrant/action/vm/destroy.rb +++ b/lib/vagrant/action/vm/destroy.rb @@ -7,7 +7,7 @@ def initialize(app, env) end def call(env) - env.ui.info "vagrant.actions.vm.destroy.destroying" + env.ui.info I18n.t("vagrant.actions.vm.destroy.destroying") env["vm"].vm.destroy(:destroy_medium => :delete) env["vm"].vm = nil diff --git a/lib/vagrant/action/vm/destroy_unused_network_interfaces.rb b/lib/vagrant/action/vm/destroy_unused_network_interfaces.rb index 4af66a94717..66b9031463b 100644 --- a/lib/vagrant/action/vm/destroy_unused_network_interfaces.rb +++ b/lib/vagrant/action/vm/destroy_unused_network_interfaces.rb @@ -21,7 +21,7 @@ def call(env) # Destroy the network interface if there is only one # attached VM (which must be this VM) if interface.attached_vms.length == 1 - env.ui.info "vagrant.actions.vm.destroy_network.destroying" + env.ui.info I18n.t("vagrant.actions.vm.destroy_network.destroying") interface.destroy end end diff --git a/lib/vagrant/action/vm/disable_networks.rb b/lib/vagrant/action/vm/disable_networks.rb index c6e0244bf38..d8764d6dca2 100644 --- a/lib/vagrant/action/vm/disable_networks.rb +++ b/lib/vagrant/action/vm/disable_networks.rb @@ -17,7 +17,7 @@ def call(env) next if adapter.attachment_type != :host_only if !logged - env.ui.info "vagrant.actions.vm.disable_networks.disabling" + env.ui.info I18n.t("vagrant.actions.vm.disable_networks.disabling") logged = true end diff --git a/lib/vagrant/action/vm/discard_state.rb b/lib/vagrant/action/vm/discard_state.rb index ad56b6a0266..6802ab1a83c 100644 --- a/lib/vagrant/action/vm/discard_state.rb +++ b/lib/vagrant/action/vm/discard_state.rb @@ -10,7 +10,7 @@ def initialize(app, env) def call(env) if env["vm"].created? && env["vm"].vm.saved? - env.ui.info "vagrant.actions.vm.discard_state.discarding" + env.ui.info I18n.t("vagrant.actions.vm.discard_state.discarding") env["vm"].vm.discard_state end diff --git a/lib/vagrant/action/vm/export.rb b/lib/vagrant/action/vm/export.rb index 258d2c4e7ac..98f6ffe84e8 100644 --- a/lib/vagrant/action/vm/export.rb +++ b/lib/vagrant/action/vm/export.rb @@ -31,13 +31,13 @@ def recover(env) end def setup_temp_dir - @env.ui.info "vagrant.actions.vm.export.create_dir" + @env.ui.info I18n.t("vagrant.actions.vm.export.create_dir") @temp_dir = @env["export.temp_dir"] = @env.env.tmp_path.join(Time.now.to_i.to_s) FileUtils.mkpath(@env["export.temp_dir"]) end def export - @env.ui.info "vagrant.actions.vm.export.exporting" + @env.ui.info I18n.t("vagrant.actions.vm.export.exporting") @env["vm"].vm.export(ovf_path) do |progress| @env.ui.report_progress(progress.percent, 100, false) end diff --git a/lib/vagrant/action/vm/forward_ports.rb b/lib/vagrant/action/vm/forward_ports.rb index 7959118d014..d8a59e472e2 100644 --- a/lib/vagrant/action/vm/forward_ports.rb +++ b/lib/vagrant/action/vm/forward_ports.rb @@ -72,9 +72,9 @@ def handle_collision(name, options, existing_ports) existing_ports << options[:hostport] # Notify the user - @env.ui.info("vagrant.actions.vm.forward_ports.fixed_collision", + @env.ui.info(I18n.t("vagrant.actions.vm.forward_ports.fixed_collision", :name => name, - :new_port => options[:hostport]) + :new_port => options[:hostport])) end #-------------------------------------------------------------- @@ -89,7 +89,7 @@ def call(env) end def forward_ports - @env.ui.info "vagrant.actions.vm.forward_ports.forwarding" + @env.ui.info I18n.t("vagrant.actions.vm.forward_ports.forwarding") @env.env.config.vm.forwarded_ports.each do |name, options| adapter = options[:adapter] @@ -104,10 +104,10 @@ def forward_ports # Host-only or Bridged networking don't require port-forwarding and establishing forwarded ports on these # attachment types has uncertain behaviour. if @env["vm"].vm.network_adapters[adapter].attachment_type == :nat - @env.ui.info("vagrant.actions.vm.forward_ports.forwarding_entry", message_attributes) + @env.ui.info(I18n.t("vagrant.actions.vm.forward_ports.forwarding_entry", message_attributes)) forward_port(name, options) else - @env.ui.info("vagrant.actions.vm.forward_ports.non_nat", message_attributes) + @env.ui.info(I18n.t("vagrant.actions.vm.forward_ports.non_nat", message_attributes)) end end diff --git a/lib/vagrant/action/vm/halt.rb b/lib/vagrant/action/vm/halt.rb index ef578fa132d..935627a7c60 100644 --- a/lib/vagrant/action/vm/halt.rb +++ b/lib/vagrant/action/vm/halt.rb @@ -12,7 +12,7 @@ def call(env) env["vm"].system.halt if !env["force"] if env["vm"].vm.state(true) != :powered_off - env.ui.info "vagrant.actions.vm.halt.force" + env.ui.info I18n.t("vagrant.actions.vm.halt.force") env["vm"].vm.stop end diff --git a/lib/vagrant/action/vm/import.rb b/lib/vagrant/action/vm/import.rb index 1396e15b8ab..33e781a2f6a 100644 --- a/lib/vagrant/action/vm/import.rb +++ b/lib/vagrant/action/vm/import.rb @@ -7,7 +7,7 @@ def initialize(app, env) end def call(env) - env.ui.info "vagrant.actions.vm.import.importing", :name => env.env.box.name + env.ui.info I18n.t("vagrant.actions.vm.import.importing", :name => env.env.box.name) # Import the virtual machine env.env.vm.vm = VirtualBox::VM.import(env.env.box.ovf_file.to_s) do |progress| diff --git a/lib/vagrant/action/vm/match_mac_address.rb b/lib/vagrant/action/vm/match_mac_address.rb index 44332cab0d3..b64cfd7837a 100644 --- a/lib/vagrant/action/vm/match_mac_address.rb +++ b/lib/vagrant/action/vm/match_mac_address.rb @@ -7,7 +7,7 @@ def initialize(app, env) end def call(env) - env.ui.info "vagrant.actions.vm.match_mac.matching" + env.ui.info I18n.t("vagrant.actions.vm.match_mac.matching") env["vm"].vm.network_adapters.first.mac_address = env.env.config.vm.base_mac env["vm"].vm.save diff --git a/lib/vagrant/action/vm/network.rb b/lib/vagrant/action/vm/network.rb index c9ca0969ee9..0236b853586 100644 --- a/lib/vagrant/action/vm/network.rb +++ b/lib/vagrant/action/vm/network.rb @@ -20,7 +20,7 @@ def call(env) @app.call(env) if enable_network? - @env.ui.info "vagrant.actions.vm.network.enabling" + @env.ui.info I18n.t("vagrant.actions.vm.network.enabling") @env["vm"].system.prepare_host_only_network @env.env.config.vm.network_options.compact.each do |network_options| @env["vm"].system.enable_host_only_network(network_options) @@ -54,7 +54,7 @@ def enable_network? # Enables and assigns the host only network to the proper # adapter on the VM, and saves the adapter. def assign_network - @env.ui.info "vagrant.actions.vm.network.preparing" + @env.ui.info I18n.t("vagrant.actions.vm.network.preparing") @env.env.config.vm.network_options.compact.each do |network_options| adapter = @env["vm"].vm.network_adapters[network_options[:adapter]] @@ -86,7 +86,7 @@ def network_name(net_options) raise Errors::NetworkNotFound.new(:name => net_options[:name]) if net_options[:name] # One doesn't exist, create it. - @env.ui.info "vagrant.actions.vm.network.creating" + @env.ui.info I18n.t("vagrant.actions.vm.network.creating") ni = interfaces.create ni.enable_static(network_ip(net_options[:ip], net_options[:netmask]), diff --git a/lib/vagrant/action/vm/nfs.rb b/lib/vagrant/action/vm/nfs.rb index c50bcf03340..193b5b9335f 100644 --- a/lib/vagrant/action/vm/nfs.rb +++ b/lib/vagrant/action/vm/nfs.rb @@ -104,14 +104,14 @@ def prepare_permission(perm, opts) # involves adding a line to `/etc/exports` for this VM, but it is # up to the host class to define the specific behavior. def export_folders - @env.ui.info "vagrant.actions.vm.nfs.exporting" + @env.ui.info I18n.t("vagrant.actions.vm.nfs.exporting") @env["host"].nfs_export(guest_ip, folders) end # Uses the system class to mount the NFS folders. def mount_folders - @env.ui.info "vagrant.actions.vm.nfs.mounting" + @env.ui.info I18n.t("vagrant.actions.vm.nfs.mounting") @env["vm"].system.mount_nfs(host_ip, folders) end diff --git a/lib/vagrant/action/vm/provision.rb b/lib/vagrant/action/vm/provision.rb index 7150c3e7d93..b8771746eb0 100644 --- a/lib/vagrant/action/vm/provision.rb +++ b/lib/vagrant/action/vm/provision.rb @@ -13,7 +13,7 @@ def call(env) @app.call(env) if provisioning_enabled? - @env.ui.info "vagrant.actions.vm.provision.beginning" + @env.ui.info I18n.t("vagrant.actions.vm.provision.beginning") @provisioner.provision! end end @@ -40,7 +40,7 @@ def load_provisioner @provisioner = provisioner_klass.new(@env) end - @env.ui.info "vagrant.actions.vm.provision.enabled", :provisioner => @provisioner.class.to_s + @env.ui.info I18n.t("vagrant.actions.vm.provision.enabled", :provisioner => @provisioner.class.to_s) @provisioner.prepare @provisioner end diff --git a/lib/vagrant/action/vm/resume.rb b/lib/vagrant/action/vm/resume.rb index 7177f1d10f7..b3d2b265a4c 100644 --- a/lib/vagrant/action/vm/resume.rb +++ b/lib/vagrant/action/vm/resume.rb @@ -8,7 +8,7 @@ def initialize(app, env) def call(env) if env["vm"].vm.saved? - env.ui.info "vagrant.actions.vm.resume.resuming" + env.ui.info I18n.t("vagrant.actions.vm.resume.resuming") env["actions"].run(Boot) end diff --git a/lib/vagrant/action/vm/share_folders.rb b/lib/vagrant/action/vm/share_folders.rb index cea5328f9d3..36bd451a68c 100644 --- a/lib/vagrant/action/vm/share_folders.rb +++ b/lib/vagrant/action/vm/share_folders.rb @@ -33,7 +33,7 @@ def shared_folders end def create_metadata - @env.ui.info "vagrant.actions.vm.share_folders.creating" + @env.ui.info I18n.t("vagrant.actions.vm.share_folders.creating") shared_folders.each do |name, data| folder = VirtualBox::SharedFolder.new @@ -46,13 +46,13 @@ def create_metadata end def mount_shared_folders - @env.ui.info "vagrant.actions.vm.share_folders.mounting" + @env.ui.info I18n.t("vagrant.actions.vm.share_folders.mounting") @env["vm"].ssh.execute do |ssh| shared_folders.each do |name, data| - @env.ui.info("vagrant.actions.vm.share_folders.mounting_entry", + @env.ui.info(I18n.t("vagrant.actions.vm.share_folders.mounting_entry", :name => name, - :guest_path => data[:guestpath]) + :guest_path => data[:guestpath])) @env["vm"].system.mount_shared_folder(ssh, name, data[:guestpath]) end end diff --git a/lib/vagrant/action/vm/suspend.rb b/lib/vagrant/action/vm/suspend.rb index 47cf32d53ef..309a8e73794 100644 --- a/lib/vagrant/action/vm/suspend.rb +++ b/lib/vagrant/action/vm/suspend.rb @@ -8,7 +8,7 @@ def initialize(app, env) def call(env) if env["vm"].vm.running? - env.ui.info "vagrant.actions.vm.suspend.suspending" + env.ui.info I18n.t("vagrant.actions.vm.suspend.suspending") env["vm"].vm.save_state end diff --git a/lib/vagrant/command/box.rb b/lib/vagrant/command/box.rb index 04ce2e8af8a..8df80f52afe 100644 --- a/lib/vagrant/command/box.rb +++ b/lib/vagrant/command/box.rb @@ -25,8 +25,8 @@ def repackage(name) desc "list", "Lists all installed boxes" def list boxes = env.boxes.sort - return env.ui.warn("vagrant.commands.box.no_installed_boxes", :_prefix => false) if boxes.empty? - boxes.each { |b| env.ui.info(b.name, :_translate => false, :_prefix => false) } + return env.ui.warn(I18n.t("vagrant.commands.box.no_installed_boxes"), :_prefix => false) if boxes.empty? + boxes.each { |b| env.ui.info(b.name, :_prefix => false) } end end end diff --git a/lib/vagrant/command/destroy.rb b/lib/vagrant/command/destroy.rb index d791e9f3ae9..a672c0f241c 100644 --- a/lib/vagrant/command/destroy.rb +++ b/lib/vagrant/command/destroy.rb @@ -8,7 +8,7 @@ def execute if vm.created? vm.destroy else - vm.env.ui.info "vagrant.commands.common.vm_not_created" + vm.env.ui.info I18n.t("vagrant.commands.common.vm_not_created") end end end diff --git a/lib/vagrant/command/halt.rb b/lib/vagrant/command/halt.rb index 5918387fcf0..3b4d6f85aed 100644 --- a/lib/vagrant/command/halt.rb +++ b/lib/vagrant/command/halt.rb @@ -9,7 +9,7 @@ def execute if vm.created? vm.halt(options) else - vm.env.ui.info "vagrant.commands.common.vm_not_created" + vm.env.ui.info I18n.t("vagrant.commands.common.vm_not_created") end end end diff --git a/lib/vagrant/command/provision.rb b/lib/vagrant/command/provision.rb index dd332029007..4c797f61ae5 100644 --- a/lib/vagrant/command/provision.rb +++ b/lib/vagrant/command/provision.rb @@ -8,7 +8,7 @@ def execute if vm.created? && vm.vm.running? vm.provision else - vm.env.ui.info "vagrant.commands.common.vm_not_created" + vm.env.ui.info I18n.t("vagrant.commands.common.vm_not_created") end end end diff --git a/lib/vagrant/command/reload.rb b/lib/vagrant/command/reload.rb index df72ddda657..e359cb6c8c0 100644 --- a/lib/vagrant/command/reload.rb +++ b/lib/vagrant/command/reload.rb @@ -8,7 +8,7 @@ def execute if vm.created? vm.reload else - vm.env.ui.info "vagrant.commands.common.vm_not_created" + vm.env.ui.info I18n.t("vagrant.commands.common.vm_not_created") end end end diff --git a/lib/vagrant/command/resume.rb b/lib/vagrant/command/resume.rb index d76790f36ac..be91719542e 100644 --- a/lib/vagrant/command/resume.rb +++ b/lib/vagrant/command/resume.rb @@ -8,7 +8,7 @@ def execute if vm.created? vm.resume else - vm.env.ui.info "vagrant.commands.common.vm_not_created" + vm.env.ui.info I18n.t("vagrant.commands.common.vm_not_created") end end end diff --git a/lib/vagrant/command/ssh.rb b/lib/vagrant/command/ssh.rb index b5d03a91c88..31e11f07a58 100644 --- a/lib/vagrant/command/ssh.rb +++ b/lib/vagrant/command/ssh.rb @@ -16,9 +16,9 @@ def execute def ssh_execute ssh_vm.ssh.execute do |ssh| - ssh_vm.env.ui.info "vagrant.commands.ssh.execute", :command => options[:execute] + ssh_vm.env.ui.info I18n.t("vagrant.commands.ssh.execute", :command => options[:execute]) ssh.exec!(options[:execute]) do |channel, type, data| - ssh_vm.env.ui.info "#{data}", :_translate => false + ssh_vm.env.ui.info "#{data}" end end end diff --git a/lib/vagrant/command/ssh_config.rb b/lib/vagrant/command/ssh_config.rb index 6450971483c..92d70bd67c5 100644 --- a/lib/vagrant/command/ssh_config.rb +++ b/lib/vagrant/command/ssh_config.rb @@ -14,7 +14,7 @@ def execute :ssh_user => vm.env.config.ssh.username, :ssh_port => vm.ssh.port, :private_key_path => vm.env.config.ssh.private_key_path - }), :_translate => false, :_prefix => false) + }), :_prefix => false) end end end diff --git a/lib/vagrant/command/status.rb b/lib/vagrant/command/status.rb index d5ba6f8afb4..c4325cb73cb 100644 --- a/lib/vagrant/command/status.rb +++ b/lib/vagrant/command/status.rb @@ -13,9 +13,9 @@ def route state = env.vms.length == 1 ? state : "listing" - env.ui.info("vagrant.commands.status.output", + env.ui.info(I18n.t("vagrant.commands.status.output", :states => results.join("\n"), - :message => I18n.t("vagrant.commands.status.#{state}"), + :message => I18n.t("vagrant.commands.status.#{state}")), :_prefix => false) end end diff --git a/lib/vagrant/command/suspend.rb b/lib/vagrant/command/suspend.rb index e633277686b..a590d16cd5d 100644 --- a/lib/vagrant/command/suspend.rb +++ b/lib/vagrant/command/suspend.rb @@ -8,7 +8,7 @@ def execute if vm.created? vm.suspend else - vm.env.ui.info "vagrant.commands.common.vm_not_created" + vm.env.ui.info I18n.t("vagrant.commands.common.vm_not_created") end end end diff --git a/lib/vagrant/command/up.rb b/lib/vagrant/command/up.rb index 74cac6a96e5..9b29292ba5a 100644 --- a/lib/vagrant/command/up.rb +++ b/lib/vagrant/command/up.rb @@ -8,7 +8,7 @@ def execute # TODO: Make the options[:provision] actually mean something target_vms.each do |vm| if vm.created? - vm.env.ui.info "vagrant.commands.up.vm_created" + vm.env.ui.info I18n.t("vagrant.commands.up.vm_created") vm.start else vm.up diff --git a/lib/vagrant/command/upgrade_to_060.rb b/lib/vagrant/command/upgrade_to_060.rb index a9d480838e1..3820e7a4ca1 100644 --- a/lib/vagrant/command/upgrade_to_060.rb +++ b/lib/vagrant/command/upgrade_to_060.rb @@ -6,22 +6,22 @@ class UpgradeTo060Command < Base register "upgrade_to_060", "Upgrade pre-0.6.0 environment to 0.6.0", :hide => true def execute - @env.ui.warn "vagrant.commands.upgrade_to_060.info", :_prefix => false - @env.ui.warn "", :_translate => false, :_prefix => false - if !@env.ui.yes? "vagrant.commands.upgrade_to_060.ask", :_prefix => false, :_color => :yellow - @env.ui.info "vagrant.commands.upgrade_to_060.quit", :_prefix => false + @env.ui.warn I18n.t("vagrant.commands.upgrade_to_060.info"), :_prefix => false + @env.ui.warn "", :_prefix => false + if !@env.ui.yes? I18n.t("vagrant.commands.upgrade_to_060.ask"), :_prefix => false, :_color => :yellow + @env.ui.info I18n.t("vagrant.commands.upgrade_to_060.quit"), :_prefix => false return end local_data = @env.local_data if !local_data.empty? if local_data[:active] - @env.ui.confirm "vagrant.commands.upgrade_to_060.already_done", :_prefix => false + @env.ui.confirm I18n.t("vagrant.commands.upgrade_to_060.already_done"), :_prefix => false return end # Backup the previous file - @env.ui.info "vagrant.commands.upgrade_to_060.backing_up", :_prefix => false + @env.ui.info I18n.t("vagrant.commands.upgrade_to_060.backing_up"), :_prefix => false FileUtils.cp(local_data.file_path, "#{local_data.file_path}.bak-#{Time.now.to_i}") # Gather the previously set virtual machines into a single @@ -38,7 +38,7 @@ def execute local_data.commit end - @env.ui.confirm "vagrant.commands.upgrade_to_060.complete", :_prefix => false + @env.ui.confirm I18n.t("vagrant.commands.upgrade_to_060.complete"), :_prefix => false end end end diff --git a/lib/vagrant/command/version.rb b/lib/vagrant/command/version.rb index 324751905b5..53b312e13a8 100644 --- a/lib/vagrant/command/version.rb +++ b/lib/vagrant/command/version.rb @@ -4,8 +4,8 @@ class VersionCommand < Base register "version", "Prints the Vagrant version information", :alias => %w(-v --version) def version - env.ui.info("vagrant.commands.version.output", - :version => Vagrant::VERSION, + env.ui.info(I18n.t("vagrant.commands.version.output", + :version => Vagrant::VERSION), :_prefix => false) end end diff --git a/lib/vagrant/environment.rb b/lib/vagrant/environment.rb index 7255d2f99d1..ed46d3c5af0 100644 --- a/lib/vagrant/environment.rb +++ b/lib/vagrant/environment.rb @@ -280,7 +280,7 @@ def load_home_directory! dirs.each do |dir| next if File.directory?(dir) - ui.info "vagrant.general.creating_home_dir", :directory => dir + ui.info I18n.t("vagrant.general.creating_home_dir", :directory => dir) FileUtils.mkdir_p(dir) end end diff --git a/lib/vagrant/hosts/bsd.rb b/lib/vagrant/hosts/bsd.rb index 7d63c4b9104..9bf3f231089 100644 --- a/lib/vagrant/hosts/bsd.rb +++ b/lib/vagrant/hosts/bsd.rb @@ -19,7 +19,7 @@ def nfs_export(ip, folders) # The sleep ensures that the output is truly flushed before any `sudo` # commands are issued. - env.ui.info "vagrant.hosts.bsd.nfs_export.prepare" + env.ui.info I18n.t("vagrant.hosts.bsd.nfs_export.prepare") sleep 0.5 output.split("\n").each do |line| diff --git a/lib/vagrant/hosts/linux.rb b/lib/vagrant/hosts/linux.rb index 1d9706f2d65..68466491e63 100644 --- a/lib/vagrant/hosts/linux.rb +++ b/lib/vagrant/hosts/linux.rb @@ -18,7 +18,7 @@ def nfs_export(ip, folders) :ip => ip, :folders => folders) - env.ui.info "vagrant.hosts.linux.nfs_export.prepare" + env.ui.info I18n.t("vagrant.hosts.linux.nfs_export.prepare") sleep 0.5 output.split("\n").each do |line| diff --git a/lib/vagrant/provisioners/chef.rb b/lib/vagrant/provisioners/chef.rb index cd27a2c55d0..b98e2018d39 100644 --- a/lib/vagrant/provisioners/chef.rb +++ b/lib/vagrant/provisioners/chef.rb @@ -32,7 +32,7 @@ def setup_config(template, filename, template_vars) end def setup_json - env.ui.info "vagrant.provisioners.chef.json" + env.ui.info I18n.t("vagrant.provisioners.chef.json") # Set up initial configuration data = { diff --git a/lib/vagrant/provisioners/chef_server.rb b/lib/vagrant/provisioners/chef_server.rb index 2a67fb5d2df..9ac3578cc02 100644 --- a/lib/vagrant/provisioners/chef_server.rb +++ b/lib/vagrant/provisioners/chef_server.rb @@ -22,7 +22,7 @@ def provision! end def create_client_key_folder - env.ui.info "vagrant.provisioners.chef.client_key_folder" + env.ui.info I18n.t("vagrant.provisioners.chef.client_key_folder") path = Pathname.new(env.config.chef.client_key_path) vm.ssh.execute do |ssh| @@ -31,7 +31,7 @@ def create_client_key_folder end def upload_validation_key - env.ui.info "vagrant.provisioners.chef.upload_validation_key" + env.ui.info I18n.t("vagrant.provisioners.chef.upload_validation_key") vm.ssh.upload!(validation_key_path, guest_validation_key_path) end @@ -48,13 +48,13 @@ def setup_server_config def run_chef_client command = "cd #{env.config.chef.provisioning_path} && sudo -E chef-client -c client.rb -j dna.json" - env.ui.info "vagrant.provisioners.chef.running_client" + env.ui.info I18n.t("vagrant.provisioners.chef.running_client") vm.ssh.execute do |ssh| ssh.exec!(command) do |channel, type, data| if type == :exit_status ssh.check_exit_status(data, command) else - env.ui.info("#{data}: #{type}", :_translate => false) + env.ui.info("#{data}: #{type}") end end end diff --git a/lib/vagrant/provisioners/chef_solo.rb b/lib/vagrant/provisioners/chef_solo.rb index 73489eb5337..d152e9c4e81 100644 --- a/lib/vagrant/provisioners/chef_solo.rb +++ b/lib/vagrant/provisioners/chef_solo.rb @@ -40,11 +40,11 @@ def setup_solo_config def run_chef_solo command = "cd #{env.config.chef.provisioning_path} && sudo -E chef-solo -c solo.rb -j dna.json" - env.ui.info "vagrant.provisioners.chef.running_solo" + env.ui.info I18n.t("vagrant.provisioners.chef.running_solo") vm.ssh.execute do |ssh| ssh.exec!(command) do |channel, type, data| ssh.check_exit_status(data, command) if type == :exit_status - env.ui.info("#{data}: #{type}", :_translate => false) if type != :exit_status + env.ui.info("#{data}: #{type}") if type != :exit_status end end end diff --git a/lib/vagrant/systems/linux.rb b/lib/vagrant/systems/linux.rb index a05ebc3747b..a36ae49ad9e 100644 --- a/lib/vagrant/systems/linux.rb +++ b/lib/vagrant/systems/linux.rb @@ -28,7 +28,7 @@ def initialize # Overridden methods #------------------------------------------------------------------- def halt - vm.env.ui.info "vagrant.systems.linux.attempting_halt" + vm.env.ui.info I18n.t("vagrant.systems.linux.attempting_halt") vm.ssh.execute do |ssh| ssh.exec!("sudo halt") end diff --git a/lib/vagrant/systems/solaris.rb b/lib/vagrant/systems/solaris.rb index c4a08905e2d..cf5692a858e 100644 --- a/lib/vagrant/systems/solaris.rb +++ b/lib/vagrant/systems/solaris.rb @@ -31,7 +31,7 @@ class SolarisError < Errors::VagrantError # # does not exist in /etc/user_attr. TODO def halt - vm.env.ui.info "vagrant.systems.solaris.attempting_halt" + vm.env.ui.info I18n.t("vagrant.systems.solaris.attempting_halt") vm.ssh.execute do |ssh| ssh.exec!("pfexec poweroff") end diff --git a/lib/vagrant/ui.rb b/lib/vagrant/ui.rb index 7e6d9d7ebf8..393c2b2aee8 100644 --- a/lib/vagrant/ui.rb +++ b/lib/vagrant/ui.rb @@ -50,8 +50,7 @@ def report_progress(progress, total, show_parts=true) protected def format_message(message, opts=nil) - opts = { :_prefix => true, :_translate => true }.merge(opts || {}) - message = I18n.t(message, opts) if opts[:_translate] + opts = { :_prefix => true }.merge(opts || {}) message = "[#{env.resource}] #{message}" if opts[:_prefix] message end diff --git a/test/vagrant/ui_test.rb b/test/vagrant/ui_test.rb index 72802344f00..cdd1fba7d3b 100644 --- a/test/vagrant/ui_test.rb +++ b/test/vagrant/ui_test.rb @@ -26,24 +26,4 @@ class ShellUITest < Test::Unit::TestCase @instance.info("vagrant.errors.test_key", :_prefix => false) end end - - context "translating" do - should "translate the message by default" do - @shell.expects(:say).with() do |message, color| - assert message.include?(I18n.t("vagrant.errors.test_key")) - true - end - - @instance.info("vagrant.errors.test_key") - end - - should "not translate the message if noted" do - @shell.expects(:say).with() do |message, color| - assert message.include?("vagrant.errors.test_key") - true - end - - @instance.info("vagrant.errors.test_key", :_translate => false) - end - end end