gettext 2.1.0 → 2.2.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.
Files changed (148) hide show
  1. data/README.rdoc +10 -6
  2. data/Rakefile +15 -66
  3. data/data/locale/bg/LC_MESSAGES/rgettext.mo +0 -0
  4. data/data/locale/bs/LC_MESSAGES/rgettext.mo +0 -0
  5. data/data/locale/ca/LC_MESSAGES/rgettext.mo +0 -0
  6. data/data/locale/cs/LC_MESSAGES/rgettext.mo +0 -0
  7. data/data/locale/de/LC_MESSAGES/rgettext.mo +0 -0
  8. data/data/locale/el/LC_MESSAGES/rgettext.mo +0 -0
  9. data/data/locale/eo/LC_MESSAGES/rgettext.mo +0 -0
  10. data/data/locale/es/LC_MESSAGES/rgettext.mo +0 -0
  11. data/data/locale/et/LC_MESSAGES/rgettext.mo +0 -0
  12. data/data/locale/fr/LC_MESSAGES/rgettext.mo +0 -0
  13. data/data/locale/hr/LC_MESSAGES/rgettext.mo +0 -0
  14. data/data/locale/hu/LC_MESSAGES/rgettext.mo +0 -0
  15. data/data/locale/it/LC_MESSAGES/rgettext.mo +0 -0
  16. data/data/locale/ja/LC_MESSAGES/rgettext.mo +0 -0
  17. data/data/locale/ko/LC_MESSAGES/rgettext.mo +0 -0
  18. data/data/locale/lv/LC_MESSAGES/rgettext.mo +0 -0
  19. data/data/locale/nb/LC_MESSAGES/rgettext.mo +0 -0
  20. data/data/locale/nl/LC_MESSAGES/rgettext.mo +0 -0
  21. data/data/locale/pt_BR/LC_MESSAGES/rgettext.mo +0 -0
  22. data/data/locale/ru/LC_MESSAGES/rgettext.mo +0 -0
  23. data/data/locale/sr/LC_MESSAGES/rgettext.mo +0 -0
  24. data/data/locale/sv/LC_MESSAGES/rgettext.mo +0 -0
  25. data/data/locale/uk/LC_MESSAGES/rgettext.mo +0 -0
  26. data/data/locale/vi/LC_MESSAGES/rgettext.mo +0 -0
  27. data/data/locale/zh/LC_MESSAGES/rgettext.mo +0 -0
  28. data/data/locale/zh_TW/LC_MESSAGES/rgettext.mo +0 -0
  29. data/doc/text/news.md +30 -0
  30. data/gettext.gemspec +26 -34
  31. data/lib/gettext.rb +26 -24
  32. data/lib/gettext/cgi.rb +2 -0
  33. data/lib/gettext/core_ext/iconv.rb +7 -7
  34. data/lib/gettext/core_ext/string.rb +8 -6
  35. data/lib/gettext/parser/erb.rb +2 -0
  36. data/lib/gettext/parser/glade.rb +2 -0
  37. data/lib/gettext/parser/ruby.rb +12 -12
  38. data/lib/gettext/runtime/class_info.rb +5 -3
  39. data/lib/gettext/runtime/locale_path.rb +20 -22
  40. data/lib/gettext/runtime/mofile.rb +45 -18
  41. data/lib/gettext/runtime/textdomain.rb +6 -4
  42. data/lib/gettext/runtime/textdomain_group.rb +3 -1
  43. data/lib/gettext/runtime/textdomain_manager.rb +29 -26
  44. data/lib/gettext/tools.rb +15 -13
  45. data/lib/gettext/tools/parser/erb.rb +5 -3
  46. data/lib/gettext/tools/parser/glade.rb +16 -14
  47. data/lib/gettext/tools/parser/ruby.rb +16 -16
  48. data/lib/gettext/tools/pomessage.rb +9 -7
  49. data/lib/gettext/tools/poparser.rb +38 -36
  50. data/lib/gettext/tools/rgettext.rb +38 -13
  51. data/lib/gettext/tools/rmsgfmt.rb +7 -5
  52. data/lib/gettext/tools/rmsgmerge.rb +116 -114
  53. data/lib/gettext/utils.rb +2 -0
  54. data/lib/gettext/version.rb +3 -3
  55. data/po/bg/rgettext.po +17 -12
  56. data/po/bs/rgettext.po +16 -12
  57. data/po/ca/rgettext.po +17 -12
  58. data/po/cs/rgettext.po +16 -12
  59. data/po/de/rgettext.po +17 -12
  60. data/po/el/rgettext.po +17 -12
  61. data/po/eo/rgettext.po +17 -12
  62. data/po/es/rgettext.po +17 -12
  63. data/po/et/rgettext.po +17 -12
  64. data/po/fr/rgettext.po +17 -12
  65. data/po/hr/rgettext.po +19 -15
  66. data/po/hu/rgettext.po +17 -12
  67. data/po/it/rgettext.po +16 -12
  68. data/po/ja/rgettext.po +21 -15
  69. data/po/ko/rgettext.po +16 -12
  70. data/po/lv/rgettext.po +17 -12
  71. data/po/nb/rgettext.po +17 -12
  72. data/po/nl/rgettext.po +16 -12
  73. data/po/pt_BR/rgettext.po +17 -12
  74. data/po/rgettext.pot +16 -12
  75. data/po/ru/rgettext.po +17 -12
  76. data/po/sr/rgettext.po +17 -12
  77. data/po/sv/rgettext.po +16 -12
  78. data/po/{ua → uk}/rgettext.po +17 -12
  79. data/po/vi/rgettext.po +17 -12
  80. data/po/zh/rgettext.po +17 -12
  81. data/po/zh_TW/rgettext.po +17 -12
  82. data/samples/cgi/hellolib.rb +1 -1
  83. data/samples/cgi/http.rb +5 -5
  84. data/samples/cgi/locale/{ua → uk}/LC_MESSAGES/helloerb1.mo +0 -0
  85. data/samples/cgi/locale/{ua → uk}/LC_MESSAGES/helloerb2.mo +0 -0
  86. data/samples/cgi/locale/{ua → uk}/LC_MESSAGES/hellolib.mo +0 -0
  87. data/samples/cgi/locale/{ua → uk}/LC_MESSAGES/main.mo +0 -0
  88. data/samples/cgi/po/{ua → uk}/helloerb1.po +0 -0
  89. data/samples/cgi/po/{ua → uk}/helloerb2.po +0 -0
  90. data/samples/cgi/po/{ua → uk}/hellolib.po +0 -0
  91. data/samples/cgi/po/{ua → uk}/main.po +0 -0
  92. data/samples/hello.rb +1 -1
  93. data/samples/hello_gtk2.rb +1 -1
  94. data/samples/hello_noop.rb +1 -1
  95. data/samples/locale/{ua → uk}/LC_MESSAGES/hello.mo +0 -0
  96. data/samples/locale/{ua → uk}/LC_MESSAGES/hello2.mo +0 -0
  97. data/samples/locale/{ua → uk}/LC_MESSAGES/hello_glade2.mo +0 -0
  98. data/samples/locale/{ua → uk}/LC_MESSAGES/hello_gtk.mo +0 -0
  99. data/samples/locale/{ua → uk}/LC_MESSAGES/hello_noop.mo +0 -0
  100. data/samples/locale/{ua → uk}/LC_MESSAGES/hello_plural.mo +0 -0
  101. data/samples/locale/{ua → uk}/LC_MESSAGES/hello_tk.mo +0 -0
  102. data/samples/makemo.rb +2 -0
  103. data/samples/po/test.rb +2 -0
  104. data/samples/po/{ua → uk}/hello.po +0 -0
  105. data/samples/po/{ua → uk}/hello2.po +0 -0
  106. data/samples/po/{ua → uk}/hello_glade2.po +0 -0
  107. data/samples/po/{ua → uk}/hello_gtk.po +0 -0
  108. data/samples/po/{ua → uk}/hello_noop.po +0 -0
  109. data/samples/po/{ua → uk}/hello_plural.po +0 -0
  110. data/samples/po/{ua → uk}/hello_tk.po +0 -0
  111. data/test/Rakefile +1 -1
  112. data/test/test_class_info.rb +5 -0
  113. data/test/test_gettext.rb +12 -1
  114. data/test/test_locale_path.rb +29 -3
  115. data/test/test_parser.rb +61 -59
  116. data/test/test_po_generation.rb +3 -1
  117. data/test/test_pomessage.rb +4 -2
  118. data/test/test_string.rb +2 -0
  119. data/test/test_textdomain_bind.rb +2 -0
  120. data/test/test_textdomain_multi.rb +2 -0
  121. data/test/test_textdomain_toplevel.rb +2 -0
  122. data/test/test_thread.rb +4 -2
  123. data/test/testlib/N_.rb +5 -3
  124. data/test/testlib/gettext.rb +4 -2
  125. data/test/testlib/helper.rb +2 -0
  126. data/test/testlib/multi_textdomain.rb +2 -0
  127. data/test/testlib/ngettext.rb +10 -8
  128. data/test/testlib/npgettext.rb +9 -7
  129. data/test/testlib/nsgettext.rb +4 -2
  130. data/test/testlib/pgettext.rb +4 -2
  131. data/test/testlib/sgettext.rb +4 -2
  132. data/test/testlib/simple.rb +2 -0
  133. data/test/tools/files/simple_translation.rb +3 -1
  134. data/test/tools/test_tools.rb +3 -1
  135. metadata +772 -737
  136. data/ChangeLog +0 -78
  137. data/ChangeLog-1 +0 -2016
  138. data/NEWS-1 +0 -414
  139. data/benchmark/1.93.0.txt +0 -8
  140. data/benchmark/2.0.0.txt +0 -8
  141. data/benchmark/2.0.4.txt +0 -11
  142. data/benchmark/2.1.0.txt +0 -11
  143. data/benchmark/benchmark.rb +0 -68
  144. data/benchmark/test.rb +0 -28
  145. data/data/locale/ua/LC_MESSAGES/rgettext.mo +0 -0
  146. data/replace.rb +0 -8
  147. data/samples/cgi/po/bg/#main.po# +0 -84
  148. data/test.rb +0 -33
@@ -1,3 +1,5 @@
1
+ # encoding: utf-8
2
+
1
3
  =begin
2
4
  gettext/textdomain_group - GetText::TextDomainGroup class
3
5
 
@@ -12,7 +14,7 @@ module GetText
12
14
 
13
15
  class TextDomainGroup
14
16
  attr_reader :textdomains
15
-
17
+
16
18
  def initialize
17
19
  @textdomains = []
18
20
  end
@@ -1,3 +1,5 @@
1
+ # encoding: utf-8
2
+
1
3
  =begin
2
4
  gettext/textdomain_manager - GetText::TextDomainManager class
3
5
 
@@ -27,13 +29,13 @@ module GetText
27
29
  @@cached = ! $DEBUG
28
30
 
29
31
  extend self
30
-
32
+
31
33
  # Find textdomain by name
32
34
  def textdomain_pool(domainname)
33
35
  @@textdomain_pool[domainname]
34
36
  end
35
37
 
36
- # Set the value whether cache messages or not.
38
+ # Set the value whether cache messages or not.
37
39
  # true to cache messages, otherwise false.
38
40
  #
39
41
  # Default is true. If $DEBUG is false, messages are not checked even if
@@ -42,7 +44,7 @@ module GetText
42
44
  @@cached = val
43
45
  TextDomain.cached = val
44
46
  end
45
-
47
+
46
48
  # Return the cached value.
47
49
  def cached?
48
50
  TextDomain.cached?
@@ -50,9 +52,9 @@ module GetText
50
52
 
51
53
  # Gets the output charset.
52
54
  def output_charset
53
- @@output_charset
55
+ @@output_charset
54
56
  end
55
-
57
+
56
58
  # Sets the output charset.The program can have a output charset.
57
59
  def output_charset=(charset)
58
60
  @@output_charset = charset
@@ -60,7 +62,7 @@ module GetText
60
62
  textdomain.output_charset = charset
61
63
  end
62
64
  end
63
-
65
+
64
66
  # bind textdomain to the class.
65
67
  def bind_to(klass, domainname, options = {})
66
68
  warn "Bind the domain '#{domainname}' to '#{klass}'. " if $DEBUG
@@ -70,10 +72,10 @@ module GetText
70
72
  target_klass = ClassInfo.normalize_class(klass)
71
73
  create_or_find_textdomain_group(target_klass).add(textdomain)
72
74
  @@gettext_classes << target_klass unless @@gettext_classes.include? target_klass
73
-
75
+
74
76
  textdomain
75
77
  end
76
-
78
+
77
79
  def each_textdomains(klass) #:nodoc:
78
80
  lang = Locale.candidates[0]
79
81
  ClassInfo.related_classes(klass, @@gettext_classes).each do |target|
@@ -86,12 +88,12 @@ module GetText
86
88
  end
87
89
  end
88
90
 
89
- # Translates msgid, but if there are no localized text,
91
+ # Translates msgid, but if there are no localized text,
90
92
  # it returns a last part of msgid separeted "div" or whole of the msgid with no "div".
91
93
  #
92
94
  # * msgid: the message id.
93
95
  # * div: separator or nil.
94
- # * Returns: the localized text by msgid. If there are no localized text,
96
+ # * Returns: the localized text by msgid. If there are no localized text,
95
97
  # it returns a last part of msgid separeted "div".
96
98
  def translate_singluar_message(klass, msgid, div = nil)
97
99
  klass = ClassInfo.normalize_class(klass)
@@ -103,7 +105,7 @@ module GetText
103
105
  msg = textdomain.translate_singluar_message(lang, msgid)
104
106
  break if msg
105
107
  end
106
-
108
+
107
109
  # If not found, return msgid.
108
110
  msg ||= msgid
109
111
  if div and msg == msgid
@@ -113,15 +115,15 @@ module GetText
113
115
  end
114
116
  @@singular_message_cache[key] = msg
115
117
  end
116
-
117
- # This function is similar to the get_singluar_message function
118
- # as it finds the message catalogs in the same way.
118
+
119
+ # This function is similar to the get_singluar_message function
120
+ # as it finds the message catalogs in the same way.
119
121
  # But it takes two extra arguments for plural form.
120
- # The msgid parameter must contain the singular form of the string to be converted.
121
- # It is also used as the key for the search in the catalog.
122
- # The msgid_plural parameter is the plural form.
123
- # The parameter n is used to determine the plural form.
124
- # If no message catalog is found msgid1 is returned if n == 1, otherwise msgid2.
122
+ # The msgid parameter must contain the singular form of the string to be converted.
123
+ # It is also used as the key for the search in the catalog.
124
+ # The msgid_plural parameter is the plural form.
125
+ # The parameter n is used to determine the plural form.
126
+ # If no message catalog is found msgid1 is returned if n == 1, otherwise msgid2.
125
127
  # And if msgid includes "div", it returns a last part of msgid separeted "div".
126
128
  #
127
129
  # * msgid: the singular form with "div". (e.g. "Special|An apple", "An apple")
@@ -144,12 +146,13 @@ module GetText
144
146
  msgid_plural = arg1[1]
145
147
  n = arg2
146
148
  if arg3 and arg3.kind_of? Numeric
147
- raise ArgumentError, _("3rd parmeter is wrong: value = %{number}") % {:number => arg3}
149
+ raise ArgumentError, _("ngettext: 3rd parmeter is wrong: value = %{number}") % {:number => arg3}
148
150
  end
149
151
  div = arg3
150
152
  else
151
153
  msgid = arg1
152
154
  msgid_plural = arg2
155
+ raise ArgumentError, _("ngettext: 3rd parameter should be a number, not nil.") unless arg3
153
156
  n = arg3
154
157
  div = arg4
155
158
  end
@@ -163,16 +166,16 @@ module GetText
163
166
  msgs = textdomain.translate_plural_message(lang, msgid, msgid_plural)
164
167
  break if msgs
165
168
  end
166
-
169
+
167
170
  msgs = [[msgid, msgid_plural], TextDomain::DEFAULT_PLURAL_CALC] unless msgs
168
-
171
+
169
172
  msgstrs = msgs[0]
170
173
  if div and msgstrs[0] == msgid and index = msgstrs[0].rindex(div)
171
174
  msgstrs[0] = msgstrs[0][(index + 1)..-1]
172
175
  end
173
176
  @@plural_message_cache[key] = msgs
174
177
  end
175
-
178
+
176
179
  # Return the singular or plural message.
177
180
  msgstrs = msgs[0]
178
181
  plural = msgs[1].call(n)
@@ -197,14 +200,14 @@ module GetText
197
200
  def create_or_find_textdomain_group(klass) #:nodoc:
198
201
  group = @@textdomain_group_pool[klass]
199
202
  return group if group
200
-
203
+
201
204
  @@textdomain_group_pool[klass] = TextDomainGroup.new
202
205
  end
203
-
206
+
204
207
  def create_or_find_textdomain(name, path, charset)#:nodoc:
205
208
  textdomain = @@textdomain_pool[name]
206
209
  return textdomain if textdomain
207
-
210
+
208
211
  @@textdomain_pool[name] = TextDomain.new(name, path, charset)
209
212
  end
210
213
  end
data/lib/gettext/tools.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # encoding: utf-8
2
+
1
3
  =begin
2
4
  tools.rb - Utility functions
3
5
 
@@ -24,7 +26,7 @@ module GetText
24
26
 
25
27
  BOM_UTF8 = [0xef, 0xbb, 0xbf].pack("c3")
26
28
 
27
- # Currently, GNU msgmerge doesn't accept BOM.
29
+ # Currently, GNU msgmerge doesn't accept BOM.
28
30
  # This mesthod remove the UTF-8 BOM from the po-file.
29
31
  def remove_bom(path) #:nodoc:
30
32
  bom = IO.read(path, 3)
@@ -34,13 +36,13 @@ module GetText
34
36
  end
35
37
  end
36
38
 
37
- # Merges two Uniforum style .po files together.
39
+ # Merges two Uniforum style .po files together.
38
40
  #
39
- # *Note* This function requires "msgmerge" tool included in GNU GetText. So you need to install GNU GetText.
41
+ # *Note* This function requires "msgmerge" tool included in GNU GetText. So you need to install GNU GetText.
40
42
  #
41
- # The def.po file is an existing PO file with translations which will be taken
43
+ # The def.po file is an existing PO file with translations which will be taken
42
44
  # over to the newly created file as long as they still match; comments will be preserved,
43
- # but extracted comments and file positions will be discarded.
45
+ # but extracted comments and file positions will be discarded.
44
46
  #
45
47
  # The ref.pot file is the last created PO file with up-to-date source references but
46
48
  # old translations, or a PO Template file (generally created by rgettext);
@@ -53,14 +55,14 @@ module GetText
53
55
  # * defpo: a po-file. translations referring to old sources
54
56
  # * refpo: a po-file. references to new sources
55
57
  # * app_version: the application information which appears "Project-Id-Version: #{app_version}" in the pot/po-files.
56
- # * Returns: self
58
+ # * Returns: self
57
59
  def msgmerge(defpo, refpo, app_version, options={})
58
60
  verbose = options.delete(:verbose)
59
61
  puts "msgmerge called" if verbose
60
62
  $stderr.print defpo + " "
61
63
 
62
64
  content = merge_po_files(defpo,refpo,options.delete(:msgmerge),verbose)
63
-
65
+
64
66
  if content.empty?
65
67
  # report failure
66
68
  failed_filename = refpo + "~"
@@ -73,12 +75,12 @@ module GetText
73
75
  content.sub!(/(Project-Id-Version\:).*$/, "\\1 #{app_version}\\n\"")
74
76
  File.open(defpo, "w") {|f|f.write(content)}
75
77
  end
76
-
78
+
77
79
  self
78
80
  end
79
81
 
80
- # Creates mo-files using #{po_root}/#{lang}/*.po an put them to
81
- # #{targetdir}/#{targetdir_rule}/.
82
+ # Creates mo-files using #{po_root}/#{lang}/*.po an put them to
83
+ # #{targetdir}/#{targetdir_rule}/.
82
84
  #
83
85
  # This is a convenience function of GetText.rmsgfmt for multiple target files.
84
86
  # * options: options as a Hash.
@@ -101,9 +103,9 @@ module GetText
101
103
 
102
104
  # At first, this creates the #{po_root}/#{domainname}.pot file using GetText.rgettext.
103
105
  # In the second step, this updates(merges) the #{po_root}/#{domainname}.pot and all of the
104
- # #{po_root}/#{lang}/#{domainname}.po files under "po_root" using "msgmerge".
106
+ # #{po_root}/#{lang}/#{domainname}.po files under "po_root" using "msgmerge".
105
107
  #
106
- # *Note* "msgmerge" tool is included in GNU GetText. So you need to install GNU GetText.
108
+ # *Note* "msgmerge" tool is included in GNU GetText. So you need to install GNU GetText.
107
109
  #
108
110
  # See <HOWTO maintain po/mo files(http://www.yotabanana.com/hiki/ruby-gettext-howto-manage.html)> for more detals.
109
111
  # * domainname: the textdomain name.
@@ -181,7 +183,7 @@ module GetText
181
183
  :mo_root => "./data/locale",
182
184
  :mo_path_rule => "%{lang}/LC_MESSAGES"
183
185
  }.merge(options)
184
-
186
+
185
187
  lang, textdomain = %r[/([^/]+?)/(.*)\.po].match(po_file[options[:po_root].size..-1]).to_a[1,2]
186
188
 
187
189
  mo_dir_rule = File.join(options[:mo_root], options[:mo_path_rule])
@@ -1,8 +1,10 @@
1
+ # encoding: utf-8
2
+
1
3
  =begin
2
4
  parser/erb.rb - parser for ERB
3
5
 
4
6
  Copyright (C) 2005-2009 Masao Mutoh
5
-
7
+
6
8
  You may redistribute it and/or modify it under the same
7
9
  license terms as Ruby or LGPL.
8
10
  =end
@@ -23,7 +25,7 @@ module GetText
23
25
  # * :extnames: An Array of target files extension. Default is [".rhtml"].
24
26
  def init(config)
25
27
  config.each{|k, v|
26
- @config[k] = v
28
+ @config[k] = v
27
29
  }
28
30
  end
29
31
 
@@ -37,7 +39,7 @@ module GetText
37
39
 
38
40
  def target?(file) # :nodoc:
39
41
  @config[:extnames].each do |v|
40
- return true if File.extname(file) == v
42
+ return true if File.extname(file) == v
41
43
  end
42
44
  false
43
45
  end
@@ -1,8 +1,10 @@
1
+ # encoding: utf-8
2
+
1
3
  =begin
2
4
  parser/glade.rb - parser for Glade-2
3
5
 
4
6
  Copyright (C) 2004,2005 Masao Mutoh
5
-
7
+
6
8
  You may redistribute it and/or modify it under the same
7
9
  license terms as Ruby or LGPL.
8
10
  =end
@@ -14,13 +16,13 @@ module GetText
14
16
  module GladeParser
15
17
  extend GetText
16
18
  extend self
17
-
19
+
18
20
  bindtextdomain("rgettext")
19
21
 
20
22
  TARGET1 = /<property.*translatable="yes">(.*)/
21
23
  TARGET2 = /(.*)<\/property>/
22
24
 
23
- def parse(file, targets = []) # :nodoc:
25
+ def parse(file, targets = []) # :nodoc:
24
26
  lines = IO.readlines(file)
25
27
  parse_lines(file, lines, targets)
26
28
  end
@@ -31,11 +33,11 @@ module GetText
31
33
  target = false
32
34
  line_no = 0
33
35
  val = nil
34
-
35
- loop do
36
+
37
+ loop do
36
38
  line = lines.shift
37
39
  break unless line
38
-
40
+
39
41
  cnt += 1
40
42
  if TARGET1 =~ line
41
43
  line_no = cnt
@@ -61,18 +63,18 @@ module GetText
61
63
  targets
62
64
  end
63
65
 
64
- XML_RE = /<\?xml/
66
+ XML_RE = /<\?xml/
65
67
  GLADE_RE = /glade-2.0.dtd/
66
-
68
+
67
69
  def target?(file) # :nodoc:
68
70
  data = IO.readlines(file)
69
71
  if XML_RE =~ data[0] and GLADE_RE =~ data[1]
70
- true
72
+ true
71
73
  else
72
- if File.extname(file) == '.glade'
73
- raise _("`%{file}' is not glade-2.0 format.") % {:file => file}
74
- end
75
- false
74
+ if File.extname(file) == '.glade'
75
+ raise _("`%{file}' is not glade-2.0 format.") % {:file => file}
76
+ end
77
+ false
76
78
  end
77
79
  end
78
80
 
@@ -80,7 +82,7 @@ module GetText
80
82
  return unless val.size > 0
81
83
  assoc_data = targets.assoc(val)
82
84
  val = CGI.unescapeHTML(val)
83
- if assoc_data
85
+ if assoc_data
84
86
  targets[targets.index(assoc_data)] = assoc_data << "#{file}:#{line_no}"
85
87
  else
86
88
  targets << [val.gsub(/\n/, '\n'), "#{file}:#{line_no}"]
@@ -5,7 +5,7 @@
5
5
  Copyright (C) 2003-2009 Masao Mutoh
6
6
  Copyright (C) 2005 speakillof
7
7
  Copyright (C) 2001,2002 Yasushi Shoji, Masao Mutoh
8
-
8
+
9
9
  You may redistribute it and/or modify it under the same
10
10
  license terms as Ruby or LGPL.
11
11
 
@@ -23,13 +23,13 @@ module GetText
23
23
  s = get_readed
24
24
  if RubyToken::TkSTRING === tk
25
25
  def tk.value
26
- @value
26
+ @value
27
27
  end
28
-
28
+
29
29
  def tk.value=(s)
30
30
  @value = s
31
31
  end
32
-
32
+
33
33
  if @here_header
34
34
  s = s.sub(/\A.*?\n/, '').sub(/^.*\n\Z/, '')
35
35
  else
@@ -39,10 +39,10 @@ module GetText
39
39
  # Do nothing.
40
40
  end
41
41
  end
42
-
42
+
43
43
  tk.value = s
44
44
  end
45
-
45
+
46
46
  if $DEBUG
47
47
  if tk.is_a? TkSTRING
48
48
  $stderr.puts("#{tk}: #{tk.value}")
@@ -52,7 +52,7 @@ module GetText
52
52
  $stderr.puts(tk)
53
53
  end
54
54
  end
55
-
55
+
56
56
  yield tk
57
57
  end
58
58
  return nil
@@ -96,7 +96,7 @@ module GetText
96
96
 
97
97
  def advance_to_next_attribute
98
98
  @param_number += 1
99
- end
99
+ end
100
100
  end
101
101
  class PoMessage
102
102
  include PoMessageForRubyParser
@@ -109,14 +109,14 @@ module GetText
109
109
 
110
110
  module RubyParser
111
111
  extend self
112
-
112
+
113
113
  ID = ['gettext', '_', 'N_', 'sgettext', 's_']
114
114
  PLURAL_ID = ['ngettext', 'n_', 'Nn_', 'ns_', 'nsgettext']
115
115
  MSGCTXT_ID = ['pgettext', 'p_']
116
116
  MSGCTXT_PLURAL_ID = ['npgettext', 'np_']
117
117
 
118
118
  # (Since 2.1.0) the 2nd parameter is deprecated
119
- # (and ignored here).
119
+ # (and ignored here).
120
120
  # And You don't need to keep the pomessages as unique.
121
121
 
122
122
  def parse(path, deprecated = []) # :nodoc:
@@ -173,7 +173,7 @@ module GetText
173
173
  exit 1
174
174
  end
175
175
 
176
- case tk
176
+ case tk
177
177
  when RubyToken::TkCOMMENT_WITH_CONTENT
178
178
  last_comment = "" if reset_comment
179
179
  if last_comment.empty?
@@ -183,7 +183,7 @@ module GetText
183
183
  last_comment = $'
184
184
  end
185
185
  else
186
- last_comment += "\n"
186
+ last_comment += "\n"
187
187
  last_comment += tk.value
188
188
  end
189
189
  reset_comment = false
@@ -210,7 +210,7 @@ module GetText
210
210
  false
211
211
  end
212
212
  end
213
- end
213
+ end
214
214
  end
215
215
 
216
216
  if __FILE__ == $0
@@ -218,9 +218,9 @@ if __FILE__ == $0
218
218
  ARGV.each do |path|
219
219
  pp GetText::RubyParser.parse(path)
220
220
  end
221
-
222
- #rl = GetText::RubyLexX.new; rl.set_input(ARGF)
221
+
222
+ #rl = GetText::RubyLexX.new; rl.set_input(ARGF)
223
223
  #rl.parse do |tk|
224
224
  #p tk
225
- #end
225
+ #end
226
226
  end