From 59443e7962e9e96d4a09582a902139de072e4726 Mon Sep 17 00:00:00 2001 From: Leon Kai Yu Date: Tue, 1 Jan 2013 17:41:00 +0800 Subject: [PATCH] add i18n support fix visit method not found in rspec --- lib/bootstrap_helper/breadcrumb.rb | 2 +- lib/bootstrap_helper/locale/en.yml | 2 ++ lib/bootstrap_helper/locale/zh-CN.yml | 2 ++ lib/bootstrap_helper/locale/zh-TW.yml | 2 ++ spec/spec_helper.rb | 2 ++ 5 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 lib/bootstrap_helper/locale/en.yml create mode 100644 lib/bootstrap_helper/locale/zh-CN.yml create mode 100644 lib/bootstrap_helper/locale/zh-TW.yml diff --git a/lib/bootstrap_helper/breadcrumb.rb b/lib/bootstrap_helper/breadcrumb.rb index 43c1c65..40f6a15 100644 --- a/lib/bootstrap_helper/breadcrumb.rb +++ b/lib/bootstrap_helper/breadcrumb.rb @@ -15,7 +15,7 @@ module InstanceMethods protected def set_breadcrumbs - @breadcrumbs = ["Home".html_safe] + @breadcrumbs = ["#{t('home')}".html_safe] end def drop_breadcrumb(title=nil, url=nil) diff --git a/lib/bootstrap_helper/locale/en.yml b/lib/bootstrap_helper/locale/en.yml new file mode 100644 index 0000000..8a832be --- /dev/null +++ b/lib/bootstrap_helper/locale/en.yml @@ -0,0 +1,2 @@ +"en": + home: "Home" \ No newline at end of file diff --git a/lib/bootstrap_helper/locale/zh-CN.yml b/lib/bootstrap_helper/locale/zh-CN.yml new file mode 100644 index 0000000..044d4a5 --- /dev/null +++ b/lib/bootstrap_helper/locale/zh-CN.yml @@ -0,0 +1,2 @@ +"zh-CN": + home: "首页" \ No newline at end of file diff --git a/lib/bootstrap_helper/locale/zh-TW.yml b/lib/bootstrap_helper/locale/zh-TW.yml new file mode 100644 index 0000000..b57610a --- /dev/null +++ b/lib/bootstrap_helper/locale/zh-TW.yml @@ -0,0 +1,2 @@ +"zh-TW": + home: "首頁" \ No newline at end of file diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 1806381..2382046 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -14,6 +14,8 @@ RSpec.configure do |config| + config.include Capybara::DSL + # ## Mock Framework # # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line: