Skip to content

Commit 084279d

Browse files
committed
CI test prior to release
1 parent 26ed9d6 commit 084279d

File tree

10 files changed

+393
-154
lines changed

10 files changed

+393
-154
lines changed

.META/SOURCE.cdx.json

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
{
2+
"$schema": "http://cyclonedx.org/schema/bom-1.6.schema.json",
3+
"bomFormat": "CycloneDX",
4+
"specVersion": "1.6",
5+
"version": 1,
6+
"metadata": {
7+
"timestamp": "2025-08-03T12:36:11+00:00",
8+
"lifecycles": [
9+
{
10+
"phase": "pre-build"
11+
}
12+
],
13+
"authors": [
14+
{
15+
"bom-ref": "AlexanderKiryuhin",
16+
"name": "Alexander Kiryuhin"
17+
},
18+
{
19+
"bom-ref": "JonathanWorthington",
20+
"name": "Jonathan Worthington>"
21+
}
22+
],
23+
"component": {
24+
"type": "library",
25+
"mime-type": "text/plain",
26+
"bom-ref": "pkg:raku/zef:raku-community-modules/[email protected]",
27+
"authors": [
28+
{
29+
"bom-ref": "AlexanderKiryuhin",
30+
"name": "Alexander Kiryuhin"
31+
},
32+
{
33+
"bom-ref": "JonathanWorthington",
34+
"name": "Jonathan Worthington>"
35+
}
36+
],
37+
"publisher": "zef",
38+
"group": "zef:raku-community-modules",
39+
"name": "POFile",
40+
"version": "0.8",
41+
"description": "manipulating data in gettext PO files",
42+
"scope": "required",
43+
"licenses": [
44+
{
45+
"license": {
46+
"id": "Artistic-2.0",
47+
"acknowledgement": "declared",
48+
"url": "https://spdx.org/licenses/Artistic-2.0.json"
49+
}
50+
}
51+
],
52+
"purl": "pkg:raku/zef:raku-community-modules/[email protected]",
53+
"externalReferences": [
54+
{
55+
"url": "https://raku.land/zef:raku-community-modules/POFile?v=0.8",
56+
"type": "documentation"
57+
},
58+
{
59+
"url": "https://spdx.org/licenses/Artistic-2.0.json",
60+
"type": "license"
61+
}
62+
],
63+
"tags": [
64+
"GETTEXT",
65+
"I18N"
66+
]
67+
},
68+
"licenses": [
69+
{
70+
"license": {
71+
"id": "Artistic-2.0",
72+
"acknowledgement": "declared",
73+
"url": "https://spdx.org/licenses/Artistic-2.0.json"
74+
}
75+
}
76+
],
77+
"tools": {
78+
"components": [
79+
{
80+
"type": "library",
81+
"mime-type": "text/plain",
82+
"bom-ref": "pkg:raku/zef:lizmat/SBOM::[email protected]",
83+
"authors": [
84+
{
85+
"bom-ref": "ElizabethMattijsen",
86+
"name": "Elizabeth Mattijsen"
87+
}
88+
],
89+
"publisher": "zef",
90+
"group": "zef:lizmat",
91+
"name": "SBOM::Raku",
92+
"version": "0.0.6",
93+
"description": "Raku specific SBOM functionality",
94+
"scope": "required",
95+
"licenses": [
96+
{
97+
"license": {
98+
"id": "Artistic-2.0",
99+
"acknowledgement": "declared",
100+
"url": "https://spdx.org/licenses/Artistic-2.0.json"
101+
}
102+
}
103+
],
104+
"purl": "pkg:raku/zef:lizmat/SBOM::[email protected]",
105+
"externalReferences": [
106+
{
107+
"url": "https://raku.land/zef:lizmat/SBOM::Raku?v=0.0.6",
108+
"type": "documentation"
109+
},
110+
{
111+
"url": "mailto:[email protected]",
112+
"type": "support"
113+
},
114+
{
115+
"url": "https://github.com/lizmat/SBOM-Raku/issues",
116+
"type": "issue-tracker"
117+
},
118+
{
119+
"url": "https://github.com/lizmat/SBOM-Raku",
120+
"type": "distribution"
121+
},
122+
{
123+
"url": "https://github.com/lizmat/SBOM-Raku/archive/refs/tags/0.0.6.zip",
124+
"type": "source-distribution"
125+
},
126+
{
127+
"url": "https://spdx.org/licenses/Artistic-2.0.json",
128+
"type": "license"
129+
}
130+
],
131+
"tags": [
132+
"SBOM",
133+
"RAKU",
134+
"META"
135+
]
136+
}
137+
]
138+
}
139+
},
140+
"externalReferences": [
141+
{
142+
"url": "https://raku.land/zef:raku-community-modules/POFile?v=0.8",
143+
"type": "documentation"
144+
},
145+
{
146+
"url": "https://spdx.org/licenses/Artistic-2.0.json",
147+
"type": "license"
148+
}
149+
]
150+
}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ Session.vim
1616
*~
1717
# Vim auto-generated tag files
1818
tags
19+
*.rakucov

Changes

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
Revision history for actions
1+
Revision history for POFile
22

33
{{$NEXT}}
4+
- Add coverage tests (still incomplete)
5+
- Update copyright year
46

57
0.8 2024-11-07T13:04:51+01:00
68
- Initial version as a Raku Community Module

META6.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,24 @@
1212
"license": "Artistic-2.0",
1313
"meta-version": "0",
1414
"name": "POFile",
15-
"perl": "6.c",
15+
"production": true,
1616
"provides": {
1717
"POFile": "lib/POFile.rakumod"
1818
},
19+
"raku": "6.c",
1920
"resources": [
2021
],
2122
"source-url": "https://github.com/raku-community-modules/POFile.git",
2223
"support": {
24+
"bugtracker": "https://github.com/raku-community-modules/POFile/issues",
25+
"email": "[email protected]",
26+
"source": "https://github.com/raku-community-modules/POFile.git"
2327
},
2428
"tags": [
2529
"GETTEXT",
2630
"I18N"
2731
],
2832
"test-depends": [
2933
],
30-
"version": "0.8"
34+
"version": "0.9"
3135
}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ COPYRIGHT AND LICENSE
106106

107107
Copyright 2018 - 2020 Edument AB
108108

109-
Copyright 2024 The Raku Community
109+
Copyright 2024, 2025 The Raku Community
110110

111111
This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.
112112

dist.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = POFile
22

33
[ReadmeFromPod]
4-
filename = lib/POFile.rakumod
4+
filename = doc/POFile.rakudoc
55

66
[UploadToZef]
77

doc/POFile.rakudoc

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
=begin pod
2+
3+
=head1 NAME
4+
5+
POFile - manipulating data in gettext PO files
6+
7+
=head1 SYNOPSIS
8+
9+
=begin code :lang<raku>
10+
11+
use POFile;
12+
my $po = POFile.load('foo.po');
13+
14+
say $po.obsolete-messages; # list of obsolete messages
15+
say $po[0]; # POFile::Entry object at 0 index
16+
say $po{'Splash text'}; # POFile::Entry object with msgid C<Splash textC<
17+
for @$po -> $item {
18+
say $item.reference; # 'finddialog.cpp:38'
19+
say $item.msgstr; # msgstr value
20+
$item.msgstr = update($item.msgstr); # Do some update
21+
}
22+
$po.save('foo-updated.po');
23+
24+
=end code
25+
26+
=head1 DESCRIPTION
27+
28+
The C<.po> file as a whole is represented by the C<POFile> class,
29+
which holds a C<POFile::Entry> object per entry in the PO file.
30+
31+
=head2 POFile::Entry
32+
33+
The C<POFile::Entry> class represents a single record in PO file,
34+
and has its fields as attributes: C<msgid>, C<msgid-plural>,
35+
C<msgstr>, C<msgctxt>, C<reference> (reference comment),
36+
C<extracted> (extracted comment), C<comment> (translator comment),
37+
C<format-style>, C<fuzzy-msgid>, C<fuzzy-msgctxt>. All these
38+
attributes are set read/write.
39+
40+
You can create a single C<POFile::Entry> object from a C<Str>
41+
using the C<POFile::Entry.parse($str)> method.
42+
43+
The C<msgid> and C<msgstr> accessors always provided unquoted
44+
values; the methods C<msgid-quoted> and C<msgstr-quoted> are present
45+
to provide access to the quoted messages.
46+
47+
The value of C<msgstr> attribute might be either C<Str> or C<Array>,
48+
and is based on value of C<msgid-plural> attribute:
49+
50+
=begin code :lang<raku>
51+
52+
with $po.msgid-plural {
53+
say $po.msgid; # Singular form
54+
say $_; # Plural form
55+
for $po.msgstr -> $form {
56+
say $form; # Every plural form of end language
57+
}
58+
}
59+
60+
=end code
61+
62+
You can serialize an entry with C<Str> method or its C<~> shortcut:
63+
64+
=begin code :lang<raku>
65+
66+
my $po-entry = $po[1]; # Get second entry
67+
say ~$po-entry; # Serialized 1
68+
say $po-entry.Str; # Serialized 2
69+
70+
=end code
71+
72+
Note that B<no line wrapping> is done by the module.
73+
74+
=head2 POFile
75+
76+
C<POFile> provides access to C<POFile::Entry> objects using either
77+
index (position in original file) or key (msgid value).
78+
79+
It must be noted that this module provides hash-like access by msgid,
80+
which might B<not> be unique. Please consider that I<only array access>
81+
is stable in this case. Use hash access you know I<for sure> there
82+
are no items with the same C<msgid>, yet different C<msgctxt>.
83+
84+
The C<POFile> object also contains all obsolete messages, which cani
85+
be accessed using C<obsolete-messages> attribute.
86+
87+
You can create from scratch a new C<POFile> object and populate it with
88+
entries, as well as delete entries by id or by key:
89+
90+
=begin code :lang<raku>
91+
92+
my $po = POFile.new;
93+
@$po.push(POFile::Entry.parse(...));
94+
@$po.push(POFile::Entry.parse(...));
95+
$po[0]:delete;
96+
$po{'my msgid'}:delete;
97+
98+
=end code
99+
100+
As well as C<POFile::Entry>, you can serialize a C<POFile> object
101+
calling C<Str> method on it.
102+
103+
=head2 Escaping
104+
105+
Additionally, two routines are available to escape and unescape
106+
strings accordingly to rules described for PO format.
107+
108+
=begin code :lang<raku>
109+
110+
use POFile :quoting;
111+
112+
say po-unquote(「\t\"\\\n」); # 「\t"\\n」 <- unquoting
113+
say po-quote(「\t"\\n\」); # 「\t\"\\\n\\」 <- quoting
114+
115+
=end code
116+
117+
=head1 AUTHORS
118+
119+
=item Alexander Kiryuhin
120+
=item Jonathan Worthington
121+
122+
Source can be located at: https://github.com/raku-community-modules/POFile .
123+
Comments and Pull Requests are welcome.
124+
125+
=head1 COPYRIGHT AND LICENSE
126+
127+
Copyright 2018 - 2020 Edument AB
128+
129+
Copyright 2024, 2025 The Raku Community
130+
131+
This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.
132+
133+
=end pod
134+
135+
# vim: expandtab shiftwidth=4

0 commit comments

Comments
 (0)