gettext 3.3.2 → 3.3.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/doc/text/news.md +206 -0
  3. data/gettext.gemspec +0 -1
  4. data/lib/gettext/locale_path.rb +12 -8
  5. data/lib/gettext/tools/parser/erb.rb +9 -1
  6. data/lib/gettext/tools/parser/gtk_builder_ui_definitions.rb +0 -3
  7. data/lib/gettext/tools/parser/ruby.rb +50 -23
  8. data/lib/gettext/version.rb +1 -1
  9. data/po/bg/gettext.edit.po +14 -6
  10. data/po/bg/gettext.po +9 -3
  11. data/po/bs/gettext.edit.po +14 -6
  12. data/po/bs/gettext.po +9 -3
  13. data/po/ca/gettext.edit.po +14 -6
  14. data/po/ca/gettext.po +9 -3
  15. data/po/cs/gettext.edit.po +14 -6
  16. data/po/cs/gettext.po +9 -3
  17. data/po/de/gettext.edit.po +14 -6
  18. data/po/de/gettext.po +9 -3
  19. data/po/el/gettext.edit.po +14 -6
  20. data/po/el/gettext.po +9 -3
  21. data/po/eo/gettext.edit.po +14 -6
  22. data/po/eo/gettext.po +9 -3
  23. data/po/es/gettext.edit.po +14 -6
  24. data/po/es/gettext.po +9 -3
  25. data/po/et/gettext.edit.po +14 -6
  26. data/po/et/gettext.po +9 -3
  27. data/po/fr/gettext.edit.po +14 -6
  28. data/po/fr/gettext.po +9 -3
  29. data/po/gettext.pot +17 -9
  30. data/po/hr/gettext.edit.po +14 -6
  31. data/po/hr/gettext.po +9 -3
  32. data/po/hu/gettext.edit.po +14 -6
  33. data/po/hu/gettext.po +9 -3
  34. data/po/it/gettext.edit.po +14 -6
  35. data/po/it/gettext.po +9 -3
  36. data/po/ja/gettext.edit.po +14 -6
  37. data/po/ja/gettext.po +9 -3
  38. data/po/ko/gettext.edit.po +14 -6
  39. data/po/ko/gettext.po +9 -3
  40. data/po/lv/gettext.edit.po +14 -6
  41. data/po/lv/gettext.po +9 -3
  42. data/po/nb/gettext.edit.po +14 -6
  43. data/po/nb/gettext.po +9 -3
  44. data/po/nl/gettext.edit.po +14 -6
  45. data/po/nl/gettext.po +9 -3
  46. data/po/pt_BR/gettext.edit.po +14 -6
  47. data/po/pt_BR/gettext.po +9 -3
  48. data/po/ru/gettext.edit.po +14 -6
  49. data/po/ru/gettext.po +9 -3
  50. data/po/sr/gettext.edit.po +14 -6
  51. data/po/sr/gettext.po +9 -3
  52. data/po/sv/gettext.edit.po +14 -6
  53. data/po/sv/gettext.po +9 -3
  54. data/po/uk/gettext.edit.po +14 -6
  55. data/po/uk/gettext.po +9 -3
  56. data/po/vi/gettext.edit.po +14 -6
  57. data/po/vi/gettext.po +9 -3
  58. data/po/zh/gettext.edit.po +14 -6
  59. data/po/zh/gettext.po +9 -3
  60. data/po/zh_TW/gettext.edit.po +14 -6
  61. data/po/zh_TW/gettext.po +9 -3
  62. data/test/fixtures/_/percent_strings.rb +9 -0
  63. data/test/fixtures/_/pipe.rb +32 -0
  64. data/test/fixtures/erb/minus.rhtml +12 -0
  65. data/test/fixtures/gtk_builder_ui_definitions.ui~ +68 -0
  66. data/test/fixtures/ruby/percent_I.rb +1 -0
  67. data/test/fixtures/ruby/percent_W.rb +1 -0
  68. data/test/fixtures/ruby/percent_i.rb +1 -0
  69. data/test/fixtures/ruby/percent_w.rb +1 -0
  70. data/test/run-test.rb +0 -1
  71. data/test/test_parser.rb +7 -0
  72. data/test/tools/parser/test_ruby.rb +52 -2
  73. metadata +21 -29
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2f6b8ac74bbe41d5b0a942c489cdc9d4c99ccde14e4e8fd7332168e85c0711c9
4
- data.tar.gz: 6644e0c768ad64cc2e6339809953bbcab6198b5fed86d7fb84d76d97b74f3850
3
+ metadata.gz: e644842bf5dd767497cbcb53f5ad651604e709bc4a484e460bfd8d2e1040b1cd
4
+ data.tar.gz: 798048056cf35d51a238480448139a4316fab5decaa26f161add7c1cd53e91e3
5
5
  SHA512:
6
- metadata.gz: b3cc2e18fcb5e68a66678d359a325b3af5c4b74a9cea7a595066022984c172cefacafd9272cb688167b4eab09bc21f9acede3f6ee567feb1ce6344dc0448ce98
7
- data.tar.gz: 71995c31d3eba398f1680295fa59c4c00454306460522a962ebd2107c36c80320395ee63d1883dc331ca4c8455b8147d65efc451f81f16a20844a1934718c351
6
+ metadata.gz: 81e13f5f41667f9885f27b65ad6179151b7c25fdf05e7ac49964d45827e0725fa72bc7b40a6e0a52e69a5a86f46c98f2efb36eb606796636bf407072b372ad01
7
+ data.tar.gz: 887292f88d3bf9baef49bbf2af55082689b889010a1328f69ec2387b65abf346b348080b5932ac7dd3393c39d5f2a79e9d375fc48c89d28e8ba242cb54f5b95c
@@ -1,5 +1,57 @@
1
1
  # News
2
2
 
3
+ ## 3.3.6: 2020-08-04 {#version-3-3-6}
4
+
5
+ ### Improvements
6
+
7
+ * erb: Added support for `-%>`.
8
+ [GitHub#77][Reported by lremes]
9
+
10
+ * Removed ChangeLog.
11
+ [GitHub#76][Reported by Will Stephenson]
12
+
13
+ * Don't assume `RbConfig::CONFIG["datadir"]` is available. For
14
+ example, TruffleRuby doesn't provide it.
15
+
16
+ ### Thanks
17
+
18
+ * lremes
19
+
20
+ * Will Stephenson
21
+
22
+ ## 3.3.5: 2020-02-15 {#version-3-3-5}
23
+
24
+ ### Improvements
25
+
26
+ * Added support for `|` method.
27
+ [GitHub#73][Reported by dorle-o]
28
+
29
+ ### Thanks
30
+
31
+ * dorle-o
32
+
33
+ ## 3.3.4: 2020-02-12 {#version-3-3-4}
34
+
35
+ ### Improvements
36
+
37
+ * Added support for `%W`.
38
+ [GitHub#72][Reported by Michaël Hoste]
39
+
40
+ ### Thanks
41
+
42
+ * Michaël Hoste
43
+
44
+ ## 3.3.3: 2020-02-05 {#version-3-3-3}
45
+
46
+ ### Improvements
47
+
48
+ * Added support for `%I`.
49
+ [GitHub#71][Reported by Kai Ramuenke]
50
+
51
+ ### Thanks
52
+
53
+ * Kai Ramuenke
54
+
3
55
  ## 3.3.2: 2020-01-13 {#version-3-3-2}
4
56
 
5
57
  ### Fixes
@@ -817,3 +869,157 @@ Ruby 1.9 support release.
817
869
  * Gunnar Wolf
818
870
  * Ivan Pirlik
819
871
  * Tatsuki Sugiura
872
+
873
+ ## 2.2.1: 2012-05-20
874
+
875
+ ### Changes
876
+
877
+ * Supported non ASCII string in msgid. [GitHub#1]
878
+ [Patch by Urban Hafner]
879
+ * Stopped overriding String#% on Ruby 1.9.
880
+ * Fixed a bug that "\" is too escaped.
881
+ * Removed GetText.bindtext dependency from GetText::PoParser.
882
+ * Ranamed GetText::MOFile to GetText::MoFile but GetText::MOFile
883
+ is still available.
884
+
885
+ ### Thanks
886
+
887
+ * Urban Hafner
888
+
889
+ ## 2.2.0: 2012-03-11
890
+
891
+ ### Changes
892
+
893
+ * Supported ruby-1.9. [Patch by hallelujah]
894
+ * Supported $SAFE=1. [Patch by bon]
895
+ * Improved argument check. [Suggested by Morus Walter]
896
+ * Supported ruby-1.8.6 again. [Bug#27447] [Reported by Mamoru Tasaka]
897
+ * Fixed Ukrainan translation path. [Bug#28277] [Reported by Gunnar Wolf]
898
+ * Fixed a bug that only the last path in GETTEXT_PATH environment
899
+ variable is used. [Bug#28345] [Reported by Ivan Pirlik]
900
+ * Fixed a bug that Ruby-GetText-Package modifies $LOAD_PATH. [Bug#28094]
901
+ [Reported by Tatsuki Sugiura]
902
+
903
+ ### Thanks
904
+
905
+ * hallelujah
906
+ * bon
907
+ * Morus Walter
908
+ * Mamoru Tasaka
909
+ * Gunnar Wolf
910
+ * Ivan Pirlik
911
+ * Tatsuki Sugiura
912
+
913
+
914
+ ## 2.1.0: 2009-11-14
915
+
916
+ ### Changes
917
+
918
+ * Implemented parsing of translator comments (GNU gettext feature)
919
+ [by Vladimir Dobriakov]
920
+ * Refactor the directory structure.
921
+ * Move files for runtime to lib/gettext/runtime/*.
922
+ * Move files for development(rgettext/rmsgfmt) to
923
+ lib/gettext/tools/*.
924
+ * Refactor parsers for po. po-message object is defined as GetText::PoMessage
925
+ class. [by Vladimir Dobriakov, Masao Mutoh]
926
+ * Speed up when lots of objects are created to share the textdomain in each
927
+ objects. [Reported by Gaël Séchaud.]
928
+ * Fix "%{foo.bar}" %{"foo.bar".to_sym => "a"} doesn't work.
929
+ [Bug#26663, Reported by Danilo Castilho]
930
+ * lib/gettext.rb: Fixed to work unless gem. [Reported by Vladimir Dobriakov]
931
+ * Fixed a wrong String literal in a CGI sample.
932
+ [Bug #26531, by Eugene Mikhailov]
933
+ * Update license information(explicit to use ruby's or LGPL).
934
+ [Pointed out by Masateru Yoshikawa]
935
+ * Code cleanup.
936
+ * Update minor version.
937
+
938
+ ## 2.0.4: 2009-05-23
939
+
940
+ ### Changes
941
+
942
+ * Fix String#% return nil when the string have no place holders. [by okkez]
943
+ * Update pofiles and remove old messages.
944
+ * suppress some warnings on Ruby 1.9.x. [by Nobuhiro IMAI]
945
+ * Fix not to run tests on Win32.
946
+
947
+ ## 2.0.3: 2009-05-09
948
+
949
+ ### Changes
950
+
951
+ * Fixed the dependencies. [Reported by Hans de Graaff]
952
+
953
+ ## 2.0.2: 2009-05-04
954
+
955
+ ### Changes
956
+
957
+ * Support ruby-1.9.1 style format string such as `%<foo>d`.
958
+ * Apply new `Locale.set_app_language_tags` and Locale.candidates.
959
+ [Suggested by Vladimir Dobriakov]
960
+ * Enhance to support ruby-1.9.x [by OZAWA Sakuro]
961
+ * poparser work with proper encoding.
962
+ * string.rb: #bytesize alias to #size in older ruby version such as 1.8.5.
963
+ * Fixed bugs
964
+ * `n_()` to work when Plural-Forms line in po-file is not correct.
965
+ [Reported by Sava Chankov (Bug#25570)]
966
+ * GetText::Locale.default_rules_path : $LOAD_PATH is not well parsed.
967
+ [by hallelujah]
968
+ * locale_path.rb: Fixed warning message.
969
+
970
+ ### Thanks
971
+
972
+ * hallelujah
973
+ * Sava Chankov
974
+ * OZAWA Sakuro
975
+ * Vladimir Dobriakov
976
+
977
+ ## 2.0.1: 2009-04-17
978
+
979
+ ### Changes
980
+
981
+ * Fixed bugs
982
+ * doesn't work with ruby-1.8.5. [Reported by Dan Coutu]
983
+ * GetText.locale= can't keep the locale. [Reported by Adam Ilan]
984
+ * Break backward compatibility of bindtextdomain
985
+ [Reported by Mamoru Tasaka(#24947), Mathieu Blondel]
986
+ * Other trivial fixes/improvement.
987
+ * 1.8 times faster than 2.0.0.
988
+ * GetText::LocalePath is separated from GetText::TextDomainManager.
989
+ Improve to find the locale path.
990
+ * Enhance to support ruby-1.9.x [by OZAWA Sakuro]
991
+
992
+ ### Thanks
993
+
994
+ * OZAWA Sakuro
995
+ * Tietew
996
+ * Adam Ilan
997
+ * Mamoru Tasaka
998
+ * Mathieu Blondel
999
+
1000
+ ## 2.0.0: 2009-03-21
1001
+
1002
+ ### Changes
1003
+
1004
+ * Separate this library to locale and rails-support to locale,
1005
+ locale\_rails, gettext\_activerecord, gettext\_rails.
1006
+ * Depends on locale(ruby-locale).
1007
+ * Removes to support rails.
1008
+ * A lot of referctoring, improvements.
1009
+ * Thread safe.
1010
+ * New APIs for gettext/tools instead of gettext/utils.
1011
+ * Move to github.com.
1012
+
1013
+ ### Special thanks
1014
+
1015
+ * Michael Grosser: A lot of improvement.
1016
+
1017
+ ### Thanks
1018
+
1019
+ * Tietew
1020
+ * Kazuhiro NISHIYAMA
1021
+ * Fabio M.A.
1022
+ * Tuptus
1023
+ * Morus Walter
1024
+ * Vladimir Dobriakov
1025
+ * Ramsey
@@ -36,7 +36,6 @@ So you can use GNU gettext tools for maintaining.
36
36
  s.add_development_dependency("yard")
37
37
  s.add_development_dependency("kramdown")
38
38
  s.add_development_dependency("test-unit")
39
- s.add_development_dependency("test-unit-notify")
40
39
  s.add_development_dependency("test-unit-rr")
41
40
  s.license = "Ruby or LGPLv3+"
42
41
  end
@@ -17,14 +17,18 @@ module GetText
17
17
  class LocalePath
18
18
  # The default locale paths.
19
19
  CONFIG_PREFIX = RbConfig::CONFIG['prefix'].gsub(/\/local/, "")
20
- DEFAULT_RULES = [
21
- "./locale/%{lang}/LC_MESSAGES/%{name}.mo",
22
- "./locale/%{lang}/%{name}.mo",
23
- "#{RbConfig::CONFIG['datadir']}/locale/%{lang}/LC_MESSAGES/%{name}.mo",
24
- "#{RbConfig::CONFIG['datadir'].gsub(/\/local/, "")}/locale/%{lang}/LC_MESSAGES/%{name}.mo",
25
- "#{CONFIG_PREFIX}/share/locale/%{lang}/LC_MESSAGES/%{name}.mo",
26
- "#{CONFIG_PREFIX}/local/share/locale/%{lang}/LC_MESSAGES/%{name}.mo"
27
- ].uniq
20
+ default_rules_candidates = [
21
+ "./locale/%{lang}/LC_MESSAGES/%{name}.mo",
22
+ "./locale/%{lang}/%{name}.mo",
23
+ ]
24
+ data_dir = RbConfig::CONFIG["datadir"]
25
+ if data_dir
26
+ default_rules_candidates << "#{data_dir}/locale/%{lang}/LC_MESSAGES/%{name}.mo"
27
+ default_rules_candidates << "#{data_dir.gsub(/\/local/, "")}/locale/%{lang}/LC_MESSAGES/%{name}.mo"
28
+ end
29
+ default_rules_candidates << "#{CONFIG_PREFIX}/share/locale/%{lang}/LC_MESSAGES/%{name}.mo"
30
+ default_rules_candidates << "#{CONFIG_PREFIX}/local/share/locale/%{lang}/LC_MESSAGES/%{name}.mo"
31
+ DEFAULT_RULES = default_rules_candidates.uniq
28
32
 
29
33
  class << self
30
34
  # Add default locale path. Usually you should use GetText.add_default_locale_path instead.
@@ -57,12 +57,20 @@ module GetText
57
57
  @options = options
58
58
  end
59
59
 
60
+ @@erb_accept_keyword_arguments =
61
+ ERB.instance_method(:initialize).parameters.any? {|type, _| type == :key}
62
+
60
63
  # Extracts messages from @path.
61
64
  #
62
65
  # @return [Array<POEntry>] Extracted messages
63
66
  def parse
64
67
  content = IO.read(@path)
65
- src = ERB.new(content).src
68
+ if @@erb_accept_keyword_arguments
69
+ erb = ERB.new(content, trim_mode: "-")
70
+ else
71
+ erb = ERB.new(content, nil, "-")
72
+ end
73
+ src = erb.src
66
74
 
67
75
  # Force the src encoding back to the encoding in magic comment
68
76
  # or original content.
@@ -50,9 +50,6 @@ module GetText
50
50
  end
51
51
  end
52
52
 
53
- TARGET1 = /<property.*translatable="yes">(.*)/
54
- TARGET2 = /(.*)<\/property>/
55
-
56
53
  def initialize(path, options={})
57
54
  @path = path
58
55
  @options = options
@@ -28,9 +28,9 @@ module GetText
28
28
  attr_accessor :comment_tag
29
29
  def initialize(*args)
30
30
  super(*args)
31
+ @start_block = false
31
32
  @in_block_arguments = false
32
33
  @ignore_next_comma = false
33
- @context_stack = []
34
34
  @need_definition_name = false
35
35
  @current_po_entry = nil
36
36
  @current_po_entry_nth_attribute = 0
@@ -43,28 +43,31 @@ module GetText
43
43
  end
44
44
 
45
45
  def process_on_op(token, po)
46
- @in_block_arguments = !@in_block_arguments if token == "|"
46
+ if @start_block
47
+ @in_block_arguments = (token == "|")
48
+ else
49
+ if @in_block_arguments and token == "|"
50
+ @in_block_arguments = false
51
+ end
52
+ end
47
53
  po
48
54
  end
49
55
 
50
56
  def process_on_kw(token, po)
51
57
  store_po_entry(po)
52
58
  case token
53
- when "begin", "case", "do", "for"
54
- @context_stack.push(token)
55
- when "class", "def", "module"
56
- @context_stack.push(token)
57
- when "if", "unless", "until", "while"
58
- # postfix case
59
- unless state.allbits?(Ripper::EXPR_LABEL)
60
- @context_stack.push(token)
61
- end
62
- when "end"
63
- @context_stack.pop
59
+ when "do"
60
+ @start_block = true
64
61
  end
65
62
  po
66
63
  end
67
64
 
65
+ def process_on_lbrace(token, po)
66
+ store_po_entry(po)
67
+ @start_block = (state == Ripper::EXPR_BEG)
68
+ po
69
+ end
70
+
68
71
  def process_on_ident(token, po)
69
72
  store_po_entry(po)
70
73
 
@@ -203,18 +206,18 @@ module GetText
203
206
  po
204
207
  end
205
208
 
206
- def process_on_embexpr_beg(token, po)
207
- @current_po_entry = nil
208
- @current_po_entry_nth_attribute = 0
209
- po
210
- end
211
-
212
209
  def process_on_regexp_end(token, po)
213
210
  @string_mark_stack.pop
214
211
  @string_stack.pop
215
212
  po
216
213
  end
217
214
 
215
+ def process_on_embexpr_beg(token, po)
216
+ @current_po_entry = nil
217
+ @current_po_entry_nth_attribute = 0
218
+ po
219
+ end
220
+
218
221
  def process_on_int(token, po)
219
222
  @ignore_next_comma = true
220
223
  po
@@ -253,12 +256,24 @@ module GetText
253
256
  po
254
257
  end
255
258
 
259
+ def process_on_symbols_beg(token, po)
260
+ @string_mark_stack << "\""
261
+ @string_stack << ""
262
+ po
263
+ end
264
+
256
265
  def process_on_qsymbols_beg(token, po)
257
266
  @string_mark_stack << token
258
267
  @string_stack << ""
259
268
  po
260
269
  end
261
270
 
271
+ def process_on_words_beg(token, po)
272
+ @string_mark_stack << "\""
273
+ @string_stack << ""
274
+ po
275
+ end
276
+
262
277
  def process_on_qwords_beg(token, po)
263
278
  @string_mark_stack << token
264
279
  @string_stack << ""
@@ -268,11 +283,14 @@ module GetText
268
283
  def on_default(event, token, po)
269
284
  trace(event, token) do
270
285
  process_method = "process_#{event}"
286
+ start_block = @start_block
271
287
  if respond_to?(process_method)
272
- __send__(process_method, token, po)
273
- else
274
- po
288
+ po = __send__(process_method, token, po)
289
+ end
290
+ if start_block and event != :on_sp
291
+ @start_block = false
275
292
  end
293
+ po
276
294
  end
277
295
  end
278
296
 
@@ -283,7 +301,16 @@ module GetText
283
301
  end
284
302
 
285
303
  def trace(event_name, token)
286
- pp [event_name, token, state, @context_stack.last] if debug?
304
+ if debug?
305
+ status = [
306
+ event_name,
307
+ token,
308
+ state,
309
+ ]
310
+ status << :start_block if @start_block
311
+ status << :in_block_arguments if @in_block_arguments
312
+ pp status
313
+ end
287
314
  yield
288
315
  end
289
316
 
@@ -9,5 +9,5 @@
9
9
  =end
10
10
 
11
11
  module GetText
12
- VERSION = "3.3.2"
12
+ VERSION = "3.3.6"
13
13
  end
@@ -342,7 +342,7 @@ msgid ""
342
342
  "Hello %{world}\n"
343
343
  msgstr ""
344
344
 
345
- #: ../samples/hello2.rb:20
345
+ #: ../samples/hello2.rb:20 ../test/fixtures/_/pipe.rb:28
346
346
  msgid "World"
347
347
  msgstr ""
348
348
 
@@ -541,10 +541,22 @@ msgid ""
541
541
  "one new line\n"
542
542
  msgstr ""
543
543
 
544
- #: ../test/fixtures/_/percent_strings.rb:34
544
+ #: ../test/fixtures/_/percent_strings.rb:31
545
+ msgid "in_symbol_array"
546
+ msgstr ""
547
+
548
+ #: ../test/fixtures/_/percent_strings.rb:39
545
549
  msgid "hello world"
546
550
  msgstr ""
547
551
 
552
+ #: ../test/fixtures/_/percent_strings.rb:47
553
+ msgid "in_string_array"
554
+ msgstr ""
555
+
556
+ #: ../test/fixtures/_/pipe.rb:26 ../test/fixtures/hello.rb:26
557
+ msgid "Hello"
558
+ msgstr ""
559
+
548
560
  #: ../test/fixtures/backslash.rb:27
549
561
  msgid "You should escape '\\' as '\\\\'."
550
562
  msgstr ""
@@ -578,10 +590,6 @@ msgstr ""
578
590
  msgid "duplicated"
579
591
  msgstr ""
580
592
 
581
- #: ../test/fixtures/hello.rb:26
582
- msgid "Hello"
583
- msgstr ""
584
-
585
593
  #: ../test/fixtures/lower_n_.rb:33
586
594
  msgid ""
587
595
  "bbb\n"