grosser-fast_gettext 0.4.11 → 0.4.12
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/CHANGELOG +5 -0
- data/VERSION +1 -0
- data/benchmark/base.rb +42 -0
- data/benchmark/baseline.rb +5 -0
- data/benchmark/fast_gettext.rb +18 -0
- data/benchmark/i18n_simple.rb +7 -0
- data/benchmark/ideal.rb +22 -0
- data/benchmark/locale/de/LC_MESSAGES/large.mo +0 -0
- data/benchmark/locale/de.yml +127 -0
- data/benchmark/misc/threadsave.rb +21 -0
- data/benchmark/namespace/fast_gettext.rb +15 -0
- data/benchmark/namespace/original.rb +14 -0
- data/benchmark/original.rb +15 -0
- data/fast_gettext.gemspec +152 -0
- data/spec/vendor/string_spec.rb +4 -0
- data/vendor/string.rb +7 -4
- metadata +16 -2
- data/VERSION.yml +0 -4
data/.gitignore
ADDED
data/CHANGELOG
ADDED
@@ -0,0 +1,5 @@
|
|
1
|
+
0.4.0 -- pluralisation_rules is no longer stored in each repository, only retrived. Added Chain and Logger repository.
|
2
|
+
0.3.6 -- FastGettext.default_locale=
|
3
|
+
0.3.5 -- FastGettext.default_text_domain=
|
4
|
+
0.3.4 -- Exceptions are thrown, not returned when translating without text domain
|
5
|
+
0.3 -- pluralisation methods accept/return n plural forms, contrary to singular/plural before
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.4.12
|
data/benchmark/base.rb
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'benchmark'
|
3
|
+
|
4
|
+
RUNS = 50_0000
|
5
|
+
DEFAULTS = {:memory=>0}
|
6
|
+
|
7
|
+
def locale_folder(domain)
|
8
|
+
path = case domain
|
9
|
+
when 'test' then File.join(File.expand_path(File.dirname(__FILE__)),'..','spec','locale')
|
10
|
+
when 'large' then File.join(File.expand_path(File.dirname(__FILE__)),'locale')
|
11
|
+
end
|
12
|
+
|
13
|
+
mo = File.join(path,'de','LC_MESSAGES',"#{domain}.mo")
|
14
|
+
raise unless File.exist?(mo)
|
15
|
+
path
|
16
|
+
end
|
17
|
+
|
18
|
+
def results_test(&block)
|
19
|
+
print "#{(result(&block)).to_s.strip.split(' ').first}s / #{memory}K <-> "
|
20
|
+
end
|
21
|
+
|
22
|
+
def results_large
|
23
|
+
print "#{(result {_('login') == 'anmelden'}).to_s.strip.split(' ').first}s / #{memory}K"
|
24
|
+
puts ""
|
25
|
+
end
|
26
|
+
|
27
|
+
def result
|
28
|
+
result =Benchmark.measure do
|
29
|
+
RUNS.times do
|
30
|
+
raise "not translated" unless yield
|
31
|
+
end
|
32
|
+
end
|
33
|
+
result
|
34
|
+
end
|
35
|
+
|
36
|
+
def memory
|
37
|
+
pid = Process.pid
|
38
|
+
map = `pmap -d #{pid}`
|
39
|
+
map.split("\n").last.strip.squeeze(' ').split(' ')[3].to_i - DEFAULTS[:memory]
|
40
|
+
end
|
41
|
+
|
42
|
+
DEFAULTS[:memory] = memory + 4 #4 => 0 for base calls
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'benchmark/base'
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift 'lib'
|
4
|
+
require 'fast_gettext'
|
5
|
+
include FastGettext::Translation
|
6
|
+
|
7
|
+
FastGettext.available_locales = ['de','en']
|
8
|
+
FastGettext.locale = 'de'
|
9
|
+
|
10
|
+
puts "FastGettext:"
|
11
|
+
FastGettext.add_text_domain('test',:path=>locale_folder('test'))
|
12
|
+
FastGettext.text_domain = 'test'
|
13
|
+
results_test{_('car') == 'Auto'}
|
14
|
+
|
15
|
+
#i cannot add the large file, since its an internal applications mo file
|
16
|
+
FastGettext.add_text_domain('large',:path=>locale_folder('large'))
|
17
|
+
FastGettext.text_domain = 'large'
|
18
|
+
results_large
|
@@ -0,0 +1,7 @@
|
|
1
|
+
require 'benchmark/base'
|
2
|
+
require 'activesupport'
|
3
|
+
I18n.backend = I18n::Backend::Simple.new
|
4
|
+
I18n.load_path = ['benchmark/locale/de.yml']
|
5
|
+
I18n.locale = :de
|
6
|
+
puts "ActiveSupport I18n::Backend::Simple :"
|
7
|
+
results_test{I18n.translate('activerecord.models.car')=='Auto'}
|
data/benchmark/ideal.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'benchmark/base'
|
2
|
+
|
3
|
+
module FastestGettext
|
4
|
+
def set_domain(folder,domain,locale)
|
5
|
+
@data = {}
|
6
|
+
require File.join(File.dirname(__FILE__),'..','vendor','mofile')
|
7
|
+
FastGettext::GetText::MOFile.open(File.join(folder,locale,'LC_MESSAGES',"#{domain}.mo"), "UTF-8").each{|k,v|@data[k]=v}
|
8
|
+
end
|
9
|
+
def _(word)
|
10
|
+
@data[word]
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
|
15
|
+
include FastestGettext
|
16
|
+
set_domain(locale_folder('test'),'test','de')
|
17
|
+
puts "Ideal: (primitive Hash lookup)"
|
18
|
+
results_test{_('car') == 'Auto'}
|
19
|
+
|
20
|
+
#i cannot add the large file, since its an internal applications mo file
|
21
|
+
set_domain(locale_folder('large'),'large','de')
|
22
|
+
results_large
|
Binary file
|
@@ -0,0 +1,127 @@
|
|
1
|
+
# German translations for Ruby on Rails
|
2
|
+
# by Clemens Kofler (clemens@railway.at)
|
3
|
+
|
4
|
+
de:
|
5
|
+
date:
|
6
|
+
formats:
|
7
|
+
default: "%d.%m.%Y"
|
8
|
+
short: "%e. %b"
|
9
|
+
long: "%e. %B %Y"
|
10
|
+
only_day: "%e"
|
11
|
+
|
12
|
+
day_names: [Sonntag, Montag, Dienstag, Mittwoch, Donnerstag, Freitag, Samstag]
|
13
|
+
abbr_day_names: [So, Mo, Di, Mi, Do, Fr, Sa]
|
14
|
+
month_names: [~, Januar, Februar, März, April, Mai, Juni, Juli, August, September, Oktober, November, Dezember]
|
15
|
+
abbr_month_names: [~, Jan, Feb, Mär, Apr, Mai, Jun, Jul, Aug, Sep, Okt, Nov, Dez]
|
16
|
+
order: [ :day, :month, :year ]
|
17
|
+
|
18
|
+
time:
|
19
|
+
formats:
|
20
|
+
default: "%A, %e. %B %Y, %H:%M Uhr"
|
21
|
+
short: "%e. %B, %H:%M Uhr"
|
22
|
+
long: "%A, %e. %B %Y, %H:%M Uhr"
|
23
|
+
time: "%H:%M"
|
24
|
+
|
25
|
+
am: "vormittags"
|
26
|
+
pm: "nachmittags"
|
27
|
+
|
28
|
+
datetime:
|
29
|
+
distance_in_words:
|
30
|
+
half_a_minute: 'eine halbe Minute'
|
31
|
+
less_than_x_seconds:
|
32
|
+
zero: 'weniger als 1 Sekunde'
|
33
|
+
one: 'weniger als 1 Sekunde'
|
34
|
+
other: 'weniger als {{count}} Sekunden'
|
35
|
+
x_seconds:
|
36
|
+
one: '1 Sekunde'
|
37
|
+
other: '{{count}} Sekunden'
|
38
|
+
less_than_x_minutes:
|
39
|
+
zero: 'weniger als 1 Minute'
|
40
|
+
one: 'weniger als eine Minute'
|
41
|
+
other: 'weniger als {{count}} Minuten'
|
42
|
+
x_minutes:
|
43
|
+
one: '1 Minute'
|
44
|
+
other: '{{count}} Minuten'
|
45
|
+
about_x_hours:
|
46
|
+
one: 'etwa 1 Stunde'
|
47
|
+
other: 'etwa {{count}} Stunden'
|
48
|
+
x_days:
|
49
|
+
one: '1 Tag'
|
50
|
+
other: '{{count}} Tage'
|
51
|
+
about_x_months:
|
52
|
+
one: 'etwa 1 Monat'
|
53
|
+
other: 'etwa {{count}} Monate'
|
54
|
+
x_months:
|
55
|
+
one: '1 Monat'
|
56
|
+
other: '{{count}} Monate'
|
57
|
+
about_x_years:
|
58
|
+
one: 'etwa 1 Jahr'
|
59
|
+
other: 'etwa {{count}} Jahre'
|
60
|
+
over_x_years:
|
61
|
+
one: 'mehr als 1 Jahr'
|
62
|
+
other: 'mehr als {{count}} Jahre'
|
63
|
+
|
64
|
+
number:
|
65
|
+
format:
|
66
|
+
precision: 2
|
67
|
+
separator: ','
|
68
|
+
delimiter: '.'
|
69
|
+
currency:
|
70
|
+
format:
|
71
|
+
unit: '€'
|
72
|
+
format: '%n%u'
|
73
|
+
separator:
|
74
|
+
delimiter:
|
75
|
+
precision:
|
76
|
+
percentage:
|
77
|
+
format:
|
78
|
+
delimiter: ""
|
79
|
+
precision:
|
80
|
+
format:
|
81
|
+
delimiter: ""
|
82
|
+
human:
|
83
|
+
format:
|
84
|
+
delimiter: ""
|
85
|
+
precision: 1
|
86
|
+
|
87
|
+
support:
|
88
|
+
array:
|
89
|
+
sentence_connector: "und"
|
90
|
+
skip_last_comma: true
|
91
|
+
|
92
|
+
activerecord:
|
93
|
+
errors:
|
94
|
+
template:
|
95
|
+
header:
|
96
|
+
one: "Konnte dieses {{model}} Objekt nicht speichern: 1 Fehler."
|
97
|
+
other: "Konnte dieses {{model}} Objekt nicht speichern: {{count}} Fehler."
|
98
|
+
body: "Bitte überprüfen Sie die folgenden Felder:"
|
99
|
+
format:
|
100
|
+
seperator: ' '
|
101
|
+
messages:
|
102
|
+
inclusion: "ist kein gültiger Wert"
|
103
|
+
exclusion: "ist nicht verfügbar"
|
104
|
+
invalid: "ist nicht gültig"
|
105
|
+
confirmation: "stimmt nicht mit der Bestätigung überein"
|
106
|
+
accepted: "muss akzeptiert werden"
|
107
|
+
empty: "muss ausgefüllt werden"
|
108
|
+
blank: "muss ausgefüllt werden"
|
109
|
+
too_long: "ist zu lang (nicht mehr als {{count}} Zeichen)"
|
110
|
+
too_short: "ist zu kurz (nicht weniger als {{count}} Zeichen)"
|
111
|
+
wrong_length: "hat die falsche Länge (muss genau {{count}} Zeichen haben)"
|
112
|
+
taken: "ist bereits vergeben"
|
113
|
+
not_a_number: "ist keine Zahl"
|
114
|
+
greater_than: "muss größer als {{count}} sein"
|
115
|
+
greater_than_or_equal_to: "muss größer oder gleich {{count}} sein"
|
116
|
+
equal_to: "muss genau {{count}} sein"
|
117
|
+
less_than: "muss kleiner als {{count}} sein"
|
118
|
+
less_than_or_equal_to: "muss kleiner oder gleich {{count}} sein"
|
119
|
+
odd: "muss ungerade sein"
|
120
|
+
even: "muss gerade sein"
|
121
|
+
models:
|
122
|
+
car: 'BAUTO'
|
123
|
+
cars: 'CAUTO'
|
124
|
+
Car: 'DAUTO'
|
125
|
+
|
126
|
+
models:
|
127
|
+
car: 'Auto'
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'benchmark'
|
2
|
+
BASELINE = 0
|
3
|
+
def test
|
4
|
+
result = Benchmark.measure {1_000_000.times{ yield }}
|
5
|
+
result.to_s.strip.split(' ').first.to_f - BASELINE
|
6
|
+
end
|
7
|
+
|
8
|
+
BASELINE = (test{})
|
9
|
+
Thread.current[:library_name]={}
|
10
|
+
other = "x"
|
11
|
+
puts "Ruby #{VERSION}"
|
12
|
+
|
13
|
+
puts "generic:"
|
14
|
+
puts " Symbol: #{test{Thread.current[:library_name][:just_a_symbol]}}s"
|
15
|
+
puts " String concat: #{test{Thread.current["xxxxxx"<<other.to_s]}}s"
|
16
|
+
puts " String add: #{test{Thread.current["xxxxxx"+other.to_s]}}s"
|
17
|
+
puts " String insert: #{test{Thread.current["xxxxxx#{other}"]}}s"
|
18
|
+
|
19
|
+
puts "single:"
|
20
|
+
puts " Symbol: #{test{Thread.current[:long_unique_symbol]}}s"
|
21
|
+
puts " String: #{test{Thread.current["xxxxxx"]}}s"
|
@@ -0,0 +1,15 @@
|
|
1
|
+
#Iconv will not be defined, unless it is found -> normalize test results for users that have Iconv/those who do not have it
|
2
|
+
begin;require 'iconv';rescue;LoadError;end
|
3
|
+
initial = methods.count + Module.constants.count
|
4
|
+
|
5
|
+
#FastGettext
|
6
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__),'..','..','lib')
|
7
|
+
require 'fast_gettext'
|
8
|
+
FastGettext.locale = 'de'
|
9
|
+
FastGettext.add_text_domain 'test', :path=>'spec/locale'
|
10
|
+
FastGettext.text_domain = 'test'
|
11
|
+
include FastGettext::Translation
|
12
|
+
raise unless _('car')=='Auto'
|
13
|
+
|
14
|
+
puts "FastGettext"
|
15
|
+
puts methods.count + Module.constants.count - initial
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
initial = methods.count + Module.constants.count
|
3
|
+
|
4
|
+
#GetText
|
5
|
+
gem 'gettext', '>=2.0.0'
|
6
|
+
require 'gettext'
|
7
|
+
GetText.locale = 'de'
|
8
|
+
GetText.bindtextdomain('test',:path=>'spec/locale')
|
9
|
+
include GetText
|
10
|
+
raise unless _('car') == 'Auto'
|
11
|
+
|
12
|
+
|
13
|
+
puts "GetText"
|
14
|
+
puts methods.count + Module.constants.count - initial
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'benchmark/base'
|
2
|
+
|
3
|
+
gem 'gettext', '>=2.0.0'
|
4
|
+
require 'gettext'
|
5
|
+
include GetText
|
6
|
+
|
7
|
+
self.locale = 'de'
|
8
|
+
|
9
|
+
puts "GetText #{GetText::VERSION}:"
|
10
|
+
bindtextdomain('test',:path=>locale_folder('test'))
|
11
|
+
results_test{_('car') == 'Auto'}
|
12
|
+
|
13
|
+
#i cannot add the large file, since its an internal applications mo file
|
14
|
+
bindtextdomain('large',:path=>locale_folder('large'))
|
15
|
+
results_large
|
@@ -0,0 +1,152 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{fast_gettext}
|
5
|
+
s.version = "0.4.12"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Michael Grosser"]
|
9
|
+
s.date = %q{2009-06-27}
|
10
|
+
s.email = %q{grosser.michael@gmail.com}
|
11
|
+
s.extra_rdoc_files = [
|
12
|
+
"README.markdown"
|
13
|
+
]
|
14
|
+
s.files = [
|
15
|
+
".gitignore",
|
16
|
+
"CHANGELOG",
|
17
|
+
"README.markdown",
|
18
|
+
"README.markdown",
|
19
|
+
"Rakefile",
|
20
|
+
"VERSION",
|
21
|
+
"benchmark/base.rb",
|
22
|
+
"benchmark/baseline.rb",
|
23
|
+
"benchmark/fast_gettext.rb",
|
24
|
+
"benchmark/i18n_simple.rb",
|
25
|
+
"benchmark/ideal.rb",
|
26
|
+
"benchmark/locale/de.yml",
|
27
|
+
"benchmark/locale/de/LC_MESSAGES/large.mo",
|
28
|
+
"benchmark/misc/threadsave.rb",
|
29
|
+
"benchmark/namespace/fast_gettext.rb",
|
30
|
+
"benchmark/namespace/original.rb",
|
31
|
+
"benchmark/original.rb",
|
32
|
+
"examples/db/migration.rb",
|
33
|
+
"examples/missing_translation_logger.rb",
|
34
|
+
"fast_gettext.gemspec",
|
35
|
+
"lib/fast_gettext.rb",
|
36
|
+
"lib/fast_gettext.rb",
|
37
|
+
"lib/fast_gettext/mo_file.rb",
|
38
|
+
"lib/fast_gettext/mo_file.rb",
|
39
|
+
"lib/fast_gettext/po_file.rb",
|
40
|
+
"lib/fast_gettext/po_file.rb",
|
41
|
+
"lib/fast_gettext/storage.rb",
|
42
|
+
"lib/fast_gettext/storage.rb",
|
43
|
+
"lib/fast_gettext/translation.rb",
|
44
|
+
"lib/fast_gettext/translation.rb",
|
45
|
+
"lib/fast_gettext/translation_repository.rb",
|
46
|
+
"lib/fast_gettext/translation_repository.rb",
|
47
|
+
"lib/fast_gettext/translation_repository/base.rb",
|
48
|
+
"lib/fast_gettext/translation_repository/base.rb",
|
49
|
+
"lib/fast_gettext/translation_repository/chain.rb",
|
50
|
+
"lib/fast_gettext/translation_repository/chain.rb",
|
51
|
+
"lib/fast_gettext/translation_repository/db.rb",
|
52
|
+
"lib/fast_gettext/translation_repository/db.rb",
|
53
|
+
"lib/fast_gettext/translation_repository/db_models/translation_key.rb",
|
54
|
+
"lib/fast_gettext/translation_repository/db_models/translation_key.rb",
|
55
|
+
"lib/fast_gettext/translation_repository/db_models/translation_text.rb",
|
56
|
+
"lib/fast_gettext/translation_repository/db_models/translation_text.rb",
|
57
|
+
"lib/fast_gettext/translation_repository/logger.rb",
|
58
|
+
"lib/fast_gettext/translation_repository/logger.rb",
|
59
|
+
"lib/fast_gettext/translation_repository/mo.rb",
|
60
|
+
"lib/fast_gettext/translation_repository/mo.rb",
|
61
|
+
"lib/fast_gettext/translation_repository/po.rb",
|
62
|
+
"lib/fast_gettext/translation_repository/po.rb",
|
63
|
+
"spec/aa_unconfigued_spec.rb",
|
64
|
+
"spec/aa_unconfigued_spec.rb",
|
65
|
+
"spec/fast_gettext/mo_file_spec.rb",
|
66
|
+
"spec/fast_gettext/mo_file_spec.rb",
|
67
|
+
"spec/fast_gettext/storage_spec.rb",
|
68
|
+
"spec/fast_gettext/storage_spec.rb",
|
69
|
+
"spec/fast_gettext/translation_repository/base_spec.rb",
|
70
|
+
"spec/fast_gettext/translation_repository/base_spec.rb",
|
71
|
+
"spec/fast_gettext/translation_repository/chain_spec.rb",
|
72
|
+
"spec/fast_gettext/translation_repository/chain_spec.rb",
|
73
|
+
"spec/fast_gettext/translation_repository/db_spec.rb",
|
74
|
+
"spec/fast_gettext/translation_repository/db_spec.rb",
|
75
|
+
"spec/fast_gettext/translation_repository/logger_spec.rb",
|
76
|
+
"spec/fast_gettext/translation_repository/logger_spec.rb",
|
77
|
+
"spec/fast_gettext/translation_repository/mo_spec.rb",
|
78
|
+
"spec/fast_gettext/translation_repository/mo_spec.rb",
|
79
|
+
"spec/fast_gettext/translation_repository/po_spec.rb",
|
80
|
+
"spec/fast_gettext/translation_repository/po_spec.rb",
|
81
|
+
"spec/fast_gettext/translation_spec.rb",
|
82
|
+
"spec/fast_gettext/translation_spec.rb",
|
83
|
+
"spec/fast_gettext_spec.rb",
|
84
|
+
"spec/fast_gettext_spec.rb",
|
85
|
+
"spec/locale/de/LC_MESSAGES/test.mo",
|
86
|
+
"spec/locale/de/LC_MESSAGES/test.mo",
|
87
|
+
"spec/locale/de/test.po",
|
88
|
+
"spec/locale/de/test.po",
|
89
|
+
"spec/locale/en/LC_MESSAGES/plural_test.mo",
|
90
|
+
"spec/locale/en/LC_MESSAGES/plural_test.mo",
|
91
|
+
"spec/locale/en/LC_MESSAGES/test.mo",
|
92
|
+
"spec/locale/en/LC_MESSAGES/test.mo",
|
93
|
+
"spec/locale/en/plural_test.po",
|
94
|
+
"spec/locale/en/plural_test.po",
|
95
|
+
"spec/locale/en/test.po",
|
96
|
+
"spec/locale/en/test.po",
|
97
|
+
"spec/spec_helper.rb",
|
98
|
+
"spec/spec_helper.rb",
|
99
|
+
"spec/vendor/fake_load_path/iconv.rb",
|
100
|
+
"spec/vendor/fake_load_path/iconv.rb",
|
101
|
+
"spec/vendor/iconv_spec.rb",
|
102
|
+
"spec/vendor/iconv_spec.rb",
|
103
|
+
"spec/vendor/string_spec.rb",
|
104
|
+
"spec/vendor/string_spec.rb",
|
105
|
+
"vendor/README.rdoc",
|
106
|
+
"vendor/README.rdoc",
|
107
|
+
"vendor/empty.mo",
|
108
|
+
"vendor/empty.mo",
|
109
|
+
"vendor/iconv.rb",
|
110
|
+
"vendor/iconv.rb",
|
111
|
+
"vendor/mofile.rb",
|
112
|
+
"vendor/mofile.rb",
|
113
|
+
"vendor/poparser.rb",
|
114
|
+
"vendor/poparser.rb",
|
115
|
+
"vendor/string.rb",
|
116
|
+
"vendor/string.rb"
|
117
|
+
]
|
118
|
+
s.homepage = %q{http://github.com/grosser/fast_gettext}
|
119
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
120
|
+
s.require_paths = ["lib"]
|
121
|
+
s.rubygems_version = %q{1.3.4}
|
122
|
+
s.summary = %q{A simple, fast and threadsafe implementation of GetText}
|
123
|
+
s.test_files = [
|
124
|
+
"spec/fast_gettext_spec.rb",
|
125
|
+
"spec/spec_helper.rb",
|
126
|
+
"spec/fast_gettext/translation_spec.rb",
|
127
|
+
"spec/fast_gettext/storage_spec.rb",
|
128
|
+
"spec/fast_gettext/translation_repository/chain_spec.rb",
|
129
|
+
"spec/fast_gettext/translation_repository/logger_spec.rb",
|
130
|
+
"spec/fast_gettext/translation_repository/base_spec.rb",
|
131
|
+
"spec/fast_gettext/translation_repository/po_spec.rb",
|
132
|
+
"spec/fast_gettext/translation_repository/db_spec.rb",
|
133
|
+
"spec/fast_gettext/translation_repository/mo_spec.rb",
|
134
|
+
"spec/fast_gettext/mo_file_spec.rb",
|
135
|
+
"spec/aa_unconfigued_spec.rb",
|
136
|
+
"spec/vendor/iconv_spec.rb",
|
137
|
+
"spec/vendor/fake_load_path/iconv.rb",
|
138
|
+
"spec/vendor/string_spec.rb",
|
139
|
+
"examples/db/migration.rb",
|
140
|
+
"examples/missing_translation_logger.rb"
|
141
|
+
]
|
142
|
+
|
143
|
+
if s.respond_to? :specification_version then
|
144
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
145
|
+
s.specification_version = 3
|
146
|
+
|
147
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
148
|
+
else
|
149
|
+
end
|
150
|
+
else
|
151
|
+
end
|
152
|
+
end
|
data/spec/vendor/string_spec.rb
CHANGED
data/vendor/string.rb
CHANGED
@@ -33,16 +33,19 @@ rescue ArgumentError
|
|
33
33
|
# because the translators can understand the meanings of the keys easily.
|
34
34
|
def %(args)
|
35
35
|
if args.kind_of? Hash
|
36
|
+
#stringify keys
|
37
|
+
replace = {}
|
38
|
+
args.each{|k,v|replace[k.to_s]=v}
|
39
|
+
|
40
|
+
#replace occurances
|
36
41
|
ret = dup
|
37
42
|
ret.gsub!(PERCENT_MATCH_RE) do |match|
|
38
43
|
if match == '%%'
|
39
44
|
'%'
|
40
45
|
elsif $1
|
41
|
-
|
42
|
-
args.has_key?(key) ? args[key] : match
|
46
|
+
replace.has_key?($1) ? replace[$1] : match
|
43
47
|
elsif $2
|
44
|
-
|
45
|
-
args.has_key?(key) ? sprintf("%#{$3}", args[key]) : match
|
48
|
+
replace.has_key?($2) ? sprintf("%#{$3}", replace[$2]) : match
|
46
49
|
end
|
47
50
|
end
|
48
51
|
ret
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grosser-fast_gettext
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Grosser
|
@@ -22,11 +22,25 @@ extensions: []
|
|
22
22
|
extra_rdoc_files:
|
23
23
|
- README.markdown
|
24
24
|
files:
|
25
|
+
- .gitignore
|
26
|
+
- CHANGELOG
|
25
27
|
- README.markdown
|
26
28
|
- Rakefile
|
27
|
-
- VERSION
|
29
|
+
- VERSION
|
30
|
+
- benchmark/base.rb
|
31
|
+
- benchmark/baseline.rb
|
32
|
+
- benchmark/fast_gettext.rb
|
33
|
+
- benchmark/i18n_simple.rb
|
34
|
+
- benchmark/ideal.rb
|
35
|
+
- benchmark/locale/de.yml
|
36
|
+
- benchmark/locale/de/LC_MESSAGES/large.mo
|
37
|
+
- benchmark/misc/threadsave.rb
|
38
|
+
- benchmark/namespace/fast_gettext.rb
|
39
|
+
- benchmark/namespace/original.rb
|
40
|
+
- benchmark/original.rb
|
28
41
|
- examples/db/migration.rb
|
29
42
|
- examples/missing_translation_logger.rb
|
43
|
+
- fast_gettext.gemspec
|
30
44
|
- lib/fast_gettext.rb
|
31
45
|
- lib/fast_gettext/mo_file.rb
|
32
46
|
- lib/fast_gettext/po_file.rb
|
data/VERSION.yml
DELETED