PoParser 1.0.2 → 1.0.3
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/CHANGELOG.md +3 -0
- data/README.md +7 -3
- data/lib/poparser/entry.rb +2 -1
- data/lib/poparser/po.rb +10 -0
- data/lib/poparser/version.rb +1 -1
- data/spec/poparser/entry_spec.rb +1 -0
- data/spec/poparser/po_spec.rb +7 -0
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8036d5aecfd813ef156edec1a8595a2351757e62
|
4
|
+
data.tar.gz: c5ae7091bcd9688b6222ef1b0f184092bd47fbd3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57d9bc1dce5ff0212d027de02621ab56a6e1f4e32a8ccec4df69d3e053457d571029098e820cb0117e7d9fc524deb9e8a0db106ceaea16a2a2b335f267ca7f22
|
7
|
+
data.tar.gz: efcd02494737acea74a7a773d4cd551daec9ce83d5bb672e8f72e6cf08a04d095486f95460b2d88f40d6050a611f138f5300729a8fe68c3d08038186486f84db
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -38,9 +38,8 @@ The `parse` method returns a `PO` object which contains all `Entries`:
|
|
38
38
|
# get all entries
|
39
39
|
po.entries # or .all alias
|
40
40
|
|
41
|
-
# including cached entries (started with "#~"
|
42
|
-
#
|
43
|
-
# not counted as active entries)
|
41
|
+
# including cached/obsolete entries (started with "#~")
|
42
|
+
# more info: https://www.gnu.org/software/gettext/manual/html_node/Obsolete-Entries.html
|
44
43
|
po.entries(true)
|
45
44
|
|
46
45
|
# get all fuzzy entries
|
@@ -52,6 +51,9 @@ po.untranslated
|
|
52
51
|
# get all translated entries
|
53
52
|
po.translated
|
54
53
|
|
54
|
+
# get all cached/obsolete entries
|
55
|
+
po.cached # or .obsolete alias
|
56
|
+
|
55
57
|
# returns a hash representation of the PO file
|
56
58
|
po.to_h
|
57
59
|
|
@@ -124,6 +126,8 @@ entry.fuzzy?
|
|
124
126
|
#=> true
|
125
127
|
entry.plural?
|
126
128
|
#=> false
|
129
|
+
entry.cached? # or .obsolete?
|
130
|
+
#=> false
|
127
131
|
```
|
128
132
|
|
129
133
|
You can get or edit each property of the `Entry`:
|
data/lib/poparser/entry.rb
CHANGED
@@ -27,6 +27,7 @@ module PoParser
|
|
27
27
|
def cached?
|
28
28
|
!@cached.nil?
|
29
29
|
end
|
30
|
+
alias_method :obsolete?, :cached?
|
30
31
|
|
31
32
|
# Checks if the entry is untraslated
|
32
33
|
#
|
@@ -71,7 +72,7 @@ module PoParser
|
|
71
72
|
self
|
72
73
|
end
|
73
74
|
|
74
|
-
# Set flag to a
|
75
|
+
# Set flag to a custom string
|
75
76
|
def flag_as(flag)
|
76
77
|
raise ArgumentError if flag.class != String
|
77
78
|
@flag = flag
|
data/lib/poparser/po.rb
CHANGED
@@ -78,6 +78,16 @@ module PoParser
|
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
81
|
+
# Finds all cached entries
|
82
|
+
#
|
83
|
+
# @return [Array] an array of cached entries
|
84
|
+
def cached
|
85
|
+
find_all do |entry|
|
86
|
+
entry.cached?
|
87
|
+
end
|
88
|
+
end
|
89
|
+
alias_method :obsolete, :cached
|
90
|
+
|
81
91
|
# Count of all entries without counting cached entries
|
82
92
|
#
|
83
93
|
# @return [String]
|
data/lib/poparser/version.rb
CHANGED
data/spec/poparser/entry_spec.rb
CHANGED
data/spec/poparser/po_spec.rb
CHANGED
@@ -39,6 +39,13 @@ describe PoParser::Po do
|
|
39
39
|
expect(@po.untranslated.size).to eq 2
|
40
40
|
end
|
41
41
|
|
42
|
+
it 'returns all cached strings' do
|
43
|
+
entry2, entry3 = entry.dup, entry.dup
|
44
|
+
[entry2, entry3].each { |en| en[:cached] = 'test' }
|
45
|
+
@po << [entry, entry2, entry3]
|
46
|
+
expect(@po.cached.size).to eq 2
|
47
|
+
end
|
48
|
+
|
42
49
|
it 'shows stats' do
|
43
50
|
entry2, entry3, entry4 = entry.dup, entry.dup, entry.dup
|
44
51
|
[entry2, entry3].each { |en| en[:msgstr] = '' }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: PoParser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arash Mousavi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parslet
|
@@ -118,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
118
118
|
version: '0'
|
119
119
|
requirements: []
|
120
120
|
rubyforge_project:
|
121
|
-
rubygems_version: 2.6.
|
121
|
+
rubygems_version: 2.6.8
|
122
122
|
signing_key:
|
123
123
|
specification_version: 4
|
124
124
|
summary: A PO file parser, editor and generator.
|
@@ -140,4 +140,3 @@ test_files:
|
|
140
140
|
- spec/poparser/tokenizer_spec.rb
|
141
141
|
- spec/poparser/transformer_spec.rb
|
142
142
|
- spec/spec_helper.rb
|
143
|
-
has_rdoc:
|