Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
7100474
switch to appraisal + remove old bump
grosser Nov 10, 2012
650574f
update
grosser Nov 10, 2012
4836533
jruby and rbx kind of work but not perfectly...
grosser Nov 10, 2012
d04ce76
do a better job at cleaning up specs
grosser Dec 11, 2012
8f28d20
avoid setting nil locale -> old locale stays in effect
grosser Dec 20, 2012
bb7445a
:reset_on_unknown flag for set_locale
grosser Dec 20, 2012
c2793ff
v0.6.12
grosser Dec 20, 2012
0ed9a83
clean up on setting as suggested by coolo
grosser Dec 20, 2012
5b1c25e
v0.7.0
grosser Dec 20, 2012
67c95ab
thanks for finding and fixing the bug
grosser Dec 20, 2012
1699f64
add Ruby license
grosser Dec 21, 2012
efb8706
sanitize key and test to allow some html
Feb 23, 2013
cf2b1c4
license foo
grosser Mar 7, 2013
75e6dcb
license again
grosser Mar 7, 2013
72a9cae
Update translation_key.rb
Mar 15, 2013
02643fd
adding three more examples
lzap Apr 4, 2013
90438fe
Merge pull request #54 from lzap/more-tests
grosser Apr 4, 2013
72d1a23
fix trans errors
Apr 20, 2013
de8bd0e
make key model put key as label
Glenn May 16, 2013
54eeea8
Typo in storage spec
Jun 18, 2013
e9be741
Fix thread safe issues with storage spec
Jun 18, 2013
d255a37
Add TranslationRepository::Base#reload
Jun 18, 2013
7d7cfd3
Add override of #reload for TranslationRepository::Mo
Jun 18, 2013
3db14ca
Add override of #reload for TranslationRepository::Yaml
Jun 18, 2013
f757921
Add override of #reload for TranslationRepository::Chain
Jun 18, 2013
5faa69e
Add FastGettext.reload!
Jun 18, 2013
4b33197
Merge pull request #55 from skroutz/reload
grosser Jun 19, 2013
29b61b2
cleanup
grosser Jun 19, 2013
20daebf
clean and dry
grosser Jun 19, 2013
5a02aac
thanks for the fix!
grosser Jun 19, 2013
f32c888
v0.7.1
grosser Jun 19, 2013
512bad5
licenses
grosser Jun 19, 2013
16d0ba1
add percent example
grosser Jun 29, 2013
7760691
Merge branch 'master' of https://github.com/grosser/fast_gettext.git
Aug 27, 2013
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
['2', '3'].each do |version|
appraise "rails.#{version}" do
gem "rails", "~>#{version}.0"
end
end
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
0.7.0 -- set_locale resets to default locale if none of the available locales was tried to set
0.6.0 -- plurals use singular translations as fallack e.g. you translated 'Axis' then n_('Axis','Axis',1) would return the translation for 'Axis' if no plural translation was found
0.4.14 -- "" is translated as "", not as gettext meta information
0.4.0 -- pluralisation_rules is no longer stored in each repository, only retrived. Added Chain and Logger repository.
Expand Down
7 changes: 4 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
source :rubygems
source "https://rubygems.org"
gemspec

gem 'appraisal'
gem 'rake'
gem 'sqlite3'
gem 'rspec', '~>2'
gem 'activerecord', ENV['AR']
gem 'rspec'
gem 'activerecord'
gem 'i18n'
gem 'bump'
50 changes: 27 additions & 23 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,48 +1,52 @@
PATH
remote: .
specs:
fast_gettext (0.6.11)
fast_gettext (0.7.1)

GEM
remote: http://rubygems.org/
remote: https://rubygems.org/
specs:
activemodel (3.2.7)
activesupport (= 3.2.7)
activemodel (3.2.8)
activesupport (= 3.2.8)
builder (~> 3.0.0)
activerecord (3.2.7)
activemodel (= 3.2.7)
activesupport (= 3.2.7)
activerecord (3.2.8)
activemodel (= 3.2.8)
activesupport (= 3.2.8)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activesupport (3.2.7)
activesupport (3.2.8)
i18n (~> 0.6)
multi_json (~> 1.0)
appraisal (0.5.1)
bundler
rake
arel (3.0.2)
builder (3.0.0)
bump (0.3.3)
builder (3.0.4)
bump (0.3.5)
diff-lcs (1.1.3)
i18n (0.6.0)
multi_json (1.3.6)
rake (0.9.2)
rspec (2.6.0)
rspec-core (~> 2.6.0)
rspec-expectations (~> 2.6.0)
rspec-mocks (~> 2.6.0)
rspec-core (2.6.4)
rspec-expectations (2.6.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.6.0)
i18n (0.6.1)
multi_json (1.3.7)
rake (0.9.2.2)
rspec (2.11.0)
rspec-core (~> 2.11.0)
rspec-expectations (~> 2.11.0)
rspec-mocks (~> 2.11.0)
rspec-core (2.11.1)
rspec-expectations (2.11.3)
diff-lcs (~> 1.1.3)
rspec-mocks (2.11.3)
sqlite3 (1.3.6)
tzinfo (0.3.33)
tzinfo (0.3.35)

PLATFORMS
ruby

DEPENDENCIES
activerecord
appraisal
bump
fast_gettext!
i18n
rake
rspec (~> 2)
rspec
sqlite3
28 changes: 7 additions & 21 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
require 'bundler/setup'
require 'bundler/gem_tasks'
require 'bump/tasks'
require 'appraisal'

task :default do
['~>2', '~>3'].each do |version|
sh "export AR='#{version}' && (bundle check || bundle install) && bundle exec rspec spec"
end
sh "git checkout Gemfile.lock"
sh "rake appraisal:install && rake appraisal spec"
end

task :spec do
sh "rspec spec"
end

task :benchmark do
Expand All @@ -20,20 +23,3 @@ task :namespaces do
puts `ruby benchmark/namespace/original.rb`
puts `ruby benchmark/namespace/fast_gettext.rb`
end

# extracted from https://github.com/grosser/project_template
rule /^version:bump:.*/ do |t|
sh "git status | grep 'nothing to commit'" # ensure we are not dirty
index = ['major', 'minor','patch'].index(t.name.split(':').last)
file = 'lib/fast_gettext/version.rb'

version_file = File.read(file)
old_version, *version_parts = version_file.match(/(\d+)\.(\d+)\.(\d+)/).to_a
version_parts[index] = version_parts[index].to_i + 1
version_parts[2] = 0 if index < 2 # remove patch for minor
version_parts[1] = 0 if index < 1 # remove minor for major
new_version = version_parts * '.'
File.open(file,'w'){|f| f.write(version_file.sub(old_version, new_version)) }

sh "bundle && git add #{file} Gemfile.lock && git commit -m 'bump version to #{new_version}'"
end
10 changes: 7 additions & 3 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ Do this once in every Thread. (e.g. Rails -> ApplicationController)
_('not-found') == 'not-found'
s_('Namespace|no-found') == 'not-found'
n_('Axis','Axis',3) == 'Achsen' #German plural of Axis
_('Hello %{name}!') % {:name => "Pete"} == 'Hello Pete!'


Managing translations
Expand Down Expand Up @@ -127,7 +128,8 @@ since it runs in a different thread then e.g. controllers, so set them inside yo
def set_locale
FastGettext.available_locales = ['de','en',...]
FastGettext.text_domain = 'frontend'
session[:locale] = I18n.locale = FastGettext.set_locale(params[:locale] || session[:locale] || request.env['HTTP_ACCEPT_LANGUAGE'] || 'en')
FastGettext.set_locale(params[:locale] || session[:locale] || request.env['HTTP_ACCEPT_LANGUAGE'])
session[:locale] = I18n.locale = FastGettext.locale
end


Expand Down Expand Up @@ -224,8 +226,10 @@ Mo/Po-file parsing from Masao Mutoh, see vendor/README
- [Hoang Nghiem](https://github.com/hoangnghiem)
- [Costa Shapiro](https://github.com/costa)
- [Jamie Dyer](https://github.com/kernow)
- [Stephan Kulow](https://github.com/coolo)
- [Fotos Georgiadis](https://github.com/fotos)

[Michael Grosser](http://grosser.it)<br/>
[email protected]<br/>
License: MIT<br/>
[![Build Status](https://secure.travis-ci.org/grosser/fast_gettext.png)](http://travis-ci.org/grosser/fast_gettext)
License: MIT, some vendor parts under the same license terms as Ruby (see headers)<br/>
[![Build Status](https://travis-ci.org/grosser/fast_gettext.png)](https://travis-ci.org/grosser/fast_gettext)
2 changes: 1 addition & 1 deletion fast_gettext.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ Gem::Specification.new name, FastGettext::VERSION do |s|
s.email = "[email protected]"
s.homepage = "http://github.com/grosser/#{name}"
s.files = `git ls-files`.split("\n")
s.license = "MIT"
s.licenses = ["MIT", "Ruby"]
end
14 changes: 14 additions & 0 deletions gemfiles/rails.2.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "appraisal"
gem "rake"
gem "sqlite3"
gem "rspec"
gem "activerecord"
gem "i18n"
gem "bump"
gem "rails", "~>2.0"

gemspec :path=>"../"
56 changes: 56 additions & 0 deletions gemfiles/rails.2.gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
PATH
remote: /Users/mgrosser/code/tools/fast_gettext
specs:
fast_gettext (0.7.0)

GEM
remote: https://rubygems.org/
specs:
actionmailer (2.3.14)
actionpack (= 2.3.14)
actionpack (2.3.14)
activesupport (= 2.3.14)
rack (~> 1.1.0)
activerecord (2.3.14)
activesupport (= 2.3.14)
activeresource (2.3.14)
activesupport (= 2.3.14)
activesupport (2.3.14)
appraisal (0.5.1)
bundler
rake
bump (0.3.5)
diff-lcs (1.1.3)
i18n (0.6.1)
rack (1.1.3)
rails (2.3.14)
actionmailer (= 2.3.14)
actionpack (= 2.3.14)
activerecord (= 2.3.14)
activeresource (= 2.3.14)
activesupport (= 2.3.14)
rake (>= 0.8.3)
rake (0.9.2.2)
rspec (2.11.0)
rspec-core (~> 2.11.0)
rspec-expectations (~> 2.11.0)
rspec-mocks (~> 2.11.0)
rspec-core (2.11.1)
rspec-expectations (2.11.3)
diff-lcs (~> 1.1.3)
rspec-mocks (2.11.3)
sqlite3 (1.3.6)

PLATFORMS
ruby

DEPENDENCIES
activerecord
appraisal
bump
fast_gettext!
i18n
rails (~> 2.0)
rake
rspec
sqlite3
14 changes: 14 additions & 0 deletions gemfiles/rails.3.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "appraisal"
gem "rake"
gem "sqlite3"
gem "rspec"
gem "activerecord"
gem "i18n"
gem "bump"
gem "rails", "~>3.0"

gemspec :path=>"../"
112 changes: 112 additions & 0 deletions gemfiles/rails.3.gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
PATH
remote: /Users/mgrosser/code/tools/fast_gettext
specs:
fast_gettext (0.7.0)

GEM
remote: https://rubygems.org/
specs:
actionmailer (3.2.8)
actionpack (= 3.2.8)
mail (~> 2.4.4)
actionpack (3.2.8)
activemodel (= 3.2.8)
activesupport (= 3.2.8)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.4)
rack (~> 1.4.0)
rack-cache (~> 1.2)
rack-test (~> 0.6.1)
sprockets (~> 2.1.3)
activemodel (3.2.8)
activesupport (= 3.2.8)
builder (~> 3.0.0)
activerecord (3.2.8)
activemodel (= 3.2.8)
activesupport (= 3.2.8)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activeresource (3.2.8)
activemodel (= 3.2.8)
activesupport (= 3.2.8)
activesupport (3.2.8)
i18n (~> 0.6)
multi_json (~> 1.0)
appraisal (0.5.1)
bundler
rake
arel (3.0.2)
builder (3.0.4)
bump (0.3.5)
diff-lcs (1.1.3)
erubis (2.7.0)
hike (1.2.1)
i18n (0.6.1)
journey (1.0.4)
json (1.7.5)
mail (2.4.4)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.19)
multi_json (1.3.7)
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.2)
rack (>= 0.4)
rack-ssl (1.3.2)
rack
rack-test (0.6.2)
rack (>= 1.0)
rails (3.2.8)
actionmailer (= 3.2.8)
actionpack (= 3.2.8)
activerecord (= 3.2.8)
activeresource (= 3.2.8)
activesupport (= 3.2.8)
bundler (~> 1.0)
railties (= 3.2.8)
railties (3.2.8)
actionpack (= 3.2.8)
activesupport (= 3.2.8)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
rake (0.9.2.2)
rdoc (3.12)
json (~> 1.4)
rspec (2.11.0)
rspec-core (~> 2.11.0)
rspec-expectations (~> 2.11.0)
rspec-mocks (~> 2.11.0)
rspec-core (2.11.1)
rspec-expectations (2.11.3)
diff-lcs (~> 1.1.3)
rspec-mocks (2.11.3)
sprockets (2.1.3)
hike (~> 1.2)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sqlite3 (1.3.6)
thor (0.16.0)
tilt (1.3.3)
treetop (1.4.12)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.35)

PLATFORMS
ruby

DEPENDENCIES
activerecord
appraisal
bump
fast_gettext!
i18n
rails (~> 3.0)
rake
rspec
sqlite3
Loading