UI methods no longer automatically translate. Makes it easier for plugin developers.

This commit is contained in:
Mitchell Hashimoto 2010-09-21 18:10:46 -06:00
parent 5316a520c6
commit d003cc4f32
51 changed files with 85 additions and 106 deletions

View File

@ -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)

View File

@ -56,11 +56,11 @@ module Vagrant
# 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

View File

@ -10,7 +10,7 @@ module Vagrant
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)

View File

@ -28,7 +28,7 @@ module Vagrant
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 @@ module Vagrant
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 @@ module Vagrant
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

View File

@ -45,7 +45,7 @@ module Vagrant
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

View File

@ -9,7 +9,7 @@ module Vagrant
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

View File

@ -66,7 +66,7 @@ module Vagrant
# 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 @@ module Vagrant
# 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

View File

@ -17,16 +17,16 @@ module Vagrant
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 @@ module Vagrant
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

View File

@ -14,7 +14,7 @@ module Vagrant
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

View File

@ -14,11 +14,11 @@ module Vagrant
# 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

View File

@ -19,7 +19,7 @@ module Vagrant
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

View File

@ -16,7 +16,7 @@ module Vagrant
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|

View File

@ -8,7 +8,7 @@ module Vagrant
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

View File

@ -7,7 +7,7 @@ module Vagrant
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

View File

@ -21,7 +21,7 @@ module Vagrant
# 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

View File

@ -17,7 +17,7 @@ module Vagrant
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

View File

@ -10,7 +10,7 @@ module Vagrant
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

View File

@ -31,13 +31,13 @@ module Vagrant
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

View File

@ -72,9 +72,9 @@ module Vagrant
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 @@ module Vagrant
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 @@ module Vagrant
# 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

View File

@ -12,7 +12,7 @@ module Vagrant
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

View File

@ -7,7 +7,7 @@ module Vagrant
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|

View File

@ -7,7 +7,7 @@ module Vagrant
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

View File

@ -20,7 +20,7 @@ module Vagrant
@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 @@ module Vagrant
# 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 @@ module Vagrant
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]),

View File

@ -104,14 +104,14 @@ module Vagrant
# 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

View File

@ -13,7 +13,7 @@ module Vagrant
@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 @@ module Vagrant
@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

View File

@ -8,7 +8,7 @@ module Vagrant
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

View File

@ -33,7 +33,7 @@ module Vagrant
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 @@ module Vagrant
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

View File

@ -8,7 +8,7 @@ module Vagrant
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

View File

@ -25,8 +25,8 @@ module Vagrant
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

View File

@ -8,7 +8,7 @@ module Vagrant
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

View File

@ -9,7 +9,7 @@ module Vagrant
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

View File

@ -8,7 +8,7 @@ module Vagrant
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

View File

@ -8,7 +8,7 @@ module Vagrant
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

View File

@ -8,7 +8,7 @@ module Vagrant
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

View File

@ -16,9 +16,9 @@ module Vagrant
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

View File

@ -14,7 +14,7 @@ module Vagrant
: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

View File

@ -13,9 +13,9 @@ module Vagrant
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

View File

@ -8,7 +8,7 @@ module Vagrant
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

View File

@ -8,7 +8,7 @@ module Vagrant
# 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

View File

@ -6,22 +6,22 @@ module Vagrant
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 @@ module Vagrant
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

View File

@ -4,8 +4,8 @@ module Vagrant
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

View File

@ -280,7 +280,7 @@ module Vagrant
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

View File

@ -19,7 +19,7 @@ module Vagrant
# 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|

View File

@ -18,7 +18,7 @@ module Vagrant
: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|

View File

@ -32,7 +32,7 @@ module Vagrant
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 = {

View File

@ -22,7 +22,7 @@ module Vagrant
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 @@ module Vagrant
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 @@ module Vagrant
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

View File

@ -40,11 +40,11 @@ module Vagrant
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

View File

@ -28,7 +28,7 @@ module Vagrant
# 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

View File

@ -31,7 +31,7 @@ module Vagrant
#
# 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

View File

@ -50,8 +50,7 @@ module Vagrant
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

View File

@ -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