fast_gettext 2.0.2 → 2.0.3
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.
- checksums.yaml +4 -4
- data/Readme.md +6 -6
- data/lib/fast_gettext/storage.rb +1 -1
- data/lib/fast_gettext/translation_repository/db.rb +1 -1
- data/lib/fast_gettext/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c5ed0cfe1dff67b67403f857c85eb5bd118f0eed9a23b43648226f371f9aa3da
|
4
|
+
data.tar.gz: 3a95468daabeb1b5428fd2e5d89a3df5a1718f8bd27a717faa9f99b0e6527db9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 944d697e9bea9763e8e14d54f3d5443e7d50d86d838910eef90e02d444128c61639e62863e4361bc65f76d87376897499989b57452d0723d303dbdb708798055
|
7
|
+
data.tar.gz: 2fe267c185b82822b529139b03cdb1939ed612bc9c25317b2914fbbff3ddbb41090f75178ad9f90cb498fbf910f8eebdf0833c274c38f97488194b4cd7763570
|
data/Readme.md
CHANGED
@@ -126,7 +126,7 @@ p_('File', 'Open') == _("File\004Open") == "öffnen"
|
|
126
126
|
p_('Context', 'not-found') == 'not-found'
|
127
127
|
```
|
128
128
|
|
129
|
-
#### `s_()` or `
|
129
|
+
#### `s_()` or `sgettext()`: translation with namespace
|
130
130
|
|
131
131
|
```ruby
|
132
132
|
s_('File|Open') == _('File|Open') == "öffnen"
|
@@ -153,13 +153,13 @@ sn_('Fruit|Apple', 'Apples', 1) == 'Apfel'
|
|
153
153
|
|
154
154
|
#### `N_()` and `Nn_()`: make dynamic translations available to the parser.
|
155
155
|
|
156
|
-
In many instances, your strings will not be found
|
156
|
+
In many instances, your strings will not be found by the ruby parsing. These methods
|
157
157
|
allow for those strings to be discovered.
|
158
158
|
|
159
159
|
```
|
160
160
|
N_("active"); N_("inactive"); N_("paused") # possible value of status for parser to find.
|
161
161
|
Nn_("active", "inactive", "paused") # alternative method
|
162
|
-
_("Your account is %{account_state}.") % { account_state: status }
|
162
|
+
_("Your account is %{account_state}.") % { account_state: _(status) }
|
163
163
|
```
|
164
164
|
|
165
165
|
|
@@ -180,7 +180,7 @@ Use the [original GetText](http://github.com/ruby-gettext/gettext) to create and
|
|
180
180
|
|
181
181
|
### Database
|
182
182
|
[Example migration for ActiveRecord](http://github.com/grosser/fast_gettext/blob/master/examples/db/migration.rb)<br/>
|
183
|
-
The default plural separator is `||||` but you may overwrite it (or suggest a better one
|
183
|
+
The default plural separator is `||||` but you may overwrite it (or suggest a better one...).
|
184
184
|
|
185
185
|
This is usable with any model DataMapper/Sequel or any other(non-database) backend, the only thing you need to do is respond to the self.translation(key, locale) call.
|
186
186
|
If you want to use your own models, have a look at the [default models](http://github.com/grosser/fast_gettext/tree/master/lib/fast_gettext/translation_repository/db_models) to see what you want/need to implement.
|
@@ -305,7 +305,7 @@ Unfound may not always mean missing, if you choose not to translate a word becau
|
|
305
305
|
A lambda or anything that responds to `call` will do as callback. A good starting point may be `examples/missing_translations_logger.rb`.
|
306
306
|
|
307
307
|
### Plugins
|
308
|
-
Want
|
308
|
+
Want an xml version?
|
309
309
|
Write your own TranslationRepository!
|
310
310
|
|
311
311
|
```Ruby
|
@@ -362,7 +362,7 @@ Alternatively you can use [merge repository](https://github.com/grosser/fast_get
|
|
362
362
|
|
363
363
|
#### Block defaults
|
364
364
|
|
365
|
-
All the translation methods (
|
365
|
+
All the translation methods (including MultiDomain) support a block default, a feature not provided by ruby-gettext. When a translation is
|
366
366
|
not found, if a block is provided the block is always returned. Otherwise, a key is returned. Methods doing pluralization will attempt a simple translation of alternate keys.
|
367
367
|
|
368
368
|
```ruby
|
data/lib/fast_gettext/storage.rb
CHANGED
@@ -172,7 +172,7 @@ module FastGettext
|
|
172
172
|
locales = locales.to_s.gsub(/\s/, '')
|
173
173
|
found = [[]]
|
174
174
|
locales.split(',').each do |part|
|
175
|
-
if
|
175
|
+
if /;q=/.match?(part) # contains language and weight ?
|
176
176
|
found.last << part.split(/;q=/)
|
177
177
|
found.last.flatten!
|
178
178
|
found << []
|
data/lib/fast_gettext/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fast_gettext
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Grosser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-05-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -195,14 +195,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
195
195
|
requirements:
|
196
196
|
- - ">="
|
197
197
|
- !ruby/object:Gem::Version
|
198
|
-
version: 2.
|
198
|
+
version: 2.4.0
|
199
199
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
200
200
|
requirements:
|
201
201
|
- - ">="
|
202
202
|
- !ruby/object:Gem::Version
|
203
203
|
version: '0'
|
204
204
|
requirements: []
|
205
|
-
rubygems_version: 3.
|
205
|
+
rubygems_version: 3.1.3
|
206
206
|
signing_key:
|
207
207
|
specification_version: 4
|
208
208
|
summary: A simple, fast, memory-efficient and threadsafe implementation of GetText
|