get_pomo 0.9.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/get_pomo/mo_file.rb +14 -1
- data/lib/get_pomo/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c897e4c401b28aa314eede193fe8049bbfda547
|
4
|
+
data.tar.gz: 9094ad42ddc70756e4479aca396678ad5aacb189
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8f4e54f584563a167d87c918cf1852fa85abd5811298318882622d03a5b3e19b1017d6ab042cdd7ec2f1a92c182fb361b61589ee3db3d155130879d56912236
|
7
|
+
data.tar.gz: ff7bcadc05a310bfa38545c770809b87f8720db6ef22f680a26b9715e77c3cf3578d58bf7268114695a69b9f8bcd68f03c800d358dd38f7b236c9187e56a3b27
|
data/lib/get_pomo/mo_file.rb
CHANGED
@@ -4,6 +4,7 @@ require File.join(File.dirname(__FILE__),'..','..','vendor','mofile')
|
|
4
4
|
module GetPomo
|
5
5
|
class MoFile
|
6
6
|
PLURAL_SEPARATOR = "\000"
|
7
|
+
CONTEXT_SEPARATOR = "\u0004"
|
7
8
|
|
8
9
|
def self.parse(text)
|
9
10
|
MoFile.new.add_translations_from_text(text)
|
@@ -24,6 +25,11 @@ module GetPomo
|
|
24
25
|
text = StringIO.new(text)
|
25
26
|
@translations += GetPomo::GetText::MOFile.open(text, "UTF-8").map do |msgid,msgstr|
|
26
27
|
translation = Translation.new
|
28
|
+
|
29
|
+
if msgid.include? CONTEXT_SEPARATOR
|
30
|
+
translation.msgctxt, msgid = msgid.split CONTEXT_SEPARATOR, 2
|
31
|
+
end
|
32
|
+
|
27
33
|
if plural? msgid or plural? msgstr
|
28
34
|
translation.msgid = split_plural(msgid)
|
29
35
|
translation.msgstr = split_plural(msgstr)
|
@@ -31,13 +37,20 @@ module GetPomo
|
|
31
37
|
translation.msgid = msgid
|
32
38
|
translation.msgstr = msgstr
|
33
39
|
end
|
40
|
+
|
34
41
|
translation
|
35
42
|
end
|
36
43
|
end
|
37
44
|
|
38
45
|
def to_text
|
39
46
|
m = GetPomo::GetText::MOFile.new
|
40
|
-
GetPomo.unique_translations(translations).each
|
47
|
+
GetPomo.unique_translations(translations).each do |t|
|
48
|
+
key = plural_to_string(t.msgid)
|
49
|
+
if msgctxt = t.msgctxt
|
50
|
+
key = "#{msgctxt}#{CONTEXT_SEPARATOR}#{key}"
|
51
|
+
end
|
52
|
+
m[key] = plural_to_string(t.msgstr)
|
53
|
+
end
|
41
54
|
|
42
55
|
io = StringIO.new
|
43
56
|
m.save_to_stream io
|
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.
|
4
|
+
version: 1.0.0
|
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: 2017-09-05 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email: michael@grosser.it
|
@@ -34,17 +34,17 @@ require_paths:
|
|
34
34
|
- lib
|
35
35
|
required_ruby_version: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- -
|
37
|
+
- - ">="
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version:
|
39
|
+
version: 2.0.0
|
40
40
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
41
41
|
requirements:
|
42
|
-
- -
|
42
|
+
- - ">="
|
43
43
|
- !ruby/object:Gem::Version
|
44
44
|
version: '0'
|
45
45
|
requirements: []
|
46
46
|
rubyforge_project:
|
47
|
-
rubygems_version: 2.
|
47
|
+
rubygems_version: 2.5.1
|
48
48
|
signing_key:
|
49
49
|
specification_version: 4
|
50
50
|
summary: 'Ruby/Gettext: A .po and .mo file parser/generator'
|