fast_gettext 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
data/Readme.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
FastGettext
|
2
2
|
===========
|
3
|
-
GetText but 3.5 x faster, 560 x less memory, simple, clean namespace (7 vs 34) and
|
3
|
+
GetText but 3.5 x faster, 560 x less memory, simple, clean namespace (7 vs 34) and threadsafe!
|
4
4
|
|
5
|
-
It supports multiple backends (.mo, .po, .yml files, Database(
|
5
|
+
It supports multiple backends (.mo, .po, .yml files, Database(ActiveRecord + any other), Chain, Loggers) and can easily be extended.
|
6
6
|
|
7
7
|
[Example Rails application](https://github.com/grosser/gettext_i18n_rails_example)
|
8
8
|
|
@@ -87,7 +87,7 @@ Tell Gettext where your .mo or .po files lie, e.g. for locale/de/my_app.po and l
|
|
87
87
|
FastGettext.add_text_domain('my_app',:path=>'locale')
|
88
88
|
|
89
89
|
Use the [original GetText](http://github.com/mutoh/gettext) to create and manage po/mo-files.
|
90
|
-
(Work on a po/mo parser & reader that is easier to use has started, contributions welcome @ [
|
90
|
+
(Work on a po/mo parser & reader that is easier to use has started, contributions welcome @ [get_pomo](http://github.com/grosser/get_pomo) )
|
91
91
|
|
92
92
|
###Database
|
93
93
|
[Example migration for ActiveRecord](http://github.com/grosser/fast_gettext/blob/master/examples/db/migration.rb)<br/>
|
@@ -127,7 +127,7 @@ Advanced features
|
|
127
127
|
=================
|
128
128
|
### Abnormal pluralisation
|
129
129
|
Plurals are selected by index, think of it as `['car', 'cars'][index]`<br/>
|
130
|
-
A pluralisation
|
130
|
+
A pluralisation rule decides which form to use e.g. in english its `count == 1 ? 0 : 1`.<br/>
|
131
131
|
If you have any languages that do not fit this rule, you have to add a custom pluralisation rule.
|
132
132
|
|
133
133
|
Via Ruby:
|
@@ -167,7 +167,7 @@ When you want to know which keys could not be translated or were used, add a Log
|
|
167
167
|
}
|
168
168
|
FastGettext.add_text_domain 'combined', :type=>:chain, :chain=>repos
|
169
169
|
If the Logger is in position #1 it will see all translations, if it is in position #2 it will only see the unfound.
|
170
|
-
Unfound may not always mean missing, if you
|
170
|
+
Unfound may not always mean missing, if you choose not to translate a word because the key is a good translation, it will appear nevertheless.
|
171
171
|
A lambda or anything that responds to `call` will do as callback. A good starting point may be `examples/missing_translations_logger.rb`.
|
172
172
|
|
173
173
|
###Plugins
|
@@ -192,8 +192,8 @@ FAQ
|
|
192
192
|
|
193
193
|
TODO
|
194
194
|
====
|
195
|
+
- Add a fallback for Iconv.conv in ruby 1.9.4 -> lib/fast_gettext/vendor/iconv
|
195
196
|
- YML backend that reads ActiveSupport::I18n files
|
196
|
-
- any ideas ? :D
|
197
197
|
|
198
198
|
Author
|
199
199
|
======
|
@@ -210,4 +210,6 @@ Mo/Po-file parsing from Masao Mutoh, see vendor/README
|
|
210
210
|
|
211
211
|
[Michael Grosser](http://grosser.it)<br/>
|
212
212
|
michael@grosser.it<br/>
|
213
|
-
Hereby placed under public domain, do what you want, just do not hold me accountable
|
213
|
+
Hereby placed under public domain, do what you want, just do not hold me accountable...<br/>
|
214
|
+
[![Flattr](http://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=grosser&url=https://github.com/grosser/fast_gettext&title=fast_gettext&language=en_GB&tags=github&category=software)
|
215
|
+
[![Build Status](https://secure.travis-ci.org/grosser/fast_gettext.png)](http://travis-ci.org/grosser/fast_gettext)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.6.
|
1
|
+
0.6.2
|
data/fast_gettext.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.6.
|
7
|
+
s.name = %q{fast_gettext}
|
8
|
+
s.version = "0.6.2"
|
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-10-30}
|
13
|
+
s.email = %q{michael@grosser.it}
|
14
14
|
s.files = [
|
15
15
|
".travis.yml",
|
16
16
|
"CHANGELOG",
|
@@ -60,6 +60,7 @@ Gem::Specification.new do |s|
|
|
60
60
|
"spec/cases/iconv_fallback.rb",
|
61
61
|
"spec/cases/interpolate_i18n_after_fast_gettext.rb",
|
62
62
|
"spec/cases/interpolate_i18n_before_fast_gettext.rb",
|
63
|
+
"spec/cases/safe_mode_can_handle_locales.rb",
|
63
64
|
"spec/fast_gettext/mo_file_spec.rb",
|
64
65
|
"spec/fast_gettext/storage_spec.rb",
|
65
66
|
"spec/fast_gettext/translation_repository/base_spec.rb",
|
@@ -89,10 +90,10 @@ Gem::Specification.new do |s|
|
|
89
90
|
"spec/obsolete_locale/de/test.po",
|
90
91
|
"spec/spec_helper.rb"
|
91
92
|
]
|
92
|
-
s.homepage =
|
93
|
+
s.homepage = %q{http://github.com/grosser/fast_gettext}
|
93
94
|
s.require_paths = ["lib"]
|
94
|
-
s.rubygems_version =
|
95
|
-
s.summary =
|
95
|
+
s.rubygems_version = %q{1.6.2}
|
96
|
+
s.summary = %q{A simple, fast, memory-efficient and threadsafe implementation of GetText}
|
96
97
|
|
97
98
|
if s.respond_to? :specification_version then
|
98
99
|
s.specification_version = 3
|
@@ -38,7 +38,7 @@ module FastGettext
|
|
38
38
|
@files = {}
|
39
39
|
Dir[File.join(path,'*')].each do |locale_folder|
|
40
40
|
next unless File.basename(locale_folder) =~ LOCALE_REX
|
41
|
-
file = File.join(locale_folder,relative_file_path)
|
41
|
+
file = File.join(locale_folder,relative_file_path).untaint
|
42
42
|
next unless File.exist? file
|
43
43
|
locale = File.basename(locale_folder)
|
44
44
|
@files[locale] = yield(locale,file)
|
@@ -26,4 +26,8 @@ describe 'FastGettext::TranslationRepository::Mo' do
|
|
26
26
|
rep['car'].should == 'Test'#just check it is loaded correctly
|
27
27
|
rep.pluralisation_rule.call(2).should == 3
|
28
28
|
end
|
29
|
+
|
30
|
+
it "can work in SAFE mode" do
|
31
|
+
`ruby spec/cases/safe_mode_can_handle_locales.rb 2>&1`.should == 'true'
|
32
|
+
end
|
29
33
|
end
|
metadata
CHANGED
@@ -1,22 +1,33 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: fast_gettext
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 3
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 6
|
9
|
+
- 2
|
10
|
+
version: 0.6.2
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- Michael Grosser
|
9
14
|
autorequire:
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
|
-
|
17
|
+
|
18
|
+
date: 2011-10-30 00:00:00 -07:00
|
19
|
+
default_executable:
|
13
20
|
dependencies: []
|
21
|
+
|
14
22
|
description:
|
15
23
|
email: michael@grosser.it
|
16
24
|
executables: []
|
25
|
+
|
17
26
|
extensions: []
|
27
|
+
|
18
28
|
extra_rdoc_files: []
|
19
|
-
|
29
|
+
|
30
|
+
files:
|
20
31
|
- .travis.yml
|
21
32
|
- CHANGELOG
|
22
33
|
- Gemfile
|
@@ -65,6 +76,7 @@ files:
|
|
65
76
|
- spec/cases/iconv_fallback.rb
|
66
77
|
- spec/cases/interpolate_i18n_after_fast_gettext.rb
|
67
78
|
- spec/cases/interpolate_i18n_before_fast_gettext.rb
|
79
|
+
- spec/cases/safe_mode_can_handle_locales.rb
|
68
80
|
- spec/fast_gettext/mo_file_spec.rb
|
69
81
|
- spec/fast_gettext/storage_spec.rb
|
70
82
|
- spec/fast_gettext/translation_repository/base_spec.rb
|
@@ -93,31 +105,39 @@ files:
|
|
93
105
|
- spec/locale/yaml/notfound.yml
|
94
106
|
- spec/obsolete_locale/de/test.po
|
95
107
|
- spec/spec_helper.rb
|
108
|
+
has_rdoc: true
|
96
109
|
homepage: http://github.com/grosser/fast_gettext
|
97
110
|
licenses: []
|
111
|
+
|
98
112
|
post_install_message:
|
99
113
|
rdoc_options: []
|
100
|
-
|
114
|
+
|
115
|
+
require_paths:
|
101
116
|
- lib
|
102
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
117
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
103
118
|
none: false
|
104
|
-
requirements:
|
105
|
-
- -
|
106
|
-
- !ruby/object:Gem::Version
|
107
|
-
|
108
|
-
segments:
|
119
|
+
requirements:
|
120
|
+
- - ">="
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
hash: 3
|
123
|
+
segments:
|
109
124
|
- 0
|
110
|
-
|
111
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
125
|
+
version: "0"
|
126
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
112
127
|
none: false
|
113
|
-
requirements:
|
114
|
-
- -
|
115
|
-
- !ruby/object:Gem::Version
|
116
|
-
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
hash: 3
|
132
|
+
segments:
|
133
|
+
- 0
|
134
|
+
version: "0"
|
117
135
|
requirements: []
|
136
|
+
|
118
137
|
rubyforge_project:
|
119
|
-
rubygems_version: 1.
|
138
|
+
rubygems_version: 1.6.2
|
120
139
|
signing_key:
|
121
140
|
specification_version: 3
|
122
141
|
summary: A simple, fast, memory-efficient and threadsafe implementation of GetText
|
123
142
|
test_files: []
|
143
|
+
|