gettext 3.4.7 → 3.4.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/doc/text/news.md +22 -0
- data/lib/gettext/po_entry.rb +5 -4
- data/lib/gettext/po_parser.rb +7 -3
- data/lib/gettext/version.rb +3 -3
- data/po/gettext.pot +3 -3
- data/src/po_parser.ry +7 -3
- data/test/test_po_entry.rb +14 -0
- data/test/test_po_parser.rb +6 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 935189b8e4a67d110df2c1e21b89bab5f70057772c31861d58c1d71935e4ace3
|
4
|
+
data.tar.gz: ee204b53fee909a7a23921a814fc3046312fe8fc6f3f576b7b883a2920896d02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a91c277a26e46db88ff1d67c85a2d0932a22cf0043d74cec373119dea8431614dfd35a2ddaef7ed18b557c07bdd27b60c3e8bf6fe79e7da80e42160f30883786
|
7
|
+
data.tar.gz: 00cd6a8ba2be7a06b9b9c7d5d8cc6e5f92bfbe768a32237dfcb029a105cd1b6508db88fb8988027c639d7bc385f43246d79513d5d4cc912d5e632ecbb5014c28
|
data/README.md
CHANGED
@@ -244,11 +244,11 @@ n_(fruits, 3)
|
|
244
244
|
|
245
245
|
### Interpolating translations
|
246
246
|
|
247
|
-
This is not a feature of gettext but worth noting. You can interpolate translated strings
|
247
|
+
This is not a feature of gettext but worth noting. You can interpolate translated strings with the ruby String `%` operator.
|
248
248
|
|
249
249
|
```ruby
|
250
250
|
N_("active"); N_("inactive"); N_("paused") # possible value of status for parser to find.
|
251
|
-
_("Your account is
|
251
|
+
_("Your account is %{account_state}.") % { account_state: _(status) }
|
252
252
|
```
|
253
253
|
|
254
254
|
|
data/doc/text/news.md
CHANGED
@@ -1,5 +1,27 @@
|
|
1
1
|
# News
|
2
2
|
|
3
|
+
## 3.4.8: 2023-10-22 {#version-3-4-8}
|
4
|
+
|
5
|
+
### Fixes
|
6
|
+
|
7
|
+
* doc: Fixed a wrong description for interpolation.
|
8
|
+
* GH-102
|
9
|
+
* Patch by Ilmari Karonen
|
10
|
+
|
11
|
+
* po: Fixed a parser bug that flags aren't parsed correctly. If a
|
12
|
+
normal comment has "fuzzy", the entry is also treated as a fuzzy
|
13
|
+
entry.
|
14
|
+
|
15
|
+
* po: Fixed an output bug that flags aren't formatted correctly.
|
16
|
+
* GH-105
|
17
|
+
* Patch by Yoshikazu Nojima
|
18
|
+
|
19
|
+
### Thanks
|
20
|
+
|
21
|
+
* Ilmari Karonen
|
22
|
+
|
23
|
+
* Yoshikazu Nojima
|
24
|
+
|
3
25
|
## 3.4.7: 2023-08-17 {#version-3-4-7}
|
4
26
|
|
5
27
|
### Fixes
|
data/lib/gettext/po_entry.rb
CHANGED
@@ -428,11 +428,12 @@ module GetText
|
|
428
428
|
end
|
429
429
|
|
430
430
|
def format_flag_comment
|
431
|
-
|
432
|
-
|
433
|
-
|
431
|
+
if @entry.flags.empty?
|
432
|
+
String.new
|
433
|
+
else
|
434
|
+
joined_flags = @entry.flags.join(", ")
|
435
|
+
format_comment(FLAG_MARK, joined_flags)
|
434
436
|
end
|
435
|
-
formatted_flags
|
436
437
|
end
|
437
438
|
|
438
439
|
def format_previous_comment
|
data/lib/gettext/po_parser.rb
CHANGED
@@ -161,7 +161,11 @@ module_eval(<<'...end po_parser.ry/module_eval...', 'po_parser.ry', 126)
|
|
161
161
|
end
|
162
162
|
|
163
163
|
def on_comment(comment)
|
164
|
-
|
164
|
+
if comment.start_with?(POFormat::FLAG_MARK)
|
165
|
+
content = comment[POFormat::FLAG_MARK.size..-1]
|
166
|
+
flags = parse_flags_line(content)
|
167
|
+
@fuzzy = true if flags.include?("fuzzy")
|
168
|
+
end
|
165
169
|
if @data.instance_of?(PO)
|
166
170
|
if comment == "#"
|
167
171
|
@translator_comments << ""
|
@@ -176,7 +180,7 @@ module_eval(<<'...end po_parser.ry/module_eval...', 'po_parser.ry', 126)
|
|
176
180
|
when POFormat::REFERENCE_COMMENT_MARK
|
177
181
|
@references.concat(parse_references_line(content))
|
178
182
|
when POFormat::FLAG_MARK
|
179
|
-
@flags.concat(
|
183
|
+
@flags.concat(flags)
|
180
184
|
when POFormat::PREVIOUS_COMMENT_MARK
|
181
185
|
@previous << content
|
182
186
|
else
|
@@ -245,7 +249,7 @@ module_eval(<<'...end po_parser.ry/module_eval...', 'po_parser.ry', 126)
|
|
245
249
|
end
|
246
250
|
|
247
251
|
def parse_flags_line(line)
|
248
|
-
line.split(
|
252
|
+
line.split(",").collect(&:strip)
|
249
253
|
end
|
250
254
|
|
251
255
|
def clear
|
data/lib/gettext/version.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
=begin
|
2
2
|
version - version information of gettext
|
3
3
|
|
4
|
-
Copyright (C) 2012-2023
|
5
|
-
Copyright (C) 2005-2009
|
4
|
+
Copyright (C) 2012-2023 Sutou Kouhei <kou@clear-code.com>
|
5
|
+
Copyright (C) 2005-2009 Masao Mutoh
|
6
6
|
|
7
7
|
You may redistribute it and/or modify it under the same
|
8
8
|
license terms as Ruby or LGPL.
|
9
9
|
=end
|
10
10
|
|
11
11
|
module GetText
|
12
|
-
VERSION = "3.4.
|
12
|
+
VERSION = "3.4.8"
|
13
13
|
end
|
data/po/gettext.pot
CHANGED
@@ -6,10 +6,10 @@
|
|
6
6
|
#, fuzzy
|
7
7
|
msgid ""
|
8
8
|
msgstr ""
|
9
|
-
"Project-Id-Version: gettext 3.4.
|
9
|
+
"Project-Id-Version: gettext 3.4.8\n"
|
10
10
|
"Report-Msgid-Bugs-To: \n"
|
11
|
-
"POT-Creation-Date: 2023-
|
12
|
-
"PO-Revision-Date: 2023-
|
11
|
+
"POT-Creation-Date: 2023-10-22 06:20+0900\n"
|
12
|
+
"PO-Revision-Date: 2023-10-22 06:20+0900\n"
|
13
13
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
14
14
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
15
15
|
"Language: \n"
|
data/src/po_parser.ry
CHANGED
@@ -264,7 +264,11 @@ require "gettext/po"
|
|
264
264
|
end
|
265
265
|
|
266
266
|
def on_comment(comment)
|
267
|
-
|
267
|
+
if comment.start_with?(POFormat::FLAG_MARK)
|
268
|
+
content = comment[POFormat::FLAG_MARK.size..-1]
|
269
|
+
flags = parse_flags_line(content)
|
270
|
+
@fuzzy = flags.include?("fuzzy")
|
271
|
+
end
|
268
272
|
if @data.instance_of?(PO)
|
269
273
|
if comment == "#"
|
270
274
|
@translator_comments << ""
|
@@ -279,7 +283,7 @@ require "gettext/po"
|
|
279
283
|
when POFormat::REFERENCE_COMMENT_MARK
|
280
284
|
@references.concat(parse_references_line(content))
|
281
285
|
when POFormat::FLAG_MARK
|
282
|
-
@flags.concat(
|
286
|
+
@flags.concat(flags)
|
283
287
|
when POFormat::PREVIOUS_COMMENT_MARK
|
284
288
|
@previous << content
|
285
289
|
else
|
@@ -348,7 +352,7 @@ require "gettext/po"
|
|
348
352
|
end
|
349
353
|
|
350
354
|
def parse_flags_line(line)
|
351
|
-
line.split(
|
355
|
+
line.split(",").collect(&:strip)
|
352
356
|
end
|
353
357
|
|
354
358
|
def clear
|
data/test/test_po_entry.rb
CHANGED
@@ -344,6 +344,20 @@ EOP
|
|
344
344
|
assert_equal(expected_po, entry.to_s)
|
345
345
|
end
|
346
346
|
|
347
|
+
def test_multiple_flags
|
348
|
+
entry = GetText::POEntry.new(:normal)
|
349
|
+
entry.msgid = "msgid"
|
350
|
+
entry.msgstr = "msgstr"
|
351
|
+
entry.flags = ["It's the flag.", "fuzzy"]
|
352
|
+
|
353
|
+
expected_po = <<-EOP
|
354
|
+
#, It's the flag., fuzzy
|
355
|
+
msgid "msgid"
|
356
|
+
msgstr "msgstr"
|
357
|
+
EOP
|
358
|
+
assert_equal(expected_po, entry.to_s)
|
359
|
+
end
|
360
|
+
|
347
361
|
def test_previous
|
348
362
|
entry = GetText::POEntry.new(:normal)
|
349
363
|
entry.msgid = "msgid"
|
data/test/test_po_parser.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gettext
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.4.
|
4
|
+
version: 3.4.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kouhei Sutou
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-
|
12
|
+
date: 2023-10-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: erubi
|