diff --git a/goby.gemspec b/goby.gemspec index 8aeaa6d..178e1e1 100644 --- a/goby.gemspec +++ b/goby.gemspec @@ -1,10 +1,11 @@ # coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) +require 'goby/version' Gem::Specification.new do |spec| spec.name = "goby" - spec.version = "0.1.0" + spec.version = Goby::VERSION.dup spec.authors = ["Nicholas Skinsacos"] spec.email = ["nskins@umich.edu"] @@ -12,11 +13,14 @@ Gem::Specification.new do |spec| spec.homepage = "https://github.com/nskins/goby" spec.license = "MIT" + spec.files = Dir["{lib}/**/*", "LICENSE", "README.md" ] spec.files = Dir["{exe}/**/*", "{lib}/**/*", "{res}/**/*", "LICENSE", "README.md" ] spec.bindir = "exe" spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ["lib"] + spec.add_dependency "i18n", "~> 0.8" + spec.add_development_dependency "bundler", "~> 1.14" spec.add_development_dependency "rake", "~> 10.0" spec.add_development_dependency "rspec", "~> 3.0" diff --git a/lib/goby.rb b/lib/goby.rb index 7ba6b06..1e03ac3 100644 --- a/lib/goby.rb +++ b/lib/goby.rb @@ -1,3 +1,9 @@ +# Main module of the framework. +# Import order matters. + +require 'i18n' +I18n.load_path = Dir["#{File.expand_path(File.dirname(__FILE__))}/goby/config/locales/*.yml"] + # Import order matters. require 'goby/scaffold' diff --git a/lib/goby/config/locales/en.yml b/lib/goby/config/locales/en.yml new file mode 100644 index 0000000..62bd2d8 --- /dev/null +++ b/lib/goby/config/locales/en.yml @@ -0,0 +1,6 @@ +en: + goby: + entity: + errors: + no_such_item: "What?! You don't have THAT!" + item_not_equipped: "You are not equipping THAT!" diff --git a/lib/goby/config/locales/es.yml b/lib/goby/config/locales/es.yml new file mode 100644 index 0000000..aa576d2 --- /dev/null +++ b/lib/goby/config/locales/es.yml @@ -0,0 +1,6 @@ +en: + goby: + entity: + errors: + no_such_item: "¿Qué? ¡No tienes eso!" + item_not_equipped: "¡No estás equipando eso!" diff --git a/lib/goby/entity/entity.rb b/lib/goby/entity/entity.rb index 82a05d6..bbe9bcd 100644 --- a/lib/goby/entity/entity.rb +++ b/lib/goby/entity/entity.rb @@ -7,9 +7,9 @@ module Goby class Entity # Error when the entity specifies a non-existent item. - NO_SUCH_ITEM_ERROR = "What?! You don't have THAT!\n\n" + NO_SUCH_ITEM_ERROR = I18n.t('goby.entity.errors.no_such_item') # Error when the entity specifies an item not equipped. - NOT_EQUIPPED_ERROR = "You are not equipping THAT!\n\n" + NOT_EQUIPPED_ERROR = I18n.t('goby.entity.errors.item_not_equipped') # @param [String] name the name. # @param [Hash] stats hash of stats @@ -372,4 +372,4 @@ def check_and_set_gold end -end \ No newline at end of file +end diff --git a/lib/goby/version.rb b/lib/goby/version.rb new file mode 100644 index 0000000..d80716b --- /dev/null +++ b/lib/goby/version.rb @@ -0,0 +1,4 @@ +module Goby + # Version of the framework. + VERSION = "0.1.0".freeze +end