gettext 3.3.1 → 3.3.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/doc/text/news.md +217 -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/tools/task.rb +1 -0
  9. data/lib/gettext/version.rb +1 -1
  10. data/po/bg/gettext.edit.po +14 -6
  11. data/po/bg/gettext.po +9 -3
  12. data/po/bs/gettext.edit.po +14 -6
  13. data/po/bs/gettext.po +9 -3
  14. data/po/ca/gettext.edit.po +14 -6
  15. data/po/ca/gettext.po +9 -3
  16. data/po/cs/gettext.edit.po +14 -6
  17. data/po/cs/gettext.po +9 -3
  18. data/po/de/gettext.edit.po +14 -6
  19. data/po/de/gettext.po +9 -3
  20. data/po/el/gettext.edit.po +14 -6
  21. data/po/el/gettext.po +9 -3
  22. data/po/eo/gettext.edit.po +14 -6
  23. data/po/eo/gettext.po +9 -3
  24. data/po/es/gettext.edit.po +14 -6
  25. data/po/es/gettext.po +9 -3
  26. data/po/et/gettext.edit.po +14 -6
  27. data/po/et/gettext.po +9 -3
  28. data/po/fr/gettext.edit.po +14 -6
  29. data/po/fr/gettext.po +9 -3
  30. data/po/gettext.pot +17 -9
  31. data/po/hr/gettext.edit.po +14 -6
  32. data/po/hr/gettext.po +9 -3
  33. data/po/hu/gettext.edit.po +14 -6
  34. data/po/hu/gettext.po +9 -3
  35. data/po/it/gettext.edit.po +14 -6
  36. data/po/it/gettext.po +9 -3
  37. data/po/ja/gettext.edit.po +14 -6
  38. data/po/ja/gettext.po +9 -3
  39. data/po/ko/gettext.edit.po +14 -6
  40. data/po/ko/gettext.po +9 -3
  41. data/po/lv/gettext.edit.po +14 -6
  42. data/po/lv/gettext.po +9 -3
  43. data/po/nb/gettext.edit.po +14 -6
  44. data/po/nb/gettext.po +9 -3
  45. data/po/nl/gettext.edit.po +14 -6
  46. data/po/nl/gettext.po +9 -3
  47. data/po/pt_BR/gettext.edit.po +14 -6
  48. data/po/pt_BR/gettext.po +9 -3
  49. data/po/ru/gettext.edit.po +14 -6
  50. data/po/ru/gettext.po +9 -3
  51. data/po/sr/gettext.edit.po +14 -6
  52. data/po/sr/gettext.po +9 -3
  53. data/po/sv/gettext.edit.po +14 -6
  54. data/po/sv/gettext.po +9 -3
  55. data/po/uk/gettext.edit.po +14 -6
  56. data/po/uk/gettext.po +9 -3
  57. data/po/vi/gettext.edit.po +14 -6
  58. data/po/vi/gettext.po +9 -3
  59. data/po/zh/gettext.edit.po +14 -6
  60. data/po/zh/gettext.po +9 -3
  61. data/po/zh_TW/gettext.edit.po +14 -6
  62. data/po/zh_TW/gettext.po +9 -3
  63. data/test/fixtures/_/percent_strings.rb +9 -0
  64. data/test/fixtures/_/pipe.rb +32 -0
  65. data/test/fixtures/erb/minus.rhtml +12 -0
  66. data/test/fixtures/gtk_builder_ui_definitions.ui~ +68 -0
  67. data/test/fixtures/ruby/percent_I.rb +1 -0
  68. data/test/fixtures/ruby/percent_W.rb +1 -0
  69. data/test/fixtures/ruby/percent_i.rb +1 -0
  70. data/test/fixtures/ruby/percent_w.rb +1 -0
  71. data/test/po/_.pot +11 -3
  72. data/test/run-test.rb +0 -1
  73. data/test/test_parser.rb +7 -0
  74. data/test/tools/parser/test_ruby.rb +52 -2
  75. metadata +21 -29
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d22629a729714a92e020579fcf8b6958a81f167a5c8126971383584f4cf20767
4
- data.tar.gz: 01cd63601bbe76f52566d20015be66891e02022ce5c02691350a5d2da3980f6f
3
+ metadata.gz: e644842bf5dd767497cbcb53f5ad651604e709bc4a484e460bfd8d2e1040b1cd
4
+ data.tar.gz: 798048056cf35d51a238480448139a4316fab5decaa26f161add7c1cd53e91e3
5
5
  SHA512:
6
- metadata.gz: 071e7bc118369c5eaffb4b7ba1653572e22a007fb4035e2620ad3bf3c152dd5fe25fafe0c8404b78fade0af264125fd716fc3fd8fa0bd3a70815837a63cc2587
7
- data.tar.gz: 7d725646addcf0a3c3dd5460dac0dc8adfe0211190cc91164e25232a9dd392c3903fd98f55feb31ad824e3a6fa23e19202ef2e9b7fa519fbdc1b6aee91887563
6
+ metadata.gz: 81e13f5f41667f9885f27b65ad6179151b7c25fdf05e7ac49964d45827e0725fa72bc7b40a6e0a52e69a5a86f46c98f2efb36eb606796636bf407072b372ad01
7
+ data.tar.gz: 887292f88d3bf9baef49bbf2af55082689b889010a1328f69ec2387b65abf346b348080b5932ac7dd3393c39d5f2a79e9d375fc48c89d28e8ba242cb54f5b95c
@@ -1,5 +1,68 @@
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
+
55
+ ## 3.3.2: 2020-01-13 {#version-3-3-2}
56
+
57
+ ### Fixes
58
+
59
+ * Fixed a bug that `rake gettext:po:add]` raises an error.
60
+ [GitHub#70][Patch by KITAITI Makoto]
61
+
62
+ ### Thanks
63
+
64
+ * KITAITI Makoto
65
+
3
66
  ## 3.3.1: 2020-01-12 {#version-3-3-1}
4
67
 
5
68
  ### Improvements
@@ -806,3 +869,157 @@ Ruby 1.9 support release.
806
869
  * Gunnar Wolf
807
870
  * Ivan Pirlik
808
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
 
@@ -455,6 +455,7 @@ module GetText
455
455
  "'rake #{_task.name}[${LOCALE}]' or " +
456
456
  "rake #{_task.name} LOCALE=${LOCALE}'"
457
457
  end
458
+ define_edit_po_file_task(locale)
458
459
  define_po_file_task(locale)
459
460
  path = create_path(locale)
460
461
  Rake::Task[path.po_file].invoke