gettext_simple 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/gettext_simple.gemspec +1 -1
- data/lib/gettext_simple.rb +1 -5
- data/spec/gettext_simple_spec.rb +8 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 160fe8d8a9f477f0b81264bc7505a02dc015b10b
|
4
|
+
data.tar.gz: c29d0a464ca361ad747ea9e018dbd803d113176d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20b8d3e2847981c4b12f9c99fd7cc7659f45c03316b08a8f29cb26a5a252e6fdf330c5ba5a393a8003a3c3f6368831fe579e1eb66a802588abb039e5c4c8c0b3
|
7
|
+
data.tar.gz: dd48e51243a04a8b5d06f1b0c08b4288e11c3beff410c4e2723f617677a32041756a1327a64d4269cb0300ac09bff56308d45a0db98ff2aa52ff190d4a3a2607
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.4
|
data/gettext_simple.gemspec
CHANGED
data/lib/gettext_simple.rb
CHANGED
@@ -146,14 +146,10 @@ private
|
|
146
146
|
|
147
147
|
add_translation(locale, current_id, current_translation) if reading_translation
|
148
148
|
end
|
149
|
-
|
150
|
-
#cont.scan(/msgid\s+\"(.+)\"(\r|)\nmsgstr\s+\"(.+)\"(\r|)\n(\r|)\n/) do |match|
|
151
|
-
# @locales[locale][match[0]] = match[2].to_s.encode("utf-8")
|
152
|
-
#end
|
153
149
|
end
|
154
150
|
|
155
151
|
def add_translation(locale, key, val)
|
156
152
|
raise "No such language: '#{locale}'." unless @locales.key?(locale)
|
157
|
-
@locales[locale][key] = val
|
153
|
+
@locales[locale][key] = val unless val.to_s.empty?
|
158
154
|
end
|
159
155
|
end
|
data/spec/gettext_simple_spec.rb
CHANGED
@@ -19,6 +19,10 @@ describe "GettextSimple" do
|
|
19
19
|
fp.puts "\"test mange\"\n"
|
20
20
|
fp.puts "\" linjer\"\n"
|
21
21
|
fp.puts "\n"
|
22
|
+
|
23
|
+
fp.puts "msgid \"empty translation\"\n"
|
24
|
+
fp.puts "msgstr \"\"\n"
|
25
|
+
fp.puts "\n"
|
22
26
|
end
|
23
27
|
|
24
28
|
@gs = GettextSimple.new
|
@@ -60,4 +64,8 @@ describe "GettextSimple" do
|
|
60
64
|
|
61
65
|
da[test_key].should eq test_value
|
62
66
|
end
|
67
|
+
|
68
|
+
it "should ignore empty translations" do
|
69
|
+
@gs.instance_variable_get(:@locales)["da"].keys.should_not include "empty translation"
|
70
|
+
end
|
63
71
|
end
|