simple_po_parser 1.1.3 → 1.1.4
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
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d513adc568982ba47ab5a03c16a40584c04413d6c4532e4c7c1a971ac0eb50e9
|
4
|
+
data.tar.gz: e43f80a14fd83c54eae891510785bf888741438e6b6f074e0d4ab4762f63f6e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a292ae5fcdf7479e17e684171c1b518e6a19f3ffdffc361a5f726155c7e4a98dab374ee077a09f438d230ec85923b675916a00994f08b4c82e5e80c4a939bfc
|
7
|
+
data.tar.gz: 421252c15dae92b999bf77f4cb5308838e1b9c81bffe70e6131c39c995a51ce13085912400cd60a0aa581fa76ab0cfa23286f0c6893b41454cd1c63a1ac0fc5e
|
data/.gitattributes
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
spec/simple_po_parser/fixtures/crlf_encoded.po binary
|
data/Rakefile
CHANGED
@@ -20,11 +20,11 @@ namespace :parser do
|
|
20
20
|
require 'benchmark'
|
21
21
|
require 'simple_po_parser'
|
22
22
|
|
23
|
-
desc "Benchmark of
|
23
|
+
desc "Benchmark of 100 full PoParser runs of test/benchmark.po"
|
24
24
|
task "benchmark" do
|
25
25
|
pofile = File.expand_path("test/benchmark.po", __dir__)
|
26
26
|
Benchmark.bmbm do |x|
|
27
|
-
x.report("Parser:") {
|
27
|
+
x.report("Parser:") {100.times { SimplePoParser.parse(pofile) }}
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
@@ -8,7 +8,13 @@ module SimplePoParser
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def parse_file(path)
|
11
|
-
File.open(path,
|
11
|
+
file = File.open(path, "r")
|
12
|
+
if(file.gets =~ /\r$/)
|
13
|
+
# detected windows line ending
|
14
|
+
file.close
|
15
|
+
file = File.open(path, "rt")
|
16
|
+
end
|
17
|
+
file.each_line("\n\n") do |block|
|
12
18
|
block.strip! # dont parse empty blocks
|
13
19
|
@messages << parse_block(block) if block != ''
|
14
20
|
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# PO Header entry
|
2
|
+
#
|
3
|
+
#, fuzzy
|
4
|
+
msgid ""
|
5
|
+
msgstr ""
|
6
|
+
"Project-Id-Version: simple_po_parser 1\n"
|
7
|
+
"Report-Msgid-Bugs-To: me\n"
|
8
|
+
"POT-Creation-Date: 2012-05-04 12:56+0000\n"
|
9
|
+
"PO-Revision-Date: 2014-05-15 22:24+0330\n"
|
10
|
+
"Last-Translator: Dennis-Florian Herr <dennis.herr@experteer.com>\n"
|
11
|
+
"Language-Team: English\n"
|
12
|
+
"MIME-Version: 1.0\n"
|
13
|
+
"Content-Type: text/plain; charset=UTF-8\n"
|
14
|
+
"Content-Transfer-Encoding: 8bit\n"
|
15
|
+
"Plural-Forms: nplurals=1; plural=0;\n"
|
16
|
+
|
17
|
+
# translator-comment
|
18
|
+
#. extract
|
19
|
+
#: reference1
|
20
|
+
msgctxt "Context"
|
21
|
+
msgid "msgid"
|
22
|
+
msgstr "translated"
|
23
|
+
|
24
|
+
# translator-comment
|
25
|
+
#
|
26
|
+
#. extract
|
27
|
+
#: reference1
|
28
|
+
#: reference2
|
29
|
+
#, flag
|
30
|
+
#| msgctxt "previous context"
|
31
|
+
#| msgid ""
|
32
|
+
#| "multiline\n"
|
33
|
+
#|"previous messageid"
|
34
|
+
#| msgid_plural "previous msgid_plural"
|
35
|
+
msgctxt "Context"
|
36
|
+
msgid "msgid"
|
37
|
+
msgid_plural ""
|
38
|
+
"multiline msgid_plural\n"
|
39
|
+
""
|
40
|
+
msgstr[0] "msgstr 0"
|
41
|
+
msgstr[1] ""
|
42
|
+
"msgstr 1 multiline 1\n"
|
43
|
+
"msgstr 1 line 2\n"
|
44
|
+
msgstr[2] "msgstr 2"
|
45
|
+
|
46
|
+
# translator-comment
|
47
|
+
#. extract
|
48
|
+
#: reference1
|
49
|
+
#~ msgctxt "Context"
|
50
|
+
#~ msgid "msgid"
|
51
|
+
#~ msgstr "translated"
|
@@ -2,12 +2,16 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe SimplePoParser do
|
4
4
|
let(:po_file) { Pathname.new('spec/simple_po_parser/fixtures/complete_file.po').realpath }
|
5
|
+
let(:crlf_file) { Pathname.new('spec/simple_po_parser/fixtures/crlf_encoded.po').realpath }
|
5
6
|
let(:non_ascii_file) { Pathname.new('spec/simple_po_parser/fixtures/non_ascii_file.po').realpath }
|
6
7
|
let(:po_complex_message) { File.read(File.expand_path("fixtures/complex_entry.po", __dir__))}
|
7
8
|
|
8
9
|
it "parses a po file" do
|
9
10
|
expect(SimplePoParser.parse(po_file)).to be_a_kind_of Array
|
10
11
|
end
|
12
|
+
it "parses crlf encoded files" do
|
13
|
+
expect(SimplePoParser.parse(crlf_file)).to be_a_kind_of Array
|
14
|
+
end
|
11
15
|
|
12
16
|
it "parses a non ascii po file" do
|
13
17
|
expect(SimplePoParser.parse(non_ascii_file)).to be_a_kind_of Array
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_po_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dennis-Florian Herr
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -46,6 +46,7 @@ executables: []
|
|
46
46
|
extensions: []
|
47
47
|
extra_rdoc_files: []
|
48
48
|
files:
|
49
|
+
- ".gitattributes"
|
49
50
|
- ".gitignore"
|
50
51
|
- ".rspec"
|
51
52
|
- ".travis.yml"
|
@@ -62,6 +63,7 @@ files:
|
|
62
63
|
- simple_po_parser.gemspec
|
63
64
|
- spec/simple_po_parser/fixtures/complete_file.po
|
64
65
|
- spec/simple_po_parser/fixtures/complex_entry.po
|
66
|
+
- spec/simple_po_parser/fixtures/crlf_encoded.po
|
65
67
|
- spec/simple_po_parser/fixtures/header.po
|
66
68
|
- spec/simple_po_parser/fixtures/non_ascii_file.po
|
67
69
|
- spec/simple_po_parser/fixtures/simple_entry.po
|
@@ -90,13 +92,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
90
92
|
version: '0'
|
91
93
|
requirements: []
|
92
94
|
rubyforge_project:
|
93
|
-
rubygems_version: 2.6
|
95
|
+
rubygems_version: 2.7.6
|
94
96
|
signing_key:
|
95
97
|
specification_version: 4
|
96
98
|
summary: A simple PO file to ruby hash parser
|
97
99
|
test_files:
|
98
100
|
- spec/simple_po_parser/fixtures/complete_file.po
|
99
101
|
- spec/simple_po_parser/fixtures/complex_entry.po
|
102
|
+
- spec/simple_po_parser/fixtures/crlf_encoded.po
|
100
103
|
- spec/simple_po_parser/fixtures/header.po
|
101
104
|
- spec/simple_po_parser/fixtures/non_ascii_file.po
|
102
105
|
- spec/simple_po_parser/fixtures/simple_entry.po
|