gettextpo 0.1.0
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 +7 -0
- data/.clang-format +1 -0
- data/.dir-locals.el +5 -0
- data/.envrc +11 -0
- data/.rdoc_options +6 -0
- data/CHANGELOG.md +7 -0
- data/COPYING +674 -0
- data/README.md +105 -0
- data/Rakefile +37 -0
- data/ext/gettextpo/extconf.rb +29 -0
- data/ext/gettextpo/gettextpo.c +945 -0
- data/ext/gettextpo/gettextpo.h +23 -0
- data/lib/gettextpo/version.rb +22 -0
- data/lib/gettextpo.rb +56 -0
- data/sample.rb +22 -0
- data/sig/gettextpo.rbs +4 -0
- metadata +63 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (C) 2026 gemmaro
|
|
3
|
+
*
|
|
4
|
+
* This program is free software: you can redistribute it and/or modify
|
|
5
|
+
* it under the terms of the GNU General Public License as published by
|
|
6
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
7
|
+
* (at your option) any later version.
|
|
8
|
+
*
|
|
9
|
+
* This program is distributed in the hope that it will be useful,
|
|
10
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
* GNU General Public License for more details.
|
|
13
|
+
*
|
|
14
|
+
* You should have received a copy of the GNU General Public License
|
|
15
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
#ifndef GETTEXTPO_H
|
|
19
|
+
#define GETTEXTPO_H 1
|
|
20
|
+
|
|
21
|
+
#include "ruby.h"
|
|
22
|
+
|
|
23
|
+
#endif /* GETTEXTPO_H */
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
#--
|
|
4
|
+
# Copyright (C) 2026 gemmaro
|
|
5
|
+
#
|
|
6
|
+
# This program is free software: you can redistribute it and/or modify
|
|
7
|
+
# it under the terms of the GNU General Public License as published by
|
|
8
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
# (at your option) any later version.
|
|
10
|
+
#
|
|
11
|
+
# This program is distributed in the hope that it will be useful,
|
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
# GNU General Public License for more details.
|
|
15
|
+
#
|
|
16
|
+
# You should have received a copy of the GNU General Public License
|
|
17
|
+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
18
|
+
#++
|
|
19
|
+
|
|
20
|
+
module GettextPO
|
|
21
|
+
VERSION = "0.1.0"
|
|
22
|
+
end
|
data/lib/gettextpo.rb
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Copyright (C) 2026 gemmaro
|
|
4
|
+
#
|
|
5
|
+
# This program is free software: you can redistribute it and/or modify
|
|
6
|
+
# it under the terms of the GNU General Public License as published by
|
|
7
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
8
|
+
# (at your option) any later version.
|
|
9
|
+
#
|
|
10
|
+
# This program is distributed in the hope that it will be useful,
|
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
# GNU General Public License for more details.
|
|
14
|
+
#
|
|
15
|
+
# You should have received a copy of the GNU General Public License
|
|
16
|
+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
+
|
|
18
|
+
require_relative "gettextpo/version"
|
|
19
|
+
require_relative "gettextpo/gettextpo"
|
|
20
|
+
|
|
21
|
+
# The main entrypoints to parse PO files are GettextPO::File.new and
|
|
22
|
+
# GettextPO::File.read.
|
|
23
|
+
module GettextPO
|
|
24
|
+
class Error < StandardError; end
|
|
25
|
+
|
|
26
|
+
# This class doesn't provide the +new+ class method. Refre to
|
|
27
|
+
# GettextPO::MessageIterator#next or
|
|
28
|
+
# GettextPO::MessageIterator#insert.
|
|
29
|
+
class Message
|
|
30
|
+
private_class_method :new
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# This class doesn't provide the +new+ class method. See also
|
|
34
|
+
# GettextPO::File#message_iterator.
|
|
35
|
+
class MessageIterator
|
|
36
|
+
private_class_method :new
|
|
37
|
+
|
|
38
|
+
def each # yields: message
|
|
39
|
+
while true
|
|
40
|
+
begin
|
|
41
|
+
yield self.next
|
|
42
|
+
rescue StopIteration
|
|
43
|
+
return self
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
include Enumerable
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# This class doesn't provide the +new+ class method. See also
|
|
52
|
+
# GettextPO::Message#filepos.
|
|
53
|
+
class FilePos
|
|
54
|
+
private_class_method :new
|
|
55
|
+
end
|
|
56
|
+
end
|
data/sample.rb
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Copyright (C) 2026 gemmaro
|
|
2
|
+
#
|
|
3
|
+
# This program is free software: you can redistribute it and/or modify
|
|
4
|
+
# it under the terms of the GNU General Public License as published by
|
|
5
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
6
|
+
# (at your option) any later version.
|
|
7
|
+
#
|
|
8
|
+
# This program is distributed in the hope that it will be useful,
|
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11
|
+
# GNU General Public License for more details.
|
|
12
|
+
#
|
|
13
|
+
# You should have received a copy of the GNU General Public License
|
|
14
|
+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
15
|
+
|
|
16
|
+
$LOAD_PATH.unshift File.expand_path("lib", __dir__)
|
|
17
|
+
require "gettextpo"
|
|
18
|
+
|
|
19
|
+
po_path = File.join(__dir__, "test/resources/ok.po")
|
|
20
|
+
GettextPO::File.read(po_path).message_iterator.each do |message|
|
|
21
|
+
pp({ source: message.msgid, translation: message.msgstr })
|
|
22
|
+
end
|
data/sig/gettextpo.rbs
ADDED
metadata
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: gettextpo
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- gemmaro
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies: []
|
|
12
|
+
description: This gem is a Ruby library for the GNU gettext PO files. This is a C
|
|
13
|
+
binding of the libgettextpo library, which is part of the GNU gettext package.
|
|
14
|
+
email:
|
|
15
|
+
- gemmaro.dev@gmail.com
|
|
16
|
+
executables: []
|
|
17
|
+
extensions:
|
|
18
|
+
- ext/gettextpo/extconf.rb
|
|
19
|
+
extra_rdoc_files: []
|
|
20
|
+
files:
|
|
21
|
+
- ".clang-format"
|
|
22
|
+
- ".dir-locals.el"
|
|
23
|
+
- ".envrc"
|
|
24
|
+
- ".rdoc_options"
|
|
25
|
+
- CHANGELOG.md
|
|
26
|
+
- COPYING
|
|
27
|
+
- README.md
|
|
28
|
+
- Rakefile
|
|
29
|
+
- ext/gettextpo/extconf.rb
|
|
30
|
+
- ext/gettextpo/gettextpo.c
|
|
31
|
+
- ext/gettextpo/gettextpo.h
|
|
32
|
+
- lib/gettextpo.rb
|
|
33
|
+
- lib/gettextpo/version.rb
|
|
34
|
+
- sample.rb
|
|
35
|
+
- sig/gettextpo.rbs
|
|
36
|
+
homepage: https://git.disroot.org/gemmaro/ruby-gettextpo
|
|
37
|
+
licenses:
|
|
38
|
+
- GPL-3.0-or-later
|
|
39
|
+
metadata:
|
|
40
|
+
rubygems_mfa_required: 'true'
|
|
41
|
+
bug_tracker_uri: https://git.disroot.org/gemmaro/ruby-gettextpo/issues
|
|
42
|
+
changelog_uri: https://git.disroot.org/gemmaro/ruby-gettextpo/src/branch/main/CHANGELOG.md
|
|
43
|
+
homepage_uri: https://git.disroot.org/gemmaro/ruby-gettextpo
|
|
44
|
+
source_code_uri: https://git.disroot.org/gemmaro/ruby-gettextpo
|
|
45
|
+
wiki_uri: https://git.disroot.org/gemmaro/ruby-gettextpo/wiki
|
|
46
|
+
rdoc_options: []
|
|
47
|
+
require_paths:
|
|
48
|
+
- lib
|
|
49
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
50
|
+
requirements:
|
|
51
|
+
- - ">="
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: 3.1.0
|
|
54
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
55
|
+
requirements:
|
|
56
|
+
- - ">="
|
|
57
|
+
- !ruby/object:Gem::Version
|
|
58
|
+
version: '0'
|
|
59
|
+
requirements: []
|
|
60
|
+
rubygems_version: 3.6.9
|
|
61
|
+
specification_version: 4
|
|
62
|
+
summary: GNU gettext PO file parser library
|
|
63
|
+
test_files: []
|