get_pomo 0.7.0 → 0.7.1
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/lib/get_pomo/mo_file.rb +4 -4
- data/lib/get_pomo/translation.rb +13 -8
- data/lib/get_pomo/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb1e35bef67b57c020e28e8a0695678104b80ed1
|
4
|
+
data.tar.gz: 5e489f0e04fab3e8510b7bc97ed698d7f20bc280
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4dcbfcd7b5c29ff12b612c85b3edb06c7e7280be55c07f1d75c6fefbebcc9c91021087e6fc32df37fc6736cb33c4e713336b341da26b077b84620eade298e4b7
|
7
|
+
data.tar.gz: 41da61f15f4bc18050a7cf0532ad39453f58064ec527e16264c6632ebb154eef2100d764e4c9f9e955d8e28fe0cec840f4f8efb2ccb5e17283b4c568118e72a2
|
data/lib/get_pomo/mo_file.rb
CHANGED
@@ -3,7 +3,7 @@ require File.join(File.dirname(__FILE__),'..','..','vendor','mofile')
|
|
3
3
|
|
4
4
|
module GetPomo
|
5
5
|
class MoFile
|
6
|
-
|
6
|
+
PLURAL_SEPARATOR = "\000"
|
7
7
|
|
8
8
|
def self.parse(text)
|
9
9
|
MoFile.new.add_translations_from_text(text)
|
@@ -48,15 +48,15 @@ module GetPomo
|
|
48
48
|
private
|
49
49
|
|
50
50
|
def plural_to_string(plural_or_singular)
|
51
|
-
[*plural_or_singular] *
|
51
|
+
[*plural_or_singular] * PLURAL_SEPARATOR
|
52
52
|
end
|
53
53
|
|
54
54
|
def plural? string
|
55
|
-
string.include?
|
55
|
+
string.include? PLURAL_SEPARATOR
|
56
56
|
end
|
57
57
|
|
58
58
|
def split_plural string
|
59
|
-
string.split
|
59
|
+
string.split PLURAL_SEPARATOR
|
60
60
|
end
|
61
61
|
end
|
62
62
|
end
|
data/lib/get_pomo/translation.rb
CHANGED
@@ -12,6 +12,11 @@ module GetPomo
|
|
12
12
|
elsif to.to_s =~ /^msgstr\[(\d)\]$/
|
13
13
|
self.msgstr ||= []
|
14
14
|
msgstr[$1.to_i] = msgstr[$1.to_i].to_s + text
|
15
|
+
elsif to.to_sym == :comment && text =~ OBSOLETE_REGEX
|
16
|
+
# initialize msgid and msgstr on obsolete translations
|
17
|
+
self.msgid ||= ""
|
18
|
+
self.msgstr ||= ""
|
19
|
+
send("#{to}=",send(to).to_s+text)
|
15
20
|
else
|
16
21
|
#simple form
|
17
22
|
send("#{to}=",send(to).to_s+text)
|
@@ -19,11 +24,16 @@ module GetPomo
|
|
19
24
|
end
|
20
25
|
|
21
26
|
def to_hash
|
22
|
-
{
|
27
|
+
{
|
28
|
+
:msgctxt => msgctxt,
|
29
|
+
:msgid => msgid,
|
30
|
+
:msgstr => msgstr,
|
31
|
+
:comment => comment
|
32
|
+
}.reject { |_,value| value.nil? }
|
23
33
|
end
|
24
34
|
|
25
35
|
def complete?
|
26
|
-
|
36
|
+
not msgid.nil? and not msgstr.nil?
|
27
37
|
end
|
28
38
|
|
29
39
|
def fuzzy?
|
@@ -31,12 +41,7 @@ module GetPomo
|
|
31
41
|
end
|
32
42
|
|
33
43
|
def obsolete?
|
34
|
-
|
35
|
-
#prevent nullpointer in obsolete msgs
|
36
|
-
self.msgid = '' if msgid.nil?
|
37
|
-
self.msgstr = '' if msgstr.nil?
|
38
|
-
end
|
39
|
-
obs
|
44
|
+
!!(comment =~ OBSOLETE_REGEX)
|
40
45
|
end
|
41
46
|
|
42
47
|
def fuzzy=(value)
|
data/lib/get_pomo/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: get_pomo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Grosser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email: michael@grosser.it
|