gettext_i18n_rails-1.12.0/0000755000004100000410000000000014510305476015345 5ustar www-datawww-datagettext_i18n_rails-1.12.0/gettext_i18n_rails.gemspec0000644000004100000410000000645614510305476022442 0ustar www-datawww-data######################################################### # This file has been automatically generated by gem2tgz # ######################################################### # -*- encoding: utf-8 -*- # stub: gettext_i18n_rails 1.12.0 ruby lib Gem::Specification.new do |s| s.name = "gettext_i18n_rails".freeze s.version = "1.12.0" s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version= s.require_paths = ["lib".freeze] s.authors = ["Michael Grosser".freeze] s.date = "2023-06-21" s.email = "michael@grosser.it".freeze s.files = ["MIT-LICENSE.txt".freeze, "lib/gettext_i18n_rails.rb".freeze, "lib/gettext_i18n_rails/action_controller.rb".freeze, "lib/gettext_i18n_rails/active_model.rb".freeze, "lib/gettext_i18n_rails/active_model/name.rb".freeze, "lib/gettext_i18n_rails/active_model/translation.rb".freeze, "lib/gettext_i18n_rails/active_record.rb".freeze, "lib/gettext_i18n_rails/backend.rb".freeze, "lib/gettext_i18n_rails/base_parser.rb".freeze, "lib/gettext_i18n_rails/gettext_hooks.rb".freeze, "lib/gettext_i18n_rails/haml_parser.rb".freeze, "lib/gettext_i18n_rails/html_safe_translations.rb".freeze, "lib/gettext_i18n_rails/i18n_hacks.rb".freeze, "lib/gettext_i18n_rails/model_attributes_finder.rb".freeze, "lib/gettext_i18n_rails/railtie.rb".freeze, "lib/gettext_i18n_rails/slim_parser.rb".freeze, "lib/gettext_i18n_rails/string_interpolate_fix.rb".freeze, "lib/gettext_i18n_rails/tasks.rb".freeze, "lib/gettext_i18n_rails/version.rb".freeze, "lib/tasks/gettext_rails_i18n.rake".freeze] s.homepage = "http://github.com/grosser/gettext_i18n_rails".freeze s.licenses = ["MIT".freeze] s.required_ruby_version = Gem::Requirement.new(">= 2.1.0".freeze) s.rubygems_version = "3.2.5".freeze s.summary = "Simple FastGettext Rails integration.".freeze if s.respond_to? :specification_version then s.specification_version = 4 end if s.respond_to? :add_runtime_dependency then s.add_development_dependency(%q.freeze, [">= 0"]) s.add_runtime_dependency(%q.freeze, [">= 0.9.0"]) s.add_development_dependency(%q.freeze, [">= 3.0.2"]) s.add_development_dependency(%q.freeze, [">= 0"]) s.add_development_dependency(%q.freeze, [">= 0"]) s.add_development_dependency(%q.freeze, [">= 0"]) s.add_development_dependency(%q.freeze, [">= 0"]) s.add_development_dependency(%q.freeze, [">= 0"]) s.add_development_dependency(%q.freeze, [">= 3.7.1"]) s.add_development_dependency(%q.freeze, [">= 0"]) s.add_development_dependency(%q.freeze, [">= 0"]) s.add_development_dependency(%q.freeze, [">= 0"]) else s.add_dependency(%q.freeze, [">= 0"]) s.add_dependency(%q.freeze, [">= 0.9.0"]) s.add_dependency(%q.freeze, [">= 3.0.2"]) s.add_dependency(%q.freeze, [">= 0"]) s.add_dependency(%q.freeze, [">= 0"]) s.add_dependency(%q.freeze, [">= 0"]) s.add_dependency(%q.freeze, [">= 0"]) s.add_dependency(%q.freeze, [">= 0"]) s.add_dependency(%q.freeze, [">= 3.7.1"]) s.add_dependency(%q.freeze, [">= 0"]) s.add_dependency(%q.freeze, [">= 0"]) s.add_dependency(%q.freeze, [">= 0"]) end end gettext_i18n_rails-1.12.0/lib/0000755000004100000410000000000014510305476016113 5ustar www-datawww-datagettext_i18n_rails-1.12.0/lib/tasks/0000755000004100000410000000000014510305476017240 5ustar www-datawww-datagettext_i18n_rails-1.12.0/lib/tasks/gettext_rails_i18n.rake0000644000004100000410000000011214510305476023613 0ustar www-datawww-datarequire File.join(File.dirname(__FILE__), "/../gettext_i18n_rails/tasks") gettext_i18n_rails-1.12.0/lib/gettext_i18n_rails.rb0000644000004100000410000000220414510305476022153 0ustar www-datawww-datarequire 'gettext_i18n_rails/version' require 'gettext_i18n_rails/gettext_hooks' module GettextI18nRails IGNORE_TABLES = [/^sitemap_/, /_versions$/, 'schema_migrations', 'sessions', 'delayed_jobs'] end # translate from everywhere require 'fast_gettext' Object.send(:include, FastGettext::Translation) # make translations html_safe if possible and wanted if "".respond_to?(:html_safe?) require 'gettext_i18n_rails/html_safe_translations' Object.send(:include, GettextI18nRails::HtmlSafeTranslations) end # set up the backend require 'gettext_i18n_rails/backend' I18n.backend = GettextI18nRails::Backend.new # make I18n play nice with FastGettext require 'gettext_i18n_rails/i18n_hacks' # translate activerecord errors if defined? Rails::Railtie # Rails 3+ # load active_model extensions at the correct point in time require 'gettext_i18n_rails/railtie' else if defined? ActiveRecord require 'gettext_i18n_rails/active_record' elsif defined?(ActiveModel) require 'gettext_i18n_rails/active_model' end end # make bundle console work in a rails project require 'gettext_i18n_rails/action_controller' if defined?(ActionController) gettext_i18n_rails-1.12.0/lib/gettext_i18n_rails/0000755000004100000410000000000014510305476021630 5ustar www-datawww-datagettext_i18n_rails-1.12.0/lib/gettext_i18n_rails/base_parser.rb0000644000004100000410000000162614510305476024450 0ustar www-datawww-datarequire 'gettext_i18n_rails/gettext_hooks' module GettextI18nRails class BaseParser def self.target?(file) File.extname(file) == ".#{extension}" end def self.parse(file, options = {}, _msgids = []) return _msgids unless load_library code = convert_to_code(File.read(file)) GetText::RubyParser.new(file, options).parse_source(code) end def self.libraries [extension] end def self.load_library return true if @library_loaded loaded = libraries.detect do |library| if Gem::Specification.find_all_by_name(library).any? require library true else false end end unless loaded puts "No #{extension} library could be found: #{libraries.join(" or ")}" return false end require 'gettext/tools/parser/ruby' @library_loaded = loaded end end end gettext_i18n_rails-1.12.0/lib/gettext_i18n_rails/version.rb0000644000004100000410000000007314510305476023642 0ustar www-datawww-datamodule GettextI18nRails Version = VERSION = '1.12.0' end gettext_i18n_rails-1.12.0/lib/gettext_i18n_rails/active_model.rb0000644000004100000410000000014514510305476024610 0ustar www-datawww-datarequire 'gettext_i18n_rails/active_model/name' require 'gettext_i18n_rails/active_model/translation' gettext_i18n_rails-1.12.0/lib/gettext_i18n_rails/haml_parser.rb0000644000004100000410000000113014510305476024445 0ustar www-datawww-datarequire 'gettext_i18n_rails/base_parser' module GettextI18nRails class HamlParser < BaseParser def self.extension "haml" end def self.convert_to_code(text) case @library_loaded when "haml" if Haml::VERSION.split('.').first.to_i <= 5 Haml::Engine.new(text).precompiled() else Haml::Engine.new.call(text) end when "hamlit" Hamlit::Engine.new.call(text) end end def self.libraries ["haml", "hamlit"] end end end GettextI18nRails::GettextHooks.add_parser GettextI18nRails::HamlParser gettext_i18n_rails-1.12.0/lib/gettext_i18n_rails/active_record.rb0000644000004100000410000000043414510305476024767 0ustar www-datawww-datarequire 'gettext_i18n_rails/active_model/translation' class ActiveRecord::Base extend ActiveModel::Translation def self.human_attribute_name(*args) super(*args) end # method deprecated in Rails 3.1 def self.human_name(*args) _(self.humanize_class_name) end end gettext_i18n_rails-1.12.0/lib/gettext_i18n_rails/string_interpolate_fix.rb0000644000004100000410000000103114510305476026732 0ustar www-datawww-dataneeded = "".respond_to?(:html_safe) and ( "".html_safe % {:x => '
'} == '
' or not ("".html_safe % {:x=>'a'}).html_safe? ) if needed class String alias :interpolate_without_html_safe :% def %(*args) if args.first.is_a?(Hash) and html_safe? safe_replacement = Hash[args.first.map{|k,v| [k,ERB::Util.h(v)] }] interpolate_without_html_safe(safe_replacement).html_safe else interpolate_without_html_safe(*args).dup # make sure its not html_safe end end end end gettext_i18n_rails-1.12.0/lib/gettext_i18n_rails/action_controller.rb0000644000004100000410000000141414510305476025675 0ustar www-datawww-data# Autoloading in initializers is deprecated on rails 6.0. This delays initialization using the on_load # hooks, but does not change behaviour for existing rails versions. path_controller = ->() { class ::ActionController::Base def set_gettext_locale requested_locale = params[:locale] || session[:locale] || cookies[:locale] || request.env['HTTP_ACCEPT_LANGUAGE'] || I18n.default_locale locale = FastGettext.set_locale(requested_locale) session[:locale] = locale I18n.locale = locale # some weird overwriting in action-controller makes this necessary ... see I18nProxy end end } if defined?(Rails) && Rails::VERSION::MAJOR >= 6 ActiveSupport.on_load(:action_controller_base) do path_controller.call end else path_controller.call endgettext_i18n_rails-1.12.0/lib/gettext_i18n_rails/i18n_hacks.rb0000644000004100000410000000104014510305476024100 0ustar www-datawww-dataI18n::Config # autoload module I18n class Config def locale FastGettext.locale.gsub("_","-").to_sym end def locale=(new_locale) FastGettext.locale=(new_locale) end end # backport I18n.with_locale if it does not exist # Executes block with given I18n.locale set. def self.with_locale(tmp_locale = nil) if tmp_locale current_locale = self.locale self.locale = tmp_locale end yield ensure self.locale = current_locale if tmp_locale end unless defined? I18n.with_locale end gettext_i18n_rails-1.12.0/lib/gettext_i18n_rails/railtie.rb0000644000004100000410000000133314510305476023606 0ustar www-datawww-datamodule GettextI18nRails class Railtie < ::Rails::Railtie config.gettext_i18n_rails = ActiveSupport::OrderedOptions.new config.gettext_i18n_rails.msgmerge = nil config.gettext_i18n_rails.msgcat = nil config.gettext_i18n_rails.xgettext = nil config.gettext_i18n_rails.use_for_active_record_attributes = true rake_tasks do if Gem::Specification.find_all_by_name("gettext", ">= 3.0.2").any? require 'gettext_i18n_rails/tasks' end end config.after_initialize do |app| if app.config.gettext_i18n_rails.use_for_active_record_attributes ActiveSupport.on_load :active_record do require 'gettext_i18n_rails/active_model' end end end end end gettext_i18n_rails-1.12.0/lib/gettext_i18n_rails/active_model/0000755000004100000410000000000014510305476024263 5ustar www-datawww-datagettext_i18n_rails-1.12.0/lib/gettext_i18n_rails/active_model/translation.rb0000644000004100000410000000200114510305476027137 0ustar www-datawww-datamodule ActiveModel module Translation # CarDealer.sales_count -> s_('CarDealer|Sales count') -> 'Sales count' if no translation was found def human_attribute_name(attribute, *args) s_(gettext_translation_for_attribute_name(attribute)) end def gettext_translation_for_attribute_name(attribute) attribute = attribute.to_s if attribute.end_with?('_id') humanize_class_name(attribute) else "#{inheritance_tree_root(self)}|#{attribute.split('.').map! {|a| a.humanize }.join('|')}" end end def inheritance_tree_root(aclass) return aclass unless aclass.respond_to?(:base_class) base = aclass.base_class if base.superclass.abstract_class? if defined?(::ApplicationRecord) && base.superclass == ApplicationRecord base else base.superclass end else base end end def humanize_class_name(name=nil) name ||= self.to_s name.underscore.humanize end end end gettext_i18n_rails-1.12.0/lib/gettext_i18n_rails/active_model/name.rb0000644000004100000410000000040314510305476025525 0ustar www-datawww-datamodule ActiveModel Name.class_eval do def human(options={}) human_name = @klass.humanize_class_name if count = options[:count] n_(human_name, human_name.pluralize, count) else _(human_name) end end end end gettext_i18n_rails-1.12.0/lib/gettext_i18n_rails/slim_parser.rb0000644000004100000410000000045614510305476024502 0ustar www-datawww-datarequire 'gettext_i18n_rails/base_parser' module GettextI18nRails class SlimParser < BaseParser def self.extension "slim" end def self.convert_to_code(text) Slim::Engine.new.call(text) end end end GettextI18nRails::GettextHooks.add_parser GettextI18nRails::SlimParser gettext_i18n_rails-1.12.0/lib/gettext_i18n_rails/gettext_hooks.rb0000644000004100000410000000051214510305476025042 0ustar www-datawww-datamodule GettextI18nRails module GettextHooks # shorter call / maybe the interface changes again ... def self.add_parser(parser) xgettext.add_parser(parser) end def self.xgettext @xgettext ||= begin require 'gettext/tools/xgettext' GetText::Tools::XGetText end end end end gettext_i18n_rails-1.12.0/lib/gettext_i18n_rails/model_attributes_finder.rb0000644000004100000410000001331214510305476027052 0ustar www-datawww-datarequire 'rails/version' require 'rails' if Rails::VERSION::MAJOR > 2 module GettextI18nRails #write all found models/columns to a file where GetTexts ruby parser can find them def store_model_attributes(options) file = options[:to] || 'locale/model_attributes.rb' begin File.open(file,'w') do |f| f.puts "#DO NOT MODIFY! AUTOMATICALLY GENERATED FILE!" ModelAttributesFinder.new.find(options).each do |model,column_names| f.puts("_('#{model.humanize_class_name}')") #all columns namespaced under the model column_names.each do |attribute| translation = model.gettext_translation_for_attribute_name(attribute) f.puts("_('#{translation}')") end end f.puts "#DO NOT MODIFY! AUTOMATICALLY GENERATED FILE!" end rescue puts "[Error] Attribute extraction failed. Removing incomplete file (#{file})" File.delete(file) raise end end module_function :store_model_attributes class ModelAttributesFinder # options: # :ignore_tables => ['cars',/_settings$/,...] # :ignore_columns => ['id',/_id$/,...] # current connection ---> {'cars'=>['model_name','type'],...} def find(options) found = ActiveSupport::OrderedHash.new([]) models.each do |model| attributes = model_attributes(model, options[:ignore_tables], options[:ignore_columns]) found[model] = attributes.sort if attributes.any? end found end def initialize connection = ::ActiveRecord::Base.connection @existing_tables = (Rails::VERSION::MAJOR >= 5 ? connection.data_sources : connection.tables) end # Rails < 3.0 doesn't have DescendantsTracker. # Instead of iterating over ObjectSpace (slow) the decision was made NOT to support # class hierarchies with abstract base classes in Rails 2.x def model_attributes(model, ignored_tables, ignored_cols) return [] if model.abstract_class? && Rails::VERSION::MAJOR < 3 if model.abstract_class? model.direct_descendants.reject {|m| ignored?(m.table_name, ignored_tables)}.inject([]) do |attrs, m| attrs.push(model_attributes(m, ignored_tables, ignored_cols)).flatten.uniq end elsif !ignored?(model.table_name, ignored_tables) && @existing_tables.include?(model.table_name) model.columns.reject { |c| ignored?(c.name, ignored_cols) }.collect { |c| c.name } else [] end end def models if Rails::VERSION::MAJOR >= 3 # Ensure autoloaders are set up before we attempt to eager load! Rails.application.autoloaders.each(&:setup) if Rails.application.respond_to?(:autoloaders) Rails.application.eager_load! # make sure that all models are loaded so that direct_descendants works descendants = ::ActiveRecord::Base.direct_descendants # In rails 5+ user models are supposed to inherit from ApplicationRecord if defined?(::ApplicationRecord) descendants += ApplicationRecord.direct_descendants descendants.delete ApplicationRecord end descendants else ::ActiveRecord::Base.connection.tables \ .map { |t| table_name_to_namespaced_model(t) } \ .compact \ .collect { |c| c.superclass.abstract_class? ? c.superclass : c } end.uniq.sort_by(&:name) end def ignored?(name,patterns) return false unless patterns patterns.detect{|p|p.to_s==name.to_s or (p.is_a?(Regexp) and name=~p)} end private # Tries to find the model class corresponding to specified table name. # Takes into account that the model can be defined in a namespace. # Searches only up to one level deep - won't find models nested in two # or more modules. # # Note that if we allow namespaces, the conversion can be ambiguous, i.e. # if the table is named "aa_bb_cc" and AaBbCc, Aa::BbCc and AaBb::Cc are # all defined there's no absolute rule that tells us which one to use. # This method prefers the less nested one and, if there are two at # the same level, the one with shorter module name. def table_name_to_namespaced_model(table_name) # First assume that there are no namespaces model = to_class(table_name.singularize.camelcase) return model if model != nil # If you were wrong, assume that the model is in a namespace. # Iterate over the underscores and try to substitute each of them # for a slash that camelcase() replaces with the scope operator (::). underscore_position = table_name.index('_') while underscore_position != nil namespaced_table_name = table_name.dup namespaced_table_name[underscore_position] = '/' model = to_class(namespaced_table_name.singularize.camelcase) return model if model != nil underscore_position = table_name.index('_', underscore_position + 1) end # The model either is not defined or is buried more than one level # deep in a module hierarchy return nil end # Checks if there is a class of specified name and if so, returns # the class object. Otherwise returns nil. def to_class(name) # I wanted to use Module.const_defined?() here to avoid relying # on exceptions for normal program flow but it's of no use. # If class autoloading is enabled, the constant may be undefined # but turn out to be present when we actually try to use it. begin constant = name.constantize rescue NameError return nil rescue LoadError => e $stderr.puts "failed to load '#{name}', ignoring (#{e.class}: #{e.message})" return nil end return constant.is_a?(Class) ? constant : nil end end end gettext_i18n_rails-1.12.0/lib/gettext_i18n_rails/backend.rb0000644000004100000410000000466514510305476023557 0ustar www-datawww-datamodule GettextI18nRails #translates i18n calls to gettext calls class Backend @@translate_defaults = true cattr_accessor :translate_defaults attr_accessor :backend def initialize(*args) self.backend = I18n::Backend::Simple.new(*args) end def available_locales FastGettext.available_locales || [] end def translate(locale, key, options) I18n.with_locale(locale) do if gettext_key = gettext_key(key, options) translation = plural_translate(gettext_key, options) || FastGettext._(gettext_key) interpolate(translation, options) else result = backend.translate(locale, key, options) if result.is_a?(String) result = result.dup if result.frozen? result.force_encoding("UTF-8") else result end end end end def method_missing(method, *args) backend.send(method, *args) end protected def gettext_key(key, options) flat_key = flatten_key key, options if FastGettext.key_exist?(flat_key) flat_key elsif self.class.translate_defaults [*options[:default]].each do |default| #try the scoped(more specific) key first e.g. 'activerecord.errors.my custom message' flat_key = flatten_key default, options return flat_key if FastGettext.key_exist?(flat_key) #try the short key thereafter e.g. 'my custom message' return default if FastGettext.key_exist?(default) end return nil end end def plural_translate(gettext_key, options) if options[:count] translation = FastGettext.n_(gettext_key, options[:count]) discard_pass_through_key gettext_key, translation end end def discard_pass_through_key(key, translation) if translation == key nil else translation end end def interpolate(string, values) if string.respond_to?(:%) reserved_keys = if defined?(I18n::RESERVED_KEYS) # rails 3+ I18n::RESERVED_KEYS else I18n::Backend::Base::RESERVED_KEYS end options = values.except(*reserved_keys) options.any? ? (string % options) : string else string end end def flatten_key key, options scope = [*(options[:scope] || [])] scope.empty? ? key.to_s : "#{scope*'.'}.#{key}" end end end gettext_i18n_rails-1.12.0/lib/gettext_i18n_rails/html_safe_translations.rb0000644000004100000410000000103314510305476026715 0ustar www-datawww-datamodule GettextI18nRails mattr_accessor :translations_are_html_safe module HtmlSafeTranslations # also make available on class methods def self.included(base) base.extend self end def _(*args) html_safe_if_wanted super end def n_(*args) html_safe_if_wanted super end def s_(*args) html_safe_if_wanted super end private def html_safe_if_wanted(text) return text unless GettextI18nRails.translations_are_html_safe text.to_s.html_safe end end end gettext_i18n_rails-1.12.0/lib/gettext_i18n_rails/tasks.rb0000644000004100000410000000745114510305476023311 0ustar www-datawww-datarequire "gettext/tools/task" gem "gettext", ">= 3.0.2" namespace :gettext do def locale_path path = FastGettext.translation_repositories[text_domain].instance_variable_get(:@options)[:path] rescue nil path || File.join(Rails.root, "locale") end def text_domain # if your textdomain is not 'app': require the environment before calling e.g. gettext:find OR add TEXTDOMAIN=my_domain (FastGettext.text_domain rescue nil) || ENV['TEXTDOMAIN'] || "app" end # do not rename, gettext_i18n_rails_js overwrites this to inject coffee + js def files_to_translate Dir.glob("{app,lib,config,#{locale_path}}/**/*.{rb,erb,haml,slim}") end def gettext_default_options config = (Rails.application.config.gettext_i18n_rails.default_options if defined?(Rails.application)) config || %w[--sort-by-msgid --no-location --no-wrap] end def gettext_msgmerge_options config = (Rails.application.config.gettext_i18n_rails.msgmerge if defined?(Rails.application)) config || gettext_default_options end def gettext_msgcat_options config = (Rails.application.config.gettext_i18n_rails.msgcat if defined?(Rails.application)) config || gettext_default_options - %w[--location] end def gettext_xgettext_options config = (Rails.application.config.gettext_i18n_rails.xgettext if defined?(Rails.application)) config || gettext_default_options end require "gettext_i18n_rails/haml_parser" require "gettext_i18n_rails/slim_parser" task :setup => [:environment] do GetText::Tools::Task.define do |task| task.package_name = text_domain task.package_version = "1.0.0" task.domain = text_domain task.po_base_directory = locale_path task.mo_base_directory = locale_path task.files = files_to_translate task.enable_description = false task.msgmerge_options = gettext_msgmerge_options task.msgcat_options = gettext_msgcat_options task.xgettext_options = gettext_xgettext_options end end desc "Create mo-files" task :pack => [:setup] do Rake::Task["gettext:mo:update"].invoke end desc "Update pot/po files" task :find => [:setup] do Rake::Task["gettext:po:update"].invoke end # This is more of an example, ignoring # the columns/tables that mostly do not need translation. # This can also be done with GetText::ActiveRecord # but this crashed too often for me, and # IMO which column should/should-not be translated does not # belong into the model # # You can get your translations from GetText::ActiveRecord # by adding this to you gettext:find task # # require 'active_record' # gem "gettext_activerecord", '>=0.1.0' #download and install from github # require 'gettext_activerecord/parser' desc "write the model attributes to /model_attributes.rb" task :store_model_attributes => :environment do FastGettext.silence_errors require 'gettext_i18n_rails/model_attributes_finder' require 'gettext_i18n_rails/active_record' storage_file = "#{locale_path}/model_attributes.rb" puts "writing model translations to: #{storage_file}" GettextI18nRails.store_model_attributes( :to => storage_file, :ignore_columns => [/_id$/, 'id', 'type', 'created_at', 'updated_at'], :ignore_tables => GettextI18nRails::IGNORE_TABLES ) end desc "add a new language" task :add_language, [:language] => :environment do |_, args| language = args.language || ENV["LANGUAGE"] # Let's do some pre-verification of the environment. if language.nil? puts "You need to specify the language to add. Either 'LANGUAGE=eo rake gettext:add_language' or 'rake gettext:add_language[eo]'" next end language_path = File.join(locale_path, language) mkdir_p(language_path) Rake.application.lookup('gettext:find', _.scope).invoke end end gettext_i18n_rails-1.12.0/MIT-LICENSE.txt0000644000004100000410000000207014510305476017616 0ustar www-datawww-dataCopyright (C) 2013 Michael Grosser Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.