gettext 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (169) hide show
  1. data/ChangeLog +41 -0
  2. data/NEWS +6 -0
  3. data/README +17 -11
  4. data/data/locale/el/LC_MESSAGES/rails.mo +0 -0
  5. data/data/locale/el/LC_MESSAGES/rgettext.mo +0 -0
  6. data/lib/gettext/parser/activerecord.rb +10 -9
  7. data/lib/gettext/parser/erb.rb +15 -2
  8. data/lib/gettext/parser/glade.rb +5 -2
  9. data/lib/gettext/poparser.rb +2 -2
  10. data/lib/gettext/rails.rb +24 -15
  11. data/lib/gettext/version.rb +2 -2
  12. data/po/el/rails.po +79 -0
  13. data/po/el/rgettext.po +98 -0
  14. data/po/it/messages.mo +0 -0
  15. data/samples/cgi/Rakefile +20 -2
  16. data/samples/cgi/index.cgi +1 -1
  17. data/samples/cgi/locale/cs/LC_MESSAGES/helloerb1.mo +0 -0
  18. data/samples/cgi/locale/cs/LC_MESSAGES/helloerb2.mo +0 -0
  19. data/samples/cgi/locale/cs/LC_MESSAGES/hellolib.mo +0 -0
  20. data/samples/cgi/locale/cs/LC_MESSAGES/main.mo +0 -0
  21. data/samples/cgi/locale/de/LC_MESSAGES/helloerb1.mo +0 -0
  22. data/samples/cgi/locale/de/LC_MESSAGES/helloerb2.mo +0 -0
  23. data/samples/cgi/locale/de/LC_MESSAGES/hellolib.mo +0 -0
  24. data/samples/cgi/locale/de/LC_MESSAGES/main.mo +0 -0
  25. data/samples/cgi/locale/el/LC_MESSAGES/helloerb1.mo +0 -0
  26. data/samples/cgi/locale/el/LC_MESSAGES/helloerb2.mo +0 -0
  27. data/samples/cgi/locale/el/LC_MESSAGES/hellolib.mo +0 -0
  28. data/samples/cgi/locale/el/LC_MESSAGES/main.mo +0 -0
  29. data/samples/cgi/locale/es/LC_MESSAGES/helloerb1.mo +0 -0
  30. data/samples/cgi/locale/es/LC_MESSAGES/helloerb2.mo +0 -0
  31. data/samples/cgi/locale/es/LC_MESSAGES/hellolib.mo +0 -0
  32. data/samples/cgi/locale/es/LC_MESSAGES/main.mo +0 -0
  33. data/samples/cgi/locale/fr/LC_MESSAGES/helloerb1.mo +0 -0
  34. data/samples/cgi/locale/fr/LC_MESSAGES/helloerb2.mo +0 -0
  35. data/samples/cgi/locale/fr/LC_MESSAGES/hellolib.mo +0 -0
  36. data/samples/cgi/locale/fr/LC_MESSAGES/main.mo +0 -0
  37. data/samples/cgi/locale/it/LC_MESSAGES/helloerb1.mo +0 -0
  38. data/samples/cgi/locale/it/LC_MESSAGES/helloerb2.mo +0 -0
  39. data/samples/cgi/locale/it/LC_MESSAGES/hellolib.mo +0 -0
  40. data/samples/cgi/locale/it/LC_MESSAGES/main.mo +0 -0
  41. data/samples/cgi/locale/ja/LC_MESSAGES/helloerb1.mo +0 -0
  42. data/samples/cgi/locale/ja/LC_MESSAGES/helloerb2.mo +0 -0
  43. data/samples/cgi/locale/ja/LC_MESSAGES/hellolib.mo +0 -0
  44. data/samples/cgi/locale/ja/LC_MESSAGES/main.mo +0 -0
  45. data/samples/cgi/locale/ko/LC_MESSAGES/helloerb1.mo +0 -0
  46. data/samples/cgi/locale/ko/LC_MESSAGES/helloerb2.mo +0 -0
  47. data/samples/cgi/locale/ko/LC_MESSAGES/hellolib.mo +0 -0
  48. data/samples/cgi/locale/ko/LC_MESSAGES/main.mo +0 -0
  49. data/samples/cgi/locale/nl/LC_MESSAGES/helloerb1.mo +0 -0
  50. data/samples/cgi/locale/nl/LC_MESSAGES/helloerb2.mo +0 -0
  51. data/samples/cgi/locale/nl/LC_MESSAGES/hellolib.mo +0 -0
  52. data/samples/cgi/locale/nl/LC_MESSAGES/main.mo +0 -0
  53. data/samples/cgi/locale/pt_BR/LC_MESSAGES/helloerb1.mo +0 -0
  54. data/samples/cgi/locale/pt_BR/LC_MESSAGES/helloerb2.mo +0 -0
  55. data/samples/cgi/locale/pt_BR/LC_MESSAGES/hellolib.mo +0 -0
  56. data/samples/cgi/locale/pt_BR/LC_MESSAGES/main.mo +0 -0
  57. data/samples/cgi/po/cs/helloerb1.po +14 -19
  58. data/samples/cgi/po/cs/helloerb2.po +11 -11
  59. data/samples/cgi/po/cs/hellolib.po +4 -4
  60. data/samples/cgi/po/cs/main.po +30 -23
  61. data/samples/cgi/po/de/helloerb1.po +18 -17
  62. data/samples/cgi/po/de/helloerb2.po +12 -12
  63. data/samples/cgi/po/de/hellolib.po +7 -6
  64. data/samples/cgi/po/de/main.po +35 -25
  65. data/samples/cgi/po/el/helloerb1.po +60 -0
  66. data/samples/cgi/po/el/helloerb2.po +51 -0
  67. data/samples/cgi/po/el/hellolib.po +23 -0
  68. data/samples/cgi/po/el/main.po +84 -0
  69. data/samples/cgi/po/es/helloerb1.po +13 -13
  70. data/samples/cgi/po/es/helloerb2.po +11 -11
  71. data/samples/cgi/po/es/hellolib.po +3 -3
  72. data/samples/cgi/po/es/main.po +33 -24
  73. data/samples/cgi/po/fr/helloerb1.po +14 -14
  74. data/samples/cgi/po/fr/helloerb2.po +13 -13
  75. data/samples/cgi/po/fr/hellolib.po +3 -3
  76. data/samples/cgi/po/fr/main.po +38 -28
  77. data/samples/cgi/po/helloerb1.pot +13 -13
  78. data/samples/cgi/po/helloerb2.pot +10 -10
  79. data/samples/cgi/po/hellolib.pot +4 -3
  80. data/samples/cgi/po/it/helloerb1.po +13 -14
  81. data/samples/cgi/po/it/helloerb2.po +9 -9
  82. data/samples/cgi/po/it/hellolib.po +2 -2
  83. data/samples/cgi/po/it/main.po +30 -22
  84. data/samples/cgi/po/it/messages.mo +0 -0
  85. data/samples/cgi/po/ja/helloerb1.po +14 -13
  86. data/samples/cgi/po/ja/helloerb2.po +10 -10
  87. data/samples/cgi/po/ja/hellolib.po +5 -4
  88. data/samples/cgi/po/ja/main.po +31 -22
  89. data/samples/cgi/po/ko/helloerb1.po +15 -13
  90. data/samples/cgi/po/ko/helloerb2.po +11 -11
  91. data/samples/cgi/po/ko/hellolib.po +5 -3
  92. data/samples/cgi/po/ko/main.po +33 -22
  93. data/samples/cgi/po/main.pot +23 -19
  94. data/samples/cgi/po/nl/helloerb1.po +16 -15
  95. data/samples/cgi/po/nl/helloerb2.po +11 -11
  96. data/samples/cgi/po/nl/hellolib.po +4 -4
  97. data/samples/cgi/po/nl/main.po +33 -23
  98. data/samples/cgi/po/pt_BR/helloerb1.po +13 -13
  99. data/samples/cgi/po/pt_BR/helloerb2.po +9 -9
  100. data/samples/cgi/po/pt_BR/hellolib.po +3 -2
  101. data/samples/cgi/po/pt_BR/main.po +30 -21
  102. data/samples/locale/el/LC_MESSAGES/hello.mo +0 -0
  103. data/samples/locale/el/LC_MESSAGES/hello2.mo +0 -0
  104. data/samples/locale/el/LC_MESSAGES/hello_noop.mo +0 -0
  105. data/samples/locale/el/LC_MESSAGES/hello_plural.mo +0 -0
  106. data/samples/locale/el/LC_MESSAGES/helloglade2.mo +0 -0
  107. data/samples/locale/el/LC_MESSAGES/hellogtk.mo +0 -0
  108. data/samples/locale/el/LC_MESSAGES/hellotk.mo +0 -0
  109. data/samples/po/el/hello.po +23 -0
  110. data/samples/po/el/hello2.po +31 -0
  111. data/samples/po/el/hello_noop.po +27 -0
  112. data/samples/po/el/hello_plural.po +25 -0
  113. data/samples/po/el/helloglade2.po +31 -0
  114. data/samples/po/el/hellogtk.po +22 -0
  115. data/samples/po/el/hellotk.po +23 -0
  116. data/samples/po/hello.pot +4 -2
  117. data/samples/po/hello2.pot +4 -2
  118. data/samples/po/hello_noop.pot +4 -2
  119. data/samples/po/hello_plural.pot +3 -3
  120. data/samples/po/helloglade2.pot +2 -2
  121. data/samples/po/hellogtk.pot +5 -2
  122. data/samples/po/hellotk.pot +1 -1
  123. data/samples/rails/README +6 -0
  124. data/samples/rails/app/controllers/blog_controller.rb +1 -1
  125. data/samples/rails/config/database.yml +5 -1
  126. data/samples/rails/locale/cs/LC_MESSAGES/blog.mo +0 -0
  127. data/samples/rails/locale/cs/LC_MESSAGES/gettext_plugin.mo +0 -0
  128. data/samples/rails/locale/de/LC_MESSAGES/blog.mo +0 -0
  129. data/samples/rails/locale/de/LC_MESSAGES/gettext_plugin.mo +0 -0
  130. data/samples/rails/locale/el/LC_MESSAGES/blog.mo +0 -0
  131. data/samples/rails/locale/el/LC_MESSAGES/gettext_plugin.mo +0 -0
  132. data/samples/rails/locale/en/LC_MESSAGES/blog.mo +0 -0
  133. data/samples/rails/locale/es/LC_MESSAGES/blog.mo +0 -0
  134. data/samples/rails/locale/es/LC_MESSAGES/gettext_plugin.mo +0 -0
  135. data/samples/rails/locale/fr/LC_MESSAGES/blog.mo +0 -0
  136. data/samples/rails/locale/fr/LC_MESSAGES/gettext_plugin.mo +0 -0
  137. data/samples/rails/locale/ja/LC_MESSAGES/blog.mo +0 -0
  138. data/samples/rails/locale/ja/LC_MESSAGES/gettext_plugin.mo +0 -0
  139. data/samples/rails/locale/ko/LC_MESSAGES/blog.mo +0 -0
  140. data/samples/rails/locale/ko/LC_MESSAGES/gettext_plugin.mo +0 -0
  141. data/samples/rails/locale/nl/LC_MESSAGES/blog.mo +0 -0
  142. data/samples/rails/locale/nl/LC_MESSAGES/gettext_plugin.mo +0 -0
  143. data/samples/rails/locale/pt_BR/LC_MESSAGES/blog.mo +0 -0
  144. data/samples/rails/locale/pt_BR/LC_MESSAGES/gettext_plugin.mo +0 -0
  145. data/samples/rails/po/blog.pot +4 -4
  146. data/samples/rails/po/cs/blog.po +6 -6
  147. data/samples/rails/po/cs/gettext_plugin.po +3 -3
  148. data/samples/rails/po/de/blog.po +9 -6
  149. data/samples/rails/po/de/gettext_plugin.po +5 -3
  150. data/samples/rails/po/el/blog.po +109 -0
  151. data/samples/rails/po/el/gettext_plugin.po +27 -0
  152. data/samples/rails/po/en/blog.po +4 -4
  153. data/samples/rails/po/es/blog.po +7 -6
  154. data/samples/rails/po/es/gettext_plugin.po +4 -4
  155. data/samples/rails/po/fr/blog.po +5 -5
  156. data/samples/rails/po/fr/gettext_plugin.po +3 -3
  157. data/samples/rails/po/gettext_plugin.pot +3 -3
  158. data/samples/rails/po/ja/blog.po +5 -5
  159. data/samples/rails/po/ja/gettext_plugin.po +3 -3
  160. data/samples/rails/po/ko/blog.po +9 -5
  161. data/samples/rails/po/ko/gettext_plugin.po +6 -4
  162. data/samples/rails/po/nl/blog.po +12 -15
  163. data/samples/rails/po/nl/gettext_plugin.po +5 -5
  164. data/samples/rails/po/pt_BR/blog.po +5 -5
  165. data/samples/rails/po/pt_BR/gettext_plugin.po +3 -3
  166. data/samples/rails/test/functional/blog_controller_test.rb +11 -1
  167. data/test/gettext_test_parser.rb +16 -0
  168. data/test/test_erb.rxml +16 -0
  169. metadata +47 -2
data/ChangeLog CHANGED
@@ -1,3 +1,44 @@
1
+ 2006-01-14 Masao Mutoh <mutoh@highway.ne.jp>
2
+
3
+ * samples/rails/po/*/blog.po: Updated.
4
+ * NEWS: Updated.
5
+
6
+ 2006-01-10 Masao Mutoh <mutoh@highway.ne.jp>
7
+
8
+ * lib/gettext/parser/activerecord.rb: Fixed to fail loading YAML file.
9
+ By Karel Miarka.
10
+
11
+ 2006-01-08 Masao Mutoh <mutoh@highway.ne.jp>
12
+
13
+ * *po/el/*.po: Convert to UTF-8. By damphyr.
14
+
15
+ 2006-01-07 Masao Mutoh <mutoh@highway.ne.jp>
16
+
17
+ * test/gettext_test_parser.rb: Add test_rgettext_parse.
18
+ * test/test_erb.rxml: Added.
19
+ * lib/gettext/rails.rb: Added ActionController::TestRequest for testing.
20
+ Reported by Nick Snels.
21
+ * samples/rails/README: Added test information.
22
+ * samples/rails/test/functional/blog_controller_test.rb: Implemented.
23
+ * **/*po[t]: Revised headers.
24
+ * samples/po/el/*.po, samples/cgi/po/el/*.po,
25
+ samples/rails/po/el/*.po, po/el/rgettext.po,
26
+ rails.po: Added Greek locale by damphyr.
27
+ * README: Updated.
28
+ * lib/gettext/version.rb: Increment micro version.
29
+
30
+ 2006-01-02 Masao Mutoh <mutoh@highway.ne.jp>
31
+
32
+ * lib/gettext/parser/activerecord.rb: Fixed to read configuration
33
+ correctly. Reported by Donald Piret.
34
+ Prevent to output duplicate msgid. Reported by Nick Snels.
35
+
36
+ 2005-12-31 Masao Mutoh <mutoh@highway.ne.jp>
37
+
38
+ * lib/gettext/rails.rb: Check @@gettext_domainname is set first
39
+ to avoid set the wrong value to the Content-Type when init_gettext
40
+ is not called. Pointed out by Kazuhiro NISHIYAMA.
41
+
1
42
  2005-12-29 Masao Mutoh <mutoh@highway.ne.jp>
2
43
 
3
44
  * lib/gettext/locale_win32.rb: Fixed a syntax error.
data/NEWS CHANGED
@@ -1,3 +1,9 @@
1
+ = Ruby-GetText-Package-1.1.1 (2006-01-14)
2
+
3
+ * Bugfixes.
4
+ * Added Greek locale by damphyr.
5
+ * Support tests for Ruby on Rails.
6
+
1
7
  = Ruby-GetText-Package-1.1.0 (2005-12-29)
2
8
 
3
9
  * Added some functions which managed po/mo files easily.
data/README CHANGED
@@ -1,9 +1,12 @@
1
1
  Ruby-Gettext-Package
2
2
  ====================
3
3
 
4
- Ruby-GetText-Package is Native Language Support Library and Tools
4
+ Ruby-GetText-Package is a Localization(L10n) library and tools
5
5
  which modeled after GNU gettext package.
6
6
 
7
+ It converts the messages to localized messages properly using
8
+ client-side locale information(environment variable or CGI variable).
9
+
7
10
  Features:
8
11
 
9
12
  * Simple APIs(similar GNU gettext)
@@ -12,6 +15,7 @@ Ruby-Gettext-Package
12
15
  * ruby scripts
13
16
  * glade-2 XML file(.glade)
14
17
  * ERB file(.rhtml)
18
+ * ActiveRecord(.rb)
15
19
  The po-file is compatible to GNU gettext.
16
20
 
17
21
  * rmsgfmt creates a mo-file from a po-file.
@@ -72,7 +76,7 @@ License
72
76
  (See the file 'COPYING'.)
73
77
 
74
78
  * Ruby-GetText-Package
75
- Copyright (C) 2001-2005 Masao Mutoh <mutoh@highwhay.ne.jp>
79
+ Copyright (C) 2001-2006 Masao Mutoh <mutoh@highwhay.ne.jp>
76
80
 
77
81
  * mo.rb
78
82
  Copyright (C) 2001-2004 Masao Mutoh <mutoh@highwhay.ne.jp>
@@ -94,7 +98,7 @@ License
94
98
  This file is released under LGPL. See the top of the install.rb.
95
99
 
96
100
  * Others
97
- Copyright (C) 2001-2005 Masao Mutoh <mutoh@highwhay.ne.jp>
101
+ Copyright (C) 2001-2006 Masao Mutoh <mutoh@highwhay.ne.jp>
98
102
 
99
103
 
100
104
  Translators
@@ -105,6 +109,7 @@ French - Laurent Sansonetti <laurent.sansonetti at gmail.com>
105
109
  German - Detlef Reichl <detlef.reichl at gmx.org>
106
110
  Sven Herzberg <herzi at abi02.de>
107
111
  Sascha Ebach <se at digitale-wertschoepfung.de>
112
+ Greek - Damphyr <damphyr at gmx.net>
108
113
  Italian - Gabriele Renzi <surrender_it at yahoo.it>
109
114
  Japanese - Masao Mutoh <mutoh at highway.ne.jp>
110
115
  Korean - Gyoung-Yoon Noh <nohmad at gmail.com>
@@ -115,15 +120,16 @@ Swedish - Nikolai Weibull <mailing-lists.ruby-talk at rawuncut.elitem
115
120
 
116
121
  Status of translations
117
122
  ----------------------
118
- cs - 1.1.0
119
- fr - 1.1.0
120
- de - 1.1.0
121
- es - 1.1.0
123
+ cs - 1.1.1
124
+ fr - 1.1.1
125
+ de - 1.1.1
126
+ el - 1.1.1
127
+ es - 1.1.1
122
128
  it - 1.0.0
123
- ja - 1.1.0
124
- ko - 1.1.0
125
- nl - 1.1.0
126
- pt_BR - 1.1.0
129
+ ja - 1.1.1
130
+ ko - 1.1.1
131
+ nl - 1.1.1
132
+ pt_BR - 1.1.1
127
133
  sv - 0.8.0
128
134
 
129
135
  Maintainer
Binary file
@@ -7,12 +7,14 @@
7
7
  You may redistribute it and/or modify it under the same
8
8
  license terms as Ruby.
9
9
 
10
- $Id: activerecord.rb,v 1.2 2005/12/25 11:43:20 mutoh Exp $
10
+ $Id: activerecord.rb,v 1.5 2006/01/14 13:48:23 mutoh Exp $
11
11
  =end
12
12
 
13
13
  require 'gettext'
14
14
  require 'gettext/parser/ruby'
15
15
 
16
+ include GetText
17
+
16
18
  module GetText
17
19
  module ActiveRecordParser
18
20
  extend GetText
@@ -47,8 +49,6 @@ module GetText
47
49
  end
48
50
 
49
51
  def parse(file, targets = [])
50
- ActiveRecord::Base.establish_connection(@db)
51
-
52
52
  old_constants = constants
53
53
  begin
54
54
  eval(open(file).read)
@@ -60,8 +60,8 @@ module GetText
60
60
  loaded_constants.each do |classname|
61
61
  klass = eval(classname)
62
62
  if klass < ActiveRecord::Base
63
- tablename = klass.human_attribute_name(klass.class_name)
64
- targets << [tablename, "#{file}:-"]
63
+ targets << [::Inflector.singularize(klass.table_name.gsub(/_/, " ")), "#{file}:-"]
64
+ tablename = klass.class_name
65
65
  begin
66
66
  klass.columns.each do |column|
67
67
  if @config[:use_classname]
@@ -77,8 +77,10 @@ module GetText
77
77
  end
78
78
  end
79
79
  if RubyParser.target?(file)
80
- RubyParser.parse(file, targets)
80
+ targets = RubyParser.parse(file, targets)
81
81
  end
82
+ targets.uniq!
83
+ targets
82
84
  end
83
85
 
84
86
  def target?(file)
@@ -89,9 +91,8 @@ module GetText
89
91
  unless @db
90
92
  require 'rubygems'
91
93
  require 'active_record'
92
- yml = YAML.load_file(@config[:db_yml])
93
- @db = yml[:db_mode]
94
- @db = yml["production"] unless @db
94
+ yml = YAML.load(ERB.new(IO.read(@config[:db_yml])).result)
95
+ ENV["RAILS_ENV"] = @config[:db_mode]
95
96
  require_rails 'config/boot.rb'
96
97
  require_rails 'config/environment.rb'
97
98
  require_rails 'app/controllers/application.rb'
@@ -6,7 +6,7 @@
6
6
  You may redistribute it and/or modify it under the same
7
7
  license terms as Ruby.
8
8
 
9
- $Id: erb.rb,v 1.2 2005/08/20 17:05:34 mutoh Exp $
9
+ $Id: erb.rb,v 1.3 2006/01/07 13:39:13 mutoh Exp $
10
10
  =end
11
11
 
12
12
  require 'erb'
@@ -14,14 +14,27 @@ require 'gettext/parser/ruby.rb'
14
14
 
15
15
  module GetText
16
16
  module ErbParser
17
+ @config = {
18
+ :extnames => ['.rhtml']
19
+ }
20
+
17
21
  module_function
22
+ def init(config)
23
+ config.each{|k, v|
24
+ @config[k] = v
25
+ }
26
+ end
27
+
18
28
  def parse(file, targets = [])
19
29
  erb = ERB.new(IO.readlines(file).join).src.split(/$/)
20
30
  RubyParser.parse_lines(file, erb, targets)
21
31
  end
22
32
 
23
33
  def target?(file)
24
- File.extname(file) == '.rhtml'
34
+ @config[:extnames].each do |v|
35
+ return true if File.extname(file) == v
36
+ end
37
+ false
25
38
  end
26
39
  end
27
40
  end
@@ -6,7 +6,7 @@
6
6
  You may redistribute it and/or modify it under the same
7
7
  license terms as Ruby.
8
8
 
9
- $Id: glade.rb,v 1.2 2005/12/17 07:12:40 mutoh Exp $
9
+ $Id: glade.rb,v 1.3 2006/01/07 13:39:13 mutoh Exp $
10
10
  =end
11
11
 
12
12
  require 'cgi'
@@ -71,7 +71,10 @@ module GetText
71
71
  if GLADE_RE =~ data[1]
72
72
  return true
73
73
  else
74
- raise _("%s is not glade-2.0 format.") % [file]
74
+ if File.extname(file) == '.glade'
75
+ raise _("%s is not glade-2.0 format.") % [file]
76
+ end
77
+ return false
75
78
  end
76
79
  else
77
80
  return false
@@ -20,7 +20,7 @@ module GetText
20
20
 
21
21
  class PoParser < Racc::Parser
22
22
 
23
- module_eval <<'..end src/poparser.ry modeval..id9163dcbd5f', 'src/poparser.ry', 90
23
+ module_eval <<'..end src/poparser.ry modeval..id827ea1cb71', 'src/poparser.ry', 90
24
24
  include GetText
25
25
  GetText.bindtextdomain("rgettext")
26
26
 
@@ -102,7 +102,7 @@ module_eval <<'..end src/poparser.ry modeval..id9163dcbd5f', 'src/poparser.ry',
102
102
  @comments << comment
103
103
  end
104
104
 
105
- ..end src/poparser.ry modeval..id9163dcbd5f
105
+ ..end src/poparser.ry modeval..id827ea1cb71
106
106
 
107
107
  ##### racc 1.4.4 generates ###
108
108
 
data/lib/gettext/rails.rb CHANGED
@@ -6,7 +6,7 @@
6
6
  You may redistribute it and/or modify it under the same
7
7
  license terms as Ruby.
8
8
 
9
- $Id: rails.rb,v 1.8 2005/12/28 17:32:58 mutoh Exp $
9
+ $Id: rails.rb,v 1.12 2006/01/14 13:48:22 mutoh Exp $
10
10
  =end
11
11
 
12
12
  require 'gettext'
@@ -33,19 +33,13 @@ module GetText
33
33
 
34
34
  def bindtextdomain_to(klass, domainname)
35
35
  klass.class_eval {
36
- include GetText::Rails
37
- extend GetText::Rails
38
36
  textdomain(domainname)
39
37
 
40
38
  def self.human_attribute_name(attribute_key_name)
41
- ret = ""
42
- if self == ActiveRecord::Base
43
- #Table name
44
- ret = _(attribute_key_name.humanize)
45
- else
46
- ret = s_("#{self}|#{attribute_key_name.humanize}")
47
- end
48
- ret
39
+ s_("#{self}|#{attribute_key_name.humanize}")
40
+ end
41
+ def self.human_attribute_table_name_for_error(table_name)
42
+ _(table_name.gsub(/_/, " "))
49
43
  end
50
44
  }
51
45
  end
@@ -57,6 +51,7 @@ module GetText
57
51
  end
58
52
  end
59
53
 
54
+
60
55
  module ActionController
61
56
  class Base
62
57
  helper GetText::Rails
@@ -74,7 +69,7 @@ module ActionController
74
69
  end
75
70
 
76
71
  def init_gettext
77
- init_gettext_main
72
+ init_gettext_main if @@gettext_domainname
78
73
  ActiveRecord::Errors.class_eval{
79
74
  # You need to call bindtextdomain here because ActiveRecord::Errors doesn't know
80
75
  # what locale is used in.
@@ -88,9 +83,22 @@ module ActionController
88
83
  @@gettext_content_type = content_type
89
84
  end
90
85
  end
86
+
87
+ class TestRequest < AbstractRequest
88
+ @cgi = nil
89
+ def cgi
90
+ @cgi = CGI.new unless @cgi
91
+ @cgi
92
+ end
93
+ end
91
94
  end
92
95
 
93
96
  module ActiveRecord
97
+ class Base
98
+ include GetText::Rails
99
+ extend GetText::Rails
100
+ end
101
+
94
102
  class Errors
95
103
  include GetText
96
104
  extend GetText
@@ -164,13 +172,14 @@ module ActionView
164
172
  include GetText
165
173
  extend GetText
166
174
  module_function
167
- def error_messages_for(object, klass, options = {})
175
+ def error_messages_for(object, object_name, klass, options = {})
168
176
  textdomain("rails")
177
+
169
178
  options = options.symbolize_keys
170
179
 
171
180
  unless object.errors.empty?
172
181
  count = object.errors.count
173
- record = ActiveRecord::Base.human_attribute_name(object.class.to_s)
182
+ record = ActiveRecord::Base.human_attribute_table_name_for_error(object_name)
174
183
  klass.content_tag("div",
175
184
  klass.content_tag(
176
185
  options[:header_tag] || "h2",
@@ -187,7 +196,7 @@ module ActionView
187
196
  end
188
197
  def error_messages_for(object_name, options = {})
189
198
  object = instance_variable_get("@#{object_name}")
190
- L10n.error_messages_for(object, self, options)
199
+ L10n.error_messages_for(object, object_name, self, options)
191
200
  end
192
201
  end
193
202
  end
@@ -2,11 +2,11 @@
2
2
  =begin
3
3
  version - version information of Ruby-GetText-Package
4
4
 
5
- Copyright (C) 2005 Masao Mutoh
5
+ Copyright (C) 2005,2006 Masao Mutoh
6
6
 
7
7
  You may redistribute it and/or modify it under the same
8
8
  license terms as Ruby.
9
9
  =end
10
10
  module GetText
11
- VERSION = "1.1.0"
11
+ VERSION = "1.1.1"
12
12
  end
data/po/el/rails.po ADDED
@@ -0,0 +1,79 @@
1
+ # a po-file for Ruby-GetText-Package and Ruby on Rails.
2
+ #
3
+ # Copyright (C) 2005,2006 Masao Mutoh
4
+ #
5
+ # This file is distributed under the same license as the Ruby-GetText-Package.
6
+ #
7
+ # damphyr <damphyr@gmx.net>, 2006.
8
+ #
9
+ msgid ""
10
+ msgstr ""
11
+ "Project-Id-Version: ruby-gettext 1.1.1\n"
12
+ "POT-Creation-Date: 2005-12-17 14:56+0900\n"
13
+ "PO-Revision-Date: 2006-01-06 19:50+0100\n"
14
+ "Last-Translator: damphyr <damphyr@gmx.net>\n"
15
+ "Language-Team: Greek\n"
16
+ "MIME-Version: 1.0\n"
17
+ "Content-Type: text/plain; charset=UTF-8\n"
18
+ "Content-Transfer-Encoding: 8bit\n"
19
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
20
+
21
+ #: lib/gettext/rails.rb:100
22
+ msgid "%{fn} is not included in the list"
23
+ msgstr "το %{fn} δεν περιλαμβάνεται στη λίστα"
24
+
25
+ #: lib/gettext/rails.rb:101
26
+ msgid "%{fn} is reserved"
27
+ msgstr "το %{fn} είναι κατειλημένο"
28
+
29
+ #: lib/gettext/rails.rb:102
30
+ msgid "%{fn} is invalid"
31
+ msgstr "το %{fn} είναι άκυρο"
32
+
33
+ #: lib/gettext/rails.rb:103
34
+ msgid "%{fn} doesn't match confirmation"
35
+ msgstr "το %{fn} δεν ταιριάζει με την επιβεβαίωση του"
36
+
37
+ #: lib/gettext/rails.rb:104
38
+ msgid "%{fn} must be accepted"
39
+ msgstr "το %{fn} πρέπει να γίνει δεκτό"
40
+
41
+ #: lib/gettext/rails.rb:105
42
+ msgid "%{fn} can't be empty"
43
+ msgstr "το %{fn} δεν γίνεται να είναι κενό"
44
+
45
+ #: lib/gettext/rails.rb:106
46
+ msgid "%{fn} can't be blank"
47
+ msgstr "το %{fn} δεν γίνεται να είναι κενό"
48
+
49
+ #: lib/gettext/rails.rb:107
50
+ msgid "%{fn} is too long (max is %d characters)"
51
+ msgstr "το %{fn} είναι πολύ μακρύ (το μέγιστο είναι %d χαρακτήρες)"
52
+
53
+ #: lib/gettext/rails.rb:108
54
+ msgid "%{fn} is too short (min is %d characters)"
55
+ msgstr "το %{fn} είναι πολύ μικρό (το ελάχιστο είναι %d χαρακτήρες)"
56
+
57
+ #: lib/gettext/rails.rb:109
58
+ msgid "%{fn} is the wrong length (should be %d characters)"
59
+ msgstr "το %{fn} έχει λάθος μήκος (πρέπει να είναι %d χαρακτήρες)"
60
+
61
+ #: lib/gettext/rails.rb:110
62
+ msgid "%{fn} has already been taken"
63
+ msgstr "το %{fn} είναι ήδη κατειλημένο"
64
+
65
+ #: lib/gettext/rails.rb:111
66
+ msgid "%{fn} is not a number"
67
+ msgstr "το %{fn} δεν είναι αριθμός"
68
+
69
+ #: lib/gettext/rails.rb:176
70
+ msgid "%{num} error prohibited this %{record} from being saved"
71
+ msgid_plural "%{num} errors prohibited this %{record} from being saved"
72
+ msgstr[0] "%{num} λάθος απέτρεψε την αποθήκευση της εγγραφής %{record}"
73
+ msgstr[1] "%{num} λάθη απέτρεψαν την αποθήκευση της εγγραφής %{record}"
74
+
75
+ #: lib/gettext/rails.rb:179
76
+ msgid "There were problems with the following field:"
77
+ msgid_plural "There were problems with the following fields:"
78
+ msgstr[0] "Υπάρχουν προβλήματα στο παρακάτω πεδίο:"
79
+ msgstr[1] "Υπάρχουν προβλήματα στα παρακάτω πεδία:"