fast_gettext 0.6.2 → 0.6.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Readme.md +1 -0
- data/VERSION +1 -1
- data/fast_gettext.gemspec +3 -2
- data/lib/fast_gettext/vendor/poparser.rb +5 -2
- data/spec/fast_gettext/po_file_spec.rb +35 -0
- data/spec/locale/de/test.po +5 -1
- metadata +5 -4
data/Readme.md
CHANGED
@@ -207,6 +207,7 @@ Mo/Po-file parsing from Masao Mutoh, see vendor/README
|
|
207
207
|
- Rudolf Gavlas
|
208
208
|
- [Ramón Cahenzli](http://www.psy-q.ch)
|
209
209
|
- [Rainux Luo](http://rainux.org)
|
210
|
+
- [Dmitry Borodaenko](https://github.com/angdraug)
|
210
211
|
|
211
212
|
[Michael Grosser](http://grosser.it)<br/>
|
212
213
|
michael@grosser.it<br/>
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.6.
|
1
|
+
0.6.3
|
data/fast_gettext.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{fast_gettext}
|
8
|
-
s.version = "0.6.
|
8
|
+
s.version = "0.6.3"
|
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 = %q{2011-
|
12
|
+
s.date = %q{2011-12-04}
|
13
13
|
s.email = %q{michael@grosser.it}
|
14
14
|
s.files = [
|
15
15
|
".travis.yml",
|
@@ -62,6 +62,7 @@ Gem::Specification.new do |s|
|
|
62
62
|
"spec/cases/interpolate_i18n_before_fast_gettext.rb",
|
63
63
|
"spec/cases/safe_mode_can_handle_locales.rb",
|
64
64
|
"spec/fast_gettext/mo_file_spec.rb",
|
65
|
+
"spec/fast_gettext/po_file_spec.rb",
|
65
66
|
"spec/fast_gettext/storage_spec.rb",
|
66
67
|
"spec/fast_gettext/translation_repository/base_spec.rb",
|
67
68
|
"spec/fast_gettext/translation_repository/chain_spec.rb",
|
@@ -69,8 +69,8 @@ module_eval <<'..end src/poparser.ry modeval..id7a99570e05', 'src/poparser.ry',
|
|
69
69
|
@q.push [:COMMENT, $&]
|
70
70
|
str = $'
|
71
71
|
when /\A\"(.*)\"/
|
72
|
-
@q.push [:STRING, $1]
|
73
72
|
str = $'
|
73
|
+
@q.push [:STRING, unescape_string($1)]
|
74
74
|
else
|
75
75
|
#c = str[0,1]
|
76
76
|
#@q.push [:STRING, c]
|
@@ -110,6 +110,9 @@ module_eval <<'..end src/poparser.ry modeval..id7a99570e05', 'src/poparser.ry',
|
|
110
110
|
@comments << comment
|
111
111
|
end
|
112
112
|
|
113
|
+
def unescape_string(string)
|
114
|
+
string.gsub(/\\\\/, "\\")
|
115
|
+
end
|
113
116
|
|
114
117
|
..end src/poparser.ry modeval..id7a99570e05
|
115
118
|
|
@@ -330,4 +333,4 @@ module_eval <<'.,.,', 'src/poparser.ry', 103
|
|
330
333
|
end # class PoParser
|
331
334
|
|
332
335
|
end # module GetText
|
333
|
-
end
|
336
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require File.expand_path('spec/spec_helper')
|
2
|
+
require 'fast_gettext/po_file'
|
3
|
+
|
4
|
+
de_file = File.join('spec','locale','de','test.po')
|
5
|
+
de = FastGettext::PoFile.to_mo_file(de_file)
|
6
|
+
|
7
|
+
describe FastGettext::PoFile do
|
8
|
+
before :all do
|
9
|
+
File.exist?(de_file).should == true
|
10
|
+
end
|
11
|
+
|
12
|
+
it "parses a file" do
|
13
|
+
de['car'].should == 'Auto'
|
14
|
+
end
|
15
|
+
|
16
|
+
it "stores untranslated values as nil" do
|
17
|
+
de['Car|Model'].should == "Modell"
|
18
|
+
end
|
19
|
+
|
20
|
+
it "finds pluralized values" do
|
21
|
+
de.plural('Axis','Axis').should == ['Achse','Achsen']
|
22
|
+
end
|
23
|
+
|
24
|
+
it "returns empty array when pluralisation could not be found" do
|
25
|
+
de.plural('Axis','Axis','Axis').should == []
|
26
|
+
end
|
27
|
+
|
28
|
+
it "can access plurals through []" do
|
29
|
+
de['Axis'].should == 'Achse' #singular
|
30
|
+
end
|
31
|
+
|
32
|
+
it "unescapes '\\'" do
|
33
|
+
de["You should escape '\\' as '\\\\'."].should == "Du solltest '\\' als '\\\\' escapen."
|
34
|
+
end
|
35
|
+
end
|
data/spec/locale/de/test.po
CHANGED
@@ -8,7 +8,7 @@ msgid ""
|
|
8
8
|
msgstr ""
|
9
9
|
"Project-Id-Version: version 0.0.1\n"
|
10
10
|
"POT-Creation-Date: 2009-02-26 19:50+0100\n"
|
11
|
-
"PO-Revision-Date:
|
11
|
+
"PO-Revision-Date: 2011-12-04 18:54+0900\n"
|
12
12
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13
13
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
14
14
|
"MIME-Version: 1.0\n"
|
@@ -59,3 +59,7 @@ msgid "this is a dynamic translation which was found thorugh gettext_test_log!"
|
|
59
59
|
msgstr ""
|
60
60
|
"Dies ist eine dynamische Übersetzung, die durch gettext_test_log "
|
61
61
|
"gefunden wurde!"
|
62
|
+
|
63
|
+
#: locale/test_escape.rb:2
|
64
|
+
msgid "You should escape '\\' as '\\\\'."
|
65
|
+
msgstr "Du solltest '\\' als '\\\\' escapen."
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fast_gettext
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 1
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 6
|
9
|
-
-
|
10
|
-
version: 0.6.
|
9
|
+
- 3
|
10
|
+
version: 0.6.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Michael Grosser
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-12-04 00:00:00 -08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|
@@ -78,6 +78,7 @@ files:
|
|
78
78
|
- spec/cases/interpolate_i18n_before_fast_gettext.rb
|
79
79
|
- spec/cases/safe_mode_can_handle_locales.rb
|
80
80
|
- spec/fast_gettext/mo_file_spec.rb
|
81
|
+
- spec/fast_gettext/po_file_spec.rb
|
81
82
|
- spec/fast_gettext/storage_spec.rb
|
82
83
|
- spec/fast_gettext/translation_repository/base_spec.rb
|
83
84
|
- spec/fast_gettext/translation_repository/chain_spec.rb
|