gettext_i18n_rails 0.3.4 → 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
    
        data/Readme.md
    CHANGED
    
    | @@ -211,6 +211,7 @@ lib/tasks/gettext.rake: | |
| 211 211 | 
             
             - [Nikos Dimitrakopoulos](http://blog.nikosd.com)
         | 
| 212 212 | 
             
             - [Ben Tucker](http://btucker.net/)
         | 
| 213 213 | 
             
             - [Kamil Śliwak](https://github.com/cameel)
         | 
| 214 | 
            +
             - [Paul McMahon](https://github.com/pwim)
         | 
| 214 215 |  | 
| 215 216 | 
             
            [Michael Grosser](http://grosser.it)<br/>
         | 
| 216 217 | 
             
            grosser.michael@gmail.com<br/>
         | 
    
        data/VERSION
    CHANGED
    
    | @@ -1 +1 @@ | |
| 1 | 
            -
            0.3. | 
| 1 | 
            +
            0.3.5
         | 
    
        data/gettext_i18n_rails.gemspec
    CHANGED
    
    | @@ -4,13 +4,13 @@ | |
| 4 4 | 
             
            # -*- encoding: utf-8 -*-
         | 
| 5 5 |  | 
| 6 6 | 
             
            Gem::Specification.new do |s|
         | 
| 7 | 
            -
              s.name =  | 
| 8 | 
            -
              s.version = "0.3. | 
| 7 | 
            +
              s.name = %q{gettext_i18n_rails}
         | 
| 8 | 
            +
              s.version = "0.3.5"
         | 
| 9 9 |  | 
| 10 10 | 
             
              s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
         | 
| 11 11 | 
             
              s.authors = ["Michael Grosser"]
         | 
| 12 | 
            -
              s.date =  | 
| 13 | 
            -
              s.email =  | 
| 12 | 
            +
              s.date = %q{2011-12-09}
         | 
| 13 | 
            +
              s.email = %q{grosser.michael@gmail.com}
         | 
| 14 14 | 
             
              s.files = [
         | 
| 15 15 | 
             
                "Gemfile",
         | 
| 16 16 | 
             
                "Gemfile.lock",
         | 
| @@ -39,10 +39,10 @@ Gem::Specification.new do |s| | |
| 39 39 | 
             
                "spec/gettext_i18n_rails_spec.rb",
         | 
| 40 40 | 
             
                "spec/spec_helper.rb"
         | 
| 41 41 | 
             
              ]
         | 
| 42 | 
            -
              s.homepage =  | 
| 42 | 
            +
              s.homepage = %q{http://github.com/grosser/gettext_i18n_rails}
         | 
| 43 43 | 
             
              s.require_paths = ["lib"]
         | 
| 44 | 
            -
              s.rubygems_version =  | 
| 45 | 
            -
              s.summary =  | 
| 44 | 
            +
              s.rubygems_version = %q{1.6.2}
         | 
| 45 | 
            +
              s.summary = %q{Simple FastGettext Rails integration.}
         | 
| 46 46 |  | 
| 47 47 | 
             
              if s.respond_to? :specification_version then
         | 
| 48 48 | 
             
                s.specification_version = 3
         | 
| @@ -1,6 +1,6 @@ | |
| 1 1 | 
             
            class ActionController::Base
         | 
| 2 2 | 
             
              def set_gettext_locale
         | 
| 3 | 
            -
                requested_locale = params[:locale] || session[:locale] || cookies[:locale] ||  request.env['HTTP_ACCEPT_LANGUAGE']
         | 
| 3 | 
            +
                requested_locale = params[:locale] || session[:locale] || cookies[:locale] ||  request.env['HTTP_ACCEPT_LANGUAGE'] || I18n.default_locale
         | 
| 4 4 | 
             
                locale = FastGettext.set_locale(requested_locale)
         | 
| 5 5 | 
             
                session[:locale] = locale
         | 
| 6 6 | 
             
                I18n.locale = locale # some weird overwriting in action-controller makes this necessary ... see I18nProxy
         | 
| @@ -2,6 +2,8 @@ | |
| 2 2 | 
             
            if defined?(Rails::Railtie)
         | 
| 3 3 | 
             
              module GettextI18nRails
         | 
| 4 4 | 
             
                class Railtie < ::Rails::Railtie
         | 
| 5 | 
            +
                  config.gettext_i18n_rails = ActiveSupport::OrderedOptions.new
         | 
| 6 | 
            +
                  config.gettext_i18n_rails.msgmerge = %w[--sort-output --no-location --no-wrap]
         | 
| 5 7 | 
             
                  rake_tasks do
         | 
| 6 8 | 
             
                    require 'gettext_i18n_rails/tasks'
         | 
| 7 9 | 
             
                  end
         | 
| @@ -18,12 +18,17 @@ namespace :gettext do | |
| 18 18 |  | 
| 19 19 |  | 
| 20 20 | 
             
                if GetText.respond_to? :update_pofiles_org
         | 
| 21 | 
            +
                  if defined?(Rails.application)
         | 
| 22 | 
            +
                    msgmerge = Rails.application.config.gettext_i18n_rails.msgmerge
         | 
| 23 | 
            +
                  end
         | 
| 24 | 
            +
                  msgmerge ||= %w[--sort-output --no-location --no-wrap]
         | 
| 25 | 
            +
             | 
| 21 26 | 
             
                  GetText.update_pofiles_org(
         | 
| 22 27 | 
             
                    text_domain,
         | 
| 23 28 | 
             
                    files_to_translate,
         | 
| 24 29 | 
             
                    "version 0.0.1",
         | 
| 25 30 | 
             
                    :po_root => locale_path,
         | 
| 26 | 
            -
                    :msgmerge=> | 
| 31 | 
            +
                    :msgmerge => msgmerge
         | 
| 27 32 | 
             
                  )
         | 
| 28 33 | 
             
                else #we are on a version < 2.0
         | 
| 29 34 | 
             
                  puts "install new GetText with gettext:install to gain more features..."
         | 
| @@ -3,19 +3,23 @@ require File.expand_path("../spec_helper", File.dirname(__FILE__)) | |
| 3 3 | 
             
            FastGettext.silence_errors
         | 
| 4 4 |  | 
| 5 5 | 
             
            describe ActionController::Base do
         | 
| 6 | 
            -
               | 
| 7 | 
            -
                #controller
         | 
| 8 | 
            -
                @c = ActionController::Base.new
         | 
| 6 | 
            +
              def reset!
         | 
| 9 7 | 
             
                fake_session = {}
         | 
| 10 8 | 
             
                @c.stub!(:session).and_return fake_session
         | 
| 11 9 | 
             
                fake_cookies = {}
         | 
| 12 10 | 
             
                @c.stub!(:cookies).and_return fake_cookies
         | 
| 13 11 | 
             
                @c.params = {}
         | 
| 14 12 | 
             
                @c.request = stub(:env => {})
         | 
| 13 | 
            +
              end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
              before do
         | 
| 16 | 
            +
                #controller
         | 
| 17 | 
            +
                @c = ActionController::Base.new
         | 
| 18 | 
            +
                reset!
         | 
| 15 19 |  | 
| 16 20 | 
             
                #locale
         | 
| 17 21 | 
             
                FastGettext.available_locales = nil
         | 
| 18 | 
            -
                FastGettext.locale = 'fr'
         | 
| 22 | 
            +
                FastGettext.locale = I18n.default_locale = 'fr'
         | 
| 19 23 | 
             
                FastGettext.available_locales = ['fr','en']
         | 
| 20 24 | 
             
              end
         | 
| 21 25 |  | 
| @@ -32,9 +36,19 @@ describe ActionController::Base do | |
| 32 36 | 
             
                FastGettext.locale.should == 'fr'
         | 
| 33 37 | 
             
              end
         | 
| 34 38 |  | 
| 39 | 
            +
              it "locale isn't cached over request" do
         | 
| 40 | 
            +
                @c.params = {:locale=>'en'}
         | 
| 41 | 
            +
                @c.set_gettext_locale
         | 
| 42 | 
            +
                @c.session[:locale].should == 'en'
         | 
| 43 | 
            +
             | 
| 44 | 
            +
                reset!
         | 
| 45 | 
            +
                @c.set_gettext_locale
         | 
| 46 | 
            +
                @c.session[:locale].should == 'fr'
         | 
| 47 | 
            +
              end
         | 
| 48 | 
            +
             | 
| 35 49 | 
             
              it "reads the locale from the HTTP_ACCEPT_LANGUAGE" do
         | 
| 36 50 | 
             
                @c.request.stub!(:env).and_return 'HTTP_ACCEPT_LANGUAGE'=>'de-de,de;q=0.8,en-us;q=0.5,en;q=0.3'
         | 
| 37 51 | 
             
                @c.set_gettext_locale
         | 
| 38 52 | 
             
                FastGettext.locale.should == 'en'
         | 
| 39 53 | 
             
              end
         | 
| 40 | 
            -
            end
         | 
| 54 | 
            +
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,13 +1,13 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification 
         | 
| 2 2 | 
             
            name: gettext_i18n_rails
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            -
              hash:  | 
| 4 | 
            +
              hash: 25
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 6 | 
             
              segments: 
         | 
| 7 7 | 
             
              - 0
         | 
| 8 8 | 
             
              - 3
         | 
| 9 | 
            -
              -  | 
| 10 | 
            -
              version: 0.3. | 
| 9 | 
            +
              - 5
         | 
| 10 | 
            +
              version: 0.3.5
         | 
| 11 11 | 
             
            platform: ruby
         | 
| 12 12 | 
             
            authors: 
         | 
| 13 13 | 
             
            - Michael Grosser
         | 
| @@ -15,9 +15,11 @@ autorequire: | |
| 15 15 | 
             
            bindir: bin
         | 
| 16 16 | 
             
            cert_chain: []
         | 
| 17 17 |  | 
| 18 | 
            -
            date: 2011-12-09 00:00:00  | 
| 18 | 
            +
            date: 2011-12-09 00:00:00 -08:00
         | 
| 19 | 
            +
            default_executable: 
         | 
| 19 20 | 
             
            dependencies: 
         | 
| 20 21 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 22 | 
            +
              type: :runtime
         | 
| 21 23 | 
             
              requirement: &id001 !ruby/object:Gem::Requirement 
         | 
| 22 24 | 
             
                none: false
         | 
| 23 25 | 
             
                requirements: 
         | 
| @@ -27,11 +29,11 @@ dependencies: | |
| 27 29 | 
             
                    segments: 
         | 
| 28 30 | 
             
                    - 0
         | 
| 29 31 | 
             
                    version: "0"
         | 
| 32 | 
            +
              name: fast_gettext
         | 
| 30 33 | 
             
              version_requirements: *id001
         | 
| 31 34 | 
             
              prerelease: false
         | 
| 32 | 
            -
              name: fast_gettext
         | 
| 33 | 
            -
              type: :runtime
         | 
| 34 35 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 36 | 
            +
              type: :runtime
         | 
| 35 37 | 
             
              requirement: &id002 !ruby/object:Gem::Requirement 
         | 
| 36 38 | 
             
                none: false
         | 
| 37 39 | 
             
                requirements: 
         | 
| @@ -41,10 +43,9 @@ dependencies: | |
| 41 43 | 
             
                    segments: 
         | 
| 42 44 | 
             
                    - 0
         | 
| 43 45 | 
             
                    version: "0"
         | 
| 46 | 
            +
              name: ruby_parser
         | 
| 44 47 | 
             
              version_requirements: *id002
         | 
| 45 48 | 
             
              prerelease: false
         | 
| 46 | 
            -
              name: ruby_parser
         | 
| 47 | 
            -
              type: :runtime
         | 
| 48 49 | 
             
            description: 
         | 
| 49 50 | 
             
            email: grosser.michael@gmail.com
         | 
| 50 51 | 
             
            executables: []
         | 
| @@ -80,6 +81,7 @@ files: | |
| 80 81 | 
             
            - spec/gettext_i18n_rails/string_interpolate_fix_spec.rb
         | 
| 81 82 | 
             
            - spec/gettext_i18n_rails_spec.rb
         | 
| 82 83 | 
             
            - spec/spec_helper.rb
         | 
| 84 | 
            +
            has_rdoc: true
         | 
| 83 85 | 
             
            homepage: http://github.com/grosser/gettext_i18n_rails
         | 
| 84 86 | 
             
            licenses: []
         | 
| 85 87 |  | 
| @@ -109,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 109 111 | 
             
            requirements: []
         | 
| 110 112 |  | 
| 111 113 | 
             
            rubyforge_project: 
         | 
| 112 | 
            -
            rubygems_version: 1. | 
| 114 | 
            +
            rubygems_version: 1.6.2
         | 
| 113 115 | 
             
            signing_key: 
         | 
| 114 116 | 
             
            specification_version: 3
         | 
| 115 117 | 
             
            summary: Simple FastGettext Rails integration.
         |