From b109e3c4ad763fdc130d780b47712d2c7dcf895d Mon Sep 17 00:00:00 2001 From: Fabio Rehm Date: Sat, 3 Aug 2013 14:26:10 -0300 Subject: [PATCH] Extract "skipping bucket" message out to a locale file --- lib/vagrant-cachier/bucket/apt.rb | 2 +- lib/vagrant-cachier/bucket/chef.rb | 2 +- lib/vagrant-cachier/bucket/gem.rb | 2 +- lib/vagrant-cachier/bucket/pacman.rb | 2 +- lib/vagrant-cachier/bucket/rvm.rb | 2 +- lib/vagrant-cachier/bucket/yum.rb | 2 +- lib/vagrant-cachier/plugin.rb | 3 +++ locales/en.yml | 4 ++++ 8 files changed, 13 insertions(+), 6 deletions(-) create mode 100644 locales/en.yml diff --git a/lib/vagrant-cachier/bucket/apt.rb b/lib/vagrant-cachier/bucket/apt.rb index f7f9165..d52219b 100644 --- a/lib/vagrant-cachier/bucket/apt.rb +++ b/lib/vagrant-cachier/bucket/apt.rb @@ -24,7 +24,7 @@ module VagrantPlugins end end else - @env[:ui].info "Skipping APT cache bucket as the guest machine does not support it" + @env[:ui].info I18n.t('vagrant_cachier.skipping_bucket', bucket: 'APT') end end end diff --git a/lib/vagrant-cachier/bucket/chef.rb b/lib/vagrant-cachier/bucket/chef.rb index 0ebe7df..b78bbe4 100644 --- a/lib/vagrant-cachier/bucket/chef.rb +++ b/lib/vagrant-cachier/bucket/chef.rb @@ -24,7 +24,7 @@ module VagrantPlugins end end else - @env[:ui].info "Skipping Chef cache bucket as the guest machine does not support it" + @env[:ui].info I18n.t('vagrant_cachier.skipping_bucket', bucket: 'Chef') end end end diff --git a/lib/vagrant-cachier/bucket/gem.rb b/lib/vagrant-cachier/bucket/gem.rb index 4919bb1..e166520 100644 --- a/lib/vagrant-cachier/bucket/gem.rb +++ b/lib/vagrant-cachier/bucket/gem.rb @@ -29,7 +29,7 @@ module VagrantPlugins end end else - @env[:ui].info "Skipping RubyGems cache bucket as the guest machine does not support it" + @env[:ui].info I18n.t('vagrant_cachier.skipping_bucket', bucket: 'RubyGems') end end end diff --git a/lib/vagrant-cachier/bucket/pacman.rb b/lib/vagrant-cachier/bucket/pacman.rb index 7b048f2..c9d9cdc 100644 --- a/lib/vagrant-cachier/bucket/pacman.rb +++ b/lib/vagrant-cachier/bucket/pacman.rb @@ -24,7 +24,7 @@ module VagrantPlugins end end else - @env[:ui].info "Skipping Pacman cache bucket as the guest machine does not support it" + @env[:ui].info I18n.t('vagrant_cachier.skipping_bucket', bucket: 'Pacman') end end end diff --git a/lib/vagrant-cachier/bucket/rvm.rb b/lib/vagrant-cachier/bucket/rvm.rb index b584b86..ce57ff8 100644 --- a/lib/vagrant-cachier/bucket/rvm.rb +++ b/lib/vagrant-cachier/bucket/rvm.rb @@ -29,7 +29,7 @@ module VagrantPlugins end end else - @env[:ui].info "Skipping RVM cache bucket as the guest machine does not support it" + @env[:ui].info I18n.t('vagrant_cachier.skipping_bucket', bucket: 'RVM') end end end diff --git a/lib/vagrant-cachier/bucket/yum.rb b/lib/vagrant-cachier/bucket/yum.rb index 3665d57..d43af7c 100644 --- a/lib/vagrant-cachier/bucket/yum.rb +++ b/lib/vagrant-cachier/bucket/yum.rb @@ -27,7 +27,7 @@ module VagrantPlugins end end else - @env[:ui].info "Skipping Yum cache bucket as the guest machine does not support it" + @env[:ui].info I18n.t('vagrant_cachier.skipping_bucket', bucket: 'Yum') end end end diff --git a/lib/vagrant-cachier/plugin.rb b/lib/vagrant-cachier/plugin.rb index c337090..597f338 100644 --- a/lib/vagrant-cachier/plugin.rb +++ b/lib/vagrant-cachier/plugin.rb @@ -3,6 +3,9 @@ Vagrant::Action::Builtin::Provision.class_eval do include VagrantPlugins::Cachier::Action::ProvisionExt end +# Add our custom translations to the load path +I18n.load_path << File.expand_path("../../../locales/en.yml", __FILE__) + module VagrantPlugins module Cachier class Plugin < Vagrant.plugin('2') diff --git a/locales/en.yml b/locales/en.yml new file mode 100644 index 0000000..0a9ed0c --- /dev/null +++ b/locales/en.yml @@ -0,0 +1,4 @@ +en: + vagrant_cachier: + skipping_bucket: |- + Skipping %{bucket} cache bucket as the guest machine does not support it