get_pomo 0.9.0 → 0.9.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/po_file.rb +2 -3
- data/lib/get_pomo/translation.rb +1 -3
- data/lib/get_pomo/version.rb +1 -1
- data/lib/get_pomo.rb +6 -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: 749848c1bf5850ed537278b63d152ea4ee3d99b5
|
4
|
+
data.tar.gz: 8510db607281621b229212d15f953ab0c1d8065d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f2bf65d41b2ac06076bcd3504cb781e276da599ab21c48abe8477c7f49fb4946e270b59237d609ca706cdb3e3aef9951d6470b3865e98c9f912dd72b7633133
|
7
|
+
data.tar.gz: 048ce6a6bf3cbd7b803d82b1afdccfcd67d0bb65db923a8649b465330e6f5817d88276a7510b600160b1df4ead7694acba51dba492f7619b52c68efb51e8c715
|
data/lib/get_pomo/po_file.rb
CHANGED
@@ -106,7 +106,6 @@ module GetPomo
|
|
106
106
|
#msgid "hello" -> method call msgid + add string "hello"
|
107
107
|
def parse_method_call(line)
|
108
108
|
method, string = line.match(/^\s*([a-z0-9_\[\]]+)(.*)/)[1..2]
|
109
|
-
raise "no method found" unless method
|
110
109
|
start_new_translation if %W(msgid msgctxt msgctxt).include? method and translation_complete?
|
111
110
|
@last_method = method.to_sym
|
112
111
|
add_string(string)
|
@@ -116,7 +115,7 @@ module GetPomo
|
|
116
115
|
def add_string(string)
|
117
116
|
string = string.strip
|
118
117
|
return if string.empty?
|
119
|
-
raise "
|
118
|
+
raise GetPomo::InvalidString, "Not a string format: #{string.inspect} on line #{@line_number}" unless string =~ /^['"](.*)['"]$/
|
120
119
|
string_content = string[1..-2] #remove leading and trailing quotes from content
|
121
120
|
@current_translation.add_text(string_content, :to=>@last_method)
|
122
121
|
end
|
@@ -137,4 +136,4 @@ module GetPomo
|
|
137
136
|
@current_translation = Translation.new
|
138
137
|
end
|
139
138
|
end
|
140
|
-
end
|
139
|
+
end
|
data/lib/get_pomo/translation.rb
CHANGED
@@ -12,10 +12,8 @@ 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
|
-
send("#{to}=",send(to).to_s+text)
|
17
15
|
else
|
18
|
-
#
|
16
|
+
raise GetPomo::InvalidMethod, "No method found for #{to}" unless self.respond_to?(to)
|
19
17
|
send("#{to}=",send(to).to_s+text)
|
20
18
|
end
|
21
19
|
end
|
data/lib/get_pomo/version.rb
CHANGED
data/lib/get_pomo.rb
CHANGED
@@ -1,9 +1,14 @@
|
|
1
1
|
require 'get_pomo/po_file'
|
2
|
+
|
2
3
|
module GetPomo
|
3
4
|
autoload :VERSION, "get_pomo/version"
|
4
|
-
|
5
|
+
|
5
6
|
extend self
|
6
7
|
|
8
|
+
class GetPomo::Error < StandardError; end
|
9
|
+
class GetPomo::InvalidString < GetPomo::Error; end
|
10
|
+
class GetPomo::InvalidMethod < GetPomo::Error; end
|
11
|
+
|
7
12
|
# A message is unique if the combination of msgid and msgctxt is unique.
|
8
13
|
# An emtpy msgctxt does not mean the same thing as no msgctxt.
|
9
14
|
# If there are multiple msgid's without msgctxt we use the latest one. If at least one has a msgctxt we completly
|
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.9.
|
4
|
+
version: 0.9.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:
|
11
|
+
date: 2015-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email: michael@grosser.it
|