Sha256: 52cf16aff7b82c8fb710ee911a0ef5e731e06c4a1a7cbfe61144242bab357ef2
Contents?: true
Size: 1.09 KB
Versions: 12
Compression:
Stored size: 1.09 KB
Contents
require "i18n" require "pact_broker/api/pact_broker_urls" I18n.config.load_path << File.expand_path("../locale/en.yml", __FILE__) module PactBroker # Provides an interface to the I18n library specifically for # the PactBroker's messages. module Messages extend self # Interpolates an internationalized string. # @param [String] key the name of the string to interpolate # @param [Hash] options options to pass to I18n, including # variables to interpolate. # @return [String] the interpolated string def message(key, options={}) ::I18n.t(key, **{ :scope => :pact_broker }.merge(options)) end def validation_message key, options = {} message("errors.validation." + key, options) end def validation_message_at_index key, index, options = {} message("errors.validation." + key, options).chomp(".") + " (at index #{index})" end def pluralize(word, count) if count == 1 word else if word.end_with?("y") word.chomp("y") + "ies" else word + "s" end end end end end
Version data entries
12 entries across 12 versions & 1 rubygems