get_pomo 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2cd9dd2c09caf9db6ca69651e9524293555726d6
4
- data.tar.gz: 108d14f1f7905c087a53d01e8625594245af9d51
3
+ metadata.gz: bb1e35bef67b57c020e28e8a0695678104b80ed1
4
+ data.tar.gz: 5e489f0e04fab3e8510b7bc97ed698d7f20bc280
5
5
  SHA512:
6
- metadata.gz: 840f9278ea6cec9cef976e187e7d24b44abeb0aec9b80c12218efc6d7ecb4af7fea1a7257ef14c7ecbc3f1f12d230c72d8640035a08a35857abe6f12ddb6475e
7
- data.tar.gz: 770b580530ebe517389d9c6b07cf4e417854628010e56b82b4a75dd2ebcc50624b303bfd7c73825ad868ad1d90ab0e2a91ace3b18de47603fd157435d653ebf8
6
+ metadata.gz: 4dcbfcd7b5c29ff12b612c85b3edb06c7e7280be55c07f1d75c6fefbebcc9c91021087e6fc32df37fc6736cb33c4e713336b341da26b077b84620eade298e4b7
7
+ data.tar.gz: 41da61f15f4bc18050a7cf0532ad39453f58064ec527e16264c6632ebb154eef2100d764e4c9f9e955d8e28fe0cec840f4f8efb2ccb5e17283b4c568118e72a2
@@ -3,7 +3,7 @@ require File.join(File.dirname(__FILE__),'..','..','vendor','mofile')
3
3
 
4
4
  module GetPomo
5
5
  class MoFile
6
- PLURAL_SEPERATOR = "\000"
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] * PLURAL_SEPERATOR
51
+ [*plural_or_singular] * PLURAL_SEPARATOR
52
52
  end
53
53
 
54
54
  def plural? string
55
- string.include? PLURAL_SEPERATOR
55
+ string.include? PLURAL_SEPARATOR
56
56
  end
57
57
 
58
58
  def split_plural string
59
- string.split PLURAL_SEPERATOR
59
+ string.split PLURAL_SEPARATOR
60
60
  end
61
61
  end
62
62
  end
@@ -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
- {:msgctxt=>msgctxt,:msgid=>msgid,:msgstr=>msgstr,:comment=>comment}.reject{|k,value|value.nil?}
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
- (not msgid.nil? and not msgstr.nil?) or obsolete?
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
- obs = if !!(comment =~ OBSOLETE_REGEX)
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)
@@ -1,3 +1,3 @@
1
1
  module GetPomo
2
- VERSION = "0.7.0"
2
+ VERSION = "0.7.1"
3
3
  end
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.0
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-04-25 00:00:00.000000000 Z
11
+ date: 2014-05-02 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: michael@grosser.it