Sha256: ecd206a75845012281d834e75c0f6dad4e6e9766b5798f32f6f5f8a314fdbfdb

Contents?: true

Size: 886 Bytes

Versions: 4

Compression:

Stored size: 886 Bytes

Contents

# -*- encoding: utf-8 -*-

if RUBY_VERSION < "1.9"
  $KCODE = 'u'
end

require 'i18n'

# Rails hacks
if defined?(ActionView::Helpers)
  require 'polish/action_view_ext/helpers/date_helper'
end

require 'polish/proxies'

module Polish
  extend self

  module VERSION
    STRING = File.open(File.dirname(__FILE__) + "/../VERSION").gets.chomp
    MAJOR, MINOR, TINY = STRING.split('.')
  end

  # Polish locale
  LOCALE = :'pl'

  # Polish locale
  def locale
    LOCALE
  end

  # Init Polish i18n: set custom backend,
  # load all translations shipped with library.
  def init_i18n
    I18n.backend.class.send(:include, I18n::Backend::Pluralization)
    I18n.load_path.unshift(*locale_files)
  end

  protected
    # Returns all locale files shipped with library
    def locale_files
      Dir[File.join(File.dirname(__FILE__), "polish", "locale", "**/*")]
    end
end

Polish.init_i18n

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
polish-0.1.5 lib/polish.rb
polish-0.1.4 lib/polish.rb
polish-0.1.3 lib/polish.rb
polish-0.1.2 lib/polish.rb