gettext_activerecord 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. data/COPYING +55 -0
  2. data/ChangeLog +4 -0
  3. data/README.rdoc +172 -0
  4. data/Rakefile +110 -0
  5. data/data/locale/bg/LC_MESSAGES/gettext_activerecord.mo +0 -0
  6. data/data/locale/bs/LC_MESSAGES/gettext_activerecord.mo +0 -0
  7. data/data/locale/ca/LC_MESSAGES/gettext_activerecord.mo +0 -0
  8. data/data/locale/cs/LC_MESSAGES/gettext_activerecord.mo +0 -0
  9. data/data/locale/de/LC_MESSAGES/gettext_activerecord.mo +0 -0
  10. data/data/locale/el/LC_MESSAGES/gettext_activerecord.mo +0 -0
  11. data/data/locale/eo/LC_MESSAGES/gettext_activerecord.mo +0 -0
  12. data/data/locale/es/LC_MESSAGES/gettext_activerecord.mo +0 -0
  13. data/data/locale/et/LC_MESSAGES/gettext_activerecord.mo +0 -0
  14. data/data/locale/fr/LC_MESSAGES/gettext_activerecord.mo +0 -0
  15. data/data/locale/hr/LC_MESSAGES/gettext_activerecord.mo +0 -0
  16. data/data/locale/hu/LC_MESSAGES/gettext_activerecord.mo +0 -0
  17. data/data/locale/it/LC_MESSAGES/gettext_activerecord.mo +0 -0
  18. data/data/locale/ja/LC_MESSAGES/gettext_activerecord.mo +0 -0
  19. data/data/locale/ko/LC_MESSAGES/gettext_activerecord.mo +0 -0
  20. data/data/locale/lv/LC_MESSAGES/gettext_activerecord.mo +0 -0
  21. data/data/locale/nb/LC_MESSAGES/gettext_activerecord.mo +0 -0
  22. data/data/locale/nl/LC_MESSAGES/gettext_activerecord.mo +0 -0
  23. data/data/locale/pt_BR/LC_MESSAGES/gettext_activerecord.mo +0 -0
  24. data/data/locale/ru/LC_MESSAGES/gettext_activerecord.mo +0 -0
  25. data/data/locale/sr/LC_MESSAGES/gettext_activerecord.mo +0 -0
  26. data/data/locale/ua/LC_MESSAGES/gettext_activerecord.mo +0 -0
  27. data/data/locale/vi/LC_MESSAGES/gettext_activerecord.mo +0 -0
  28. data/data/locale/zh/LC_MESSAGES/gettext_activerecord.mo +0 -0
  29. data/data/locale/zh_TW/LC_MESSAGES/gettext_activerecord.mo +0 -0
  30. data/lib/gettext_activerecord/base.rb +66 -0
  31. data/lib/gettext_activerecord/i18n.rb +27 -0
  32. data/lib/gettext_activerecord/migration.rb +16 -0
  33. data/lib/gettext_activerecord/parser.rb +216 -0
  34. data/lib/gettext_activerecord/schema_definitions.rb +28 -0
  35. data/lib/gettext_activerecord/tools.rb +25 -0
  36. data/lib/gettext_activerecord/validations.rb +189 -0
  37. data/lib/gettext_activerecord/version.rb +12 -0
  38. data/lib/gettext_activerecord.rb +19 -0
  39. data/po/bg/gettext_activerecord.po +115 -0
  40. data/po/bs/gettext_activerecord.po +125 -0
  41. data/po/ca/gettext_activerecord.po +116 -0
  42. data/po/cs/gettext_activerecord.po +124 -0
  43. data/po/de/gettext_activerecord.po +117 -0
  44. data/po/el/gettext_activerecord.po +115 -0
  45. data/po/eo/gettext_activerecord.po +116 -0
  46. data/po/es/gettext_activerecord.po +116 -0
  47. data/po/et/gettext_activerecord.po +116 -0
  48. data/po/fr/gettext_activerecord.po +118 -0
  49. data/po/gettext_activerecord.pot +113 -0
  50. data/po/hr/gettext_activerecord.po +125 -0
  51. data/po/hu/gettext_activerecord.po +116 -0
  52. data/po/it/gettext_activerecord.po +122 -0
  53. data/po/ja/gettext_activerecord.po +116 -0
  54. data/po/ko/gettext_activerecord.po +123 -0
  55. data/po/lv/gettext_activerecord.po +116 -0
  56. data/po/nb/gettext_activerecord.po +117 -0
  57. data/po/nl/gettext_activerecord.po +123 -0
  58. data/po/pt_BR/gettext_activerecord.po +117 -0
  59. data/po/ru/gettext_activerecord.po +117 -0
  60. data/po/sr/gettext_activerecord.po +117 -0
  61. data/po/test.rb +8 -0
  62. data/po/ua/gettext_activerecord.po +120 -0
  63. data/po/vi/gettext_activerecord.po +116 -0
  64. data/po/zh/gettext_activerecord.po +119 -0
  65. data/po/zh_TW/gettext_activerecord.po +119 -0
  66. data/replace.rb +21 -0
  67. data/sample/README.rdoc +9 -0
  68. data/sample/Rakefile +32 -0
  69. data/sample/book.rb +3 -0
  70. data/sample/config/database.yml +3 -0
  71. data/sample/data/locale/ja/LC_MESSAGES/sample_ar.mo +0 -0
  72. data/sample/db/development.sqlite3 +0 -0
  73. data/sample/db/schema.rb +5 -0
  74. data/sample/locale/ja/LC_MESSAGES/sample_ar.mo +0 -0
  75. data/sample/po/ja/sample_ar.po +29 -0
  76. data/sample/po/sample_ar.pot +29 -0
  77. data/sample/sample.rb +22 -0
  78. data/test/Rakefile +43 -0
  79. data/test/db/migrate.rb +41 -0
  80. data/test/db/sqlite.rb +8 -0
  81. data/test/helper.rb +38 -0
  82. data/test/locale/ja/LC_MESSAGES/active_record.mo +0 -0
  83. data/test/models/book.rb +3 -0
  84. data/test/models/developer.rb +5 -0
  85. data/test/models/inept_wizard.rb +3 -0
  86. data/test/models/reply.rb +40 -0
  87. data/test/models/topic.rb +68 -0
  88. data/test/models/user.rb +3 -0
  89. data/test/models/wizard.rb +5 -0
  90. data/test/po/active_record.pot +388 -0
  91. data/test/po/ja/active_record.po +387 -0
  92. data/test/test_parser.rb +95 -0
  93. data/test/test_validations.rb +2575 -0
  94. data/test/vendor/repair_helper.rb +50 -0
  95. data/test.rb +2 -0
  96. metadata +268 -0
@@ -0,0 +1,216 @@
1
+ =begin
2
+ lib/gettext_activerecord/parser.rb - parser for ActiveRecord
3
+
4
+ Copyright (C) 2005-2009 Masao Mutoh
5
+
6
+ You may redistribute it and/or modify it under the same
7
+ license terms as Ruby.
8
+
9
+ $Id$
10
+ =end
11
+
12
+ require 'gettext'
13
+ require 'gettext/tools/rgettext'
14
+ require 'gettext/parser/ruby'
15
+
16
+ include GetText
17
+
18
+ ActiveRecord::Base.instance_eval do
19
+ alias inherited_without_log inherited
20
+
21
+ @@active_record_classes_list = []
22
+
23
+ def inherited(subclass)
24
+ puts "registering an ActiveRecord model for later processing: #{subclass}" if $DEBUG
25
+ active_record_classes_list << "#{subclass}"
26
+ inherited_without_log(subclass)
27
+ end
28
+
29
+ def active_record_classes_list
30
+ @@active_record_classes_list
31
+ end
32
+
33
+ def reset_active_record_classes_list
34
+ @@active_record_classes_list = []
35
+ end
36
+ end
37
+
38
+ module GetText
39
+ module ActiveRecordParser
40
+ extend GetText
41
+ include GetText
42
+ bindtextdomain "gettext_activerecord"
43
+
44
+ @config = {
45
+ :db_yml => "config/database.yml",
46
+ :db_mode => "development",
47
+ :activerecord_classes => ["ActiveRecord::Base"],
48
+ :untranslate_classes => ["ActiveRecord::Base", "ActiveRecord::SessionStore::Session"],
49
+ :untranslate_columns => ["id"],
50
+ :use_classname => true,
51
+ }
52
+
53
+ @ar_re = nil
54
+
55
+ module_function
56
+ def require_rails(file) # :nodoc:
57
+ begin
58
+ require file
59
+ rescue MissingSourceFile
60
+ $stderr.puts _("'%{file}' is not found.") % {:file => file}
61
+ end
62
+ end
63
+
64
+ # Sets some preferences to parse ActiveRecord files.
65
+ #
66
+ # * config: a Hash of the config. It can takes some values below:
67
+ # * :use_classname - If true, the msgids of ActiveRecord become "ClassName|FieldName" (e.g. "Article|Title"). Otherwise the ClassName is not used (e.g. "Title"). Default is true.
68
+ # * :db_yml - the path of database.yml. Default is "config/database.yml".
69
+ # * :db_mode - the mode of the database. Default is "development"
70
+ # * :activerecord_classes - an Array of the superclass of the models. The classes should be String value. Default is ["ActiveRecord::Base"]
71
+ # * :untranslate_classes - an Array of the modules/class names which is ignored as the msgid.
72
+ # * :untranslate_columns - an Array of the column names which is ignored as the msgid.
73
+ # * :adapter - the options for ActiveRecord::Base.establish_connection. If this value is set, :db_yml option is ignored.
74
+ # * :host - ditto
75
+ # * :username - ditto
76
+ # * :password - ditto
77
+ # * :database - ditto
78
+ # * :socket - ditto
79
+ # * :encoding - ditto
80
+ #
81
+ # "ClassName|FieldName" uses GetText.sgettext. So you don't need to translate the left-side of "|".
82
+ # See <Documents for Translators for more details(http://www.yotabanana.com/hiki/ruby-gettext-translate.html)>.
83
+ def init(config)
84
+ puts "\nconfig: #{config.inspect}\n\n" if $DEBUG
85
+ if config
86
+ config.each{|k, v|
87
+ @config[k] = v
88
+ }
89
+ end
90
+ @ar_re = /class.*(#{@config[:activerecord_classes].join("|")})/
91
+ end
92
+
93
+ def translatable_class?(klass)
94
+ if klass.is_a?(Class) && klass < ActiveRecord::Base
95
+ if klass.untranslate_all? || klass.abstract_class? || @config[:untranslate_classes].include?(klass.name)
96
+ false
97
+ else
98
+ true
99
+ end
100
+ else
101
+ true
102
+ end
103
+ end
104
+
105
+ def translatable_column?(klass, columnname)
106
+ ! (klass.untranslate?(columnname) || @config[:untranslate_columns].include?(columnname))
107
+ end
108
+
109
+ def parse(file, targets = []) # :nodoc:
110
+ puts "parse file #{file}" if $DEBUG
111
+
112
+ GetText.locale = "en"
113
+ old_constants = Object.constants
114
+ begin
115
+ eval(open(file).read, TOPLEVEL_BINDING)
116
+ rescue
117
+ $stderr.puts _("Ignored '%{file}'. Solve dependencies first.") % {:file => file}
118
+ $stderr.puts $!
119
+ end
120
+ #loaded_constants = Object.constants - old_constants
121
+ loaded_constants = ActiveRecord::Base.active_record_classes_list
122
+ ActiveRecord::Base.reset_active_record_classes_list
123
+ loaded_constants.each do |classname|
124
+ klass = eval(classname, TOPLEVEL_BINDING)
125
+ if translatable_class?(klass)
126
+ puts "processing class #{klass.name}" if $DEBUG
127
+ add_target(targets, file, ActiveSupport::Inflector.singularize(klass.table_name.gsub(/_/, " ")))
128
+ unless klass.class_name == classname
129
+ add_target(targets, file, ActiveSupport::Inflector.singularize(classname.gsub(/_/, " ").downcase))
130
+ end
131
+ begin
132
+ klass.columns.each do |column|
133
+ if translatable_column?(klass, column.name)
134
+ if @config[:use_classname]
135
+ msgid = classname + "|" + klass.human_attribute_name(column.name)
136
+ else
137
+ msgid = klass.human_attribute_name(column.name)
138
+ end
139
+ add_target(targets, file, msgid)
140
+ end
141
+ end
142
+ rescue
143
+ $stderr.puts _("No database is available.")
144
+ $stderr.puts $!
145
+ end
146
+ end
147
+ end
148
+ if RubyParser.target?(file)
149
+ targets = RubyParser.parse(file, targets)
150
+ end
151
+ targets.uniq!
152
+ targets
153
+ end
154
+
155
+ def add_target(targets, file, msgid) # :nodoc:
156
+ file_lineno = "#{file}:-"
157
+ key_existed = targets.assoc(msgid)
158
+ if key_existed
159
+ unless targets[targets.index(key_existed)].include?(file_lineno)
160
+ targets[targets.index(key_existed)] = key_existed << file_lineno
161
+ end
162
+ else
163
+ targets << [msgid, "#{file}:-"]
164
+ end
165
+ targets
166
+ end
167
+
168
+ def target?(file) # :nodoc:
169
+ init(nil) unless @ar_re
170
+ data = IO.readlines(file)
171
+ data.each do |v|
172
+ if @ar_re =~ v
173
+ unless ActiveRecord::Base.connected?
174
+ begin
175
+ require 'rubygems'
176
+ rescue LoadError
177
+ $stderr.puts _("rubygems are not found.") if $DEBUG
178
+ end
179
+ begin
180
+ ENV["RAILS_ENV"] = @config[:db_mode]
181
+ require 'config/boot.rb'
182
+ require 'config/environment.rb'
183
+ require_rails 'activesupport'
184
+ require_rails 'gettext_activerecord'
185
+ rescue LoadError
186
+ require_rails 'rubygems'
187
+ gem 'activerecord'
188
+ require_rails 'activesupport'
189
+ require_rails 'active_record'
190
+ require_rails 'activesupport'
191
+ require_rails 'gettext_activerecord'
192
+ end
193
+ begin
194
+ yaml = YAML.load(IO.read(@config[:db_yml]))
195
+ if yaml[@config[:db_mode]]
196
+ ActiveRecord::Base.establish_connection(yaml[@config[:db_mode]])
197
+ else
198
+ ActiveRecord::Base.establish_connection(yaml)
199
+ end
200
+ rescue
201
+ if @config[:adapter]
202
+ ActiveRecord::Base.establish_connection(@config)
203
+ else
204
+ return false
205
+ end
206
+ end
207
+ end
208
+ return true
209
+ end
210
+ end
211
+ false
212
+ end
213
+ end
214
+
215
+ RGetText.add_parser(GetText::ActiveRecordParser)
216
+ end
@@ -0,0 +1,28 @@
1
+ =begin
2
+ lib/gettext_activerecord/schema_definitions.rb - GetText for ActiveRecord::ConnectionAdapters::Column
3
+
4
+ Copyright (C) 2009 Masao Mutoh
5
+
6
+ You may redistribute it and/or modify it under the same
7
+ license terms as Ruby.
8
+
9
+ =end
10
+
11
+ module ActiveRecord #:nodoc:
12
+ module ConnectionAdapters #:nodoc:
13
+ # An abstract definition of a column in a table.
14
+ class Column
15
+ attr_accessor :table_class
16
+ alias :human_name_witout_localized :human_name
17
+
18
+ def human_name_with_gettext_activerecord
19
+ if table_class
20
+ table_class.human_attribute_name(@name)
21
+ else
22
+ @name.humanize
23
+ end
24
+ end
25
+ alias_method_chain :human_name, :gettext_activerecord
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,25 @@
1
+ =begin
2
+ tools.rb - Utility functions
3
+
4
+ Copyright (C) 2009 Masao Mutoh
5
+
6
+ You may redistribute it and/or modify it under the same
7
+ license terms as Ruby.
8
+ =end
9
+
10
+ require 'gettext/tools'
11
+ require 'gettext_activerecord'
12
+ require 'gettext_activerecord/parser'
13
+
14
+ module GetText
15
+ extend self
16
+
17
+ alias :create_mofiles_org :create_mofiles
18
+ alias :update_pofiles_org :update_pofiles
19
+
20
+ def update_pofiles(textdomain, files, app_version, options = {})
21
+ GetText::ActiveRecordParser.init(options)
22
+ GetText.update_pofiles_org(textdomain, files, app_version, options)
23
+ end
24
+
25
+ end
@@ -0,0 +1,189 @@
1
+ =begin
2
+ lib/gettext_activerecord/validations.rb - GetText for ActiveRecord
3
+
4
+ Copyright (C) 2006-2009 Masao Mutoh
5
+
6
+ You may redistribute it and/or modify it under the same
7
+ license terms as Ruby.
8
+
9
+ $Id$
10
+ =end
11
+
12
+ module ActiveRecord #:nodoc:
13
+ class RecordInvalid < ActiveRecordError #:nodoc:
14
+ attr_reader :record
15
+ include GetText
16
+ bindtextdomain "gettext_activerecord"
17
+
18
+ def initialize(record)
19
+ @record = record
20
+ super(_("Validation failed: %{error_messages}") %
21
+ {:error_messages => @record.errors.full_messages.join(", ")})
22
+ end
23
+ end
24
+
25
+ module Validations # :nodoc:
26
+ class << self
27
+ def real_included(base)
28
+ base.extend ClassMethods
29
+ base.class_eval{
30
+ include GetText
31
+ def gettext(str) #:nodoc:
32
+ _(str)
33
+ end
34
+ class << self
35
+ def human_attribute_name_with_gettext_activerecord(attribute_key_name) #:nodoc:
36
+ s_("#{self}|#{attribute_key_name.humanize}")
37
+ end
38
+ alias_method_chain :human_attribute_name, :gettext_activerecord
39
+
40
+ def human_attribute_table_name_for_error(table_name) #:nodoc:
41
+ _(table_name.gsub(/_/, " "))
42
+ end
43
+ end
44
+ }
45
+ end
46
+ end
47
+
48
+ if respond_to? :included
49
+ class << self
50
+ def included_with_gettext_activerecord(base) # :nodoc:
51
+ unless base <= ActiveRecord::Base
52
+ included_without_gettext_activerecord(base)
53
+ end
54
+ real_included(base)
55
+ end
56
+ alias_method_chain :included, :gettext_activerecord
57
+ end
58
+ else
59
+ class << self
60
+ # Since rails-1.2.0.
61
+ def append_features_with_gettext_activerecord(base) # :nodoc:
62
+ unless base <= ActiveRecord::Base
63
+ append_features_without_gettext_activerecord(base)
64
+ end
65
+ real_included(base)
66
+ end
67
+ alias_method_chain :append_features, :gettext_activerecord
68
+ end
69
+ end
70
+ end
71
+
72
+ # activerecord-1.14.3/lib/active_record/validations.rb
73
+ class Errors #:nodoc:
74
+ include GetText
75
+
76
+ textdomain "gettext_activerecord"
77
+
78
+ class << self
79
+ include GetText
80
+
81
+ def default_error_messages_with_gettext_activerecord
82
+ @@default_error_messages || {}
83
+ end
84
+ alias_method_chain :default_error_messages, :gettext_activerecord
85
+
86
+ # To use other backends, gettext_activerecord doesn't use backend architecture.
87
+ # You can use GetText with other backends.
88
+ @@default_error_messages = {
89
+ :inclusion => N_("%{attribute} is not included in the list"),
90
+ :exclusion => N_("%{attribute} is reserved"),
91
+ :invalid => N_("%{attribute} is invalid"),
92
+ :confirmation => N_("%{attribute} doesn't match confirmation"),
93
+ :accepted => N_("%{attribute} must be accepted"),
94
+ :empty => N_("%{attribute} can't be empty"),
95
+ :blank => N_("%{attribute} can't be blank"),
96
+ :too_long => N_("%{attribute} is too long (maximum is %{count} characters)"),
97
+ :too_short => N_("%{attribute} is too short (minimum is %{count} characters)"),
98
+ :wrong_length => N_("%{attribute} is the wrong length (should be %{count} characters)"),
99
+ :taken => N_("%{attribute} has already been taken"),
100
+ :not_a_number => N_("%{attribute} is not a number"),
101
+ :greater_than => N_("%{attribute} must be greater than %{count}"),
102
+ :greater_than_or_equal_to => N_("%{attribute} must be greater than or equal to %{count}"),
103
+ :equal_to => N_("%{attribute} must be equal to %{count}"),
104
+ :less_than => N_("%{attribute} must be less than %{count}"),
105
+ :less_than_or_equal_to => N_("%{attribute} must be less than or equal to %{count}"),
106
+ :odd => N_("%{attribute} must be odd"),
107
+ :even => N_("%{attribute} must be even")
108
+ }
109
+ end
110
+
111
+ def each_with_gettext_activerecord #:nodoc:
112
+ @errors.each_key { |attr| @errors[attr].each { |msg| yield attr, localize_error_message(attr, msg, false) } }
113
+ end
114
+ alias_method_chain :each, :gettext_activerecord
115
+
116
+ # Returns error messages.
117
+ # * Returns nil, if no errors are associated with the specified attribute.
118
+ # * Returns the error message, if one error is associated with the specified attribute.
119
+ # * Returns an array of error messages, if more than one error is associated with the specified attribute.
120
+ # And for GetText,
121
+ # * If the error messages include %{fn}, it returns formatted text such as "foo %{fn}" => "foo Field"
122
+ # * else, the error messages are prepended the field name such as "foo" => "foo" (Same as default behavior).
123
+ # Note that this behaviour is different from full_messages.
124
+ def on_with_gettext_activerecord(attribute)
125
+ # e.g.) foo field: "%{fn} foo" => "Foo foo", "foo" => "foo".
126
+ errors = localize_error_messages(false)[attribute.to_s]
127
+ return nil if errors.nil?
128
+ errors.size == 1 ? errors.first : errors
129
+ end
130
+ alias_method_chain :on, :gettext_activerecord
131
+ alias :[] :on
132
+
133
+ # Returns all the full error messages in an array.
134
+ # * If the error messages include %{fn}, it returns formatted text such as "foo %{fn}" => "foo Field"
135
+ # * else, the error messages are prepended the field name such as "foo" => "Field foo" (Same as default behavior).
136
+ # As L10n, first one is recommanded because the order of subject,verb and others are not same in languages.
137
+ def full_messages_with_gettext_activerecord
138
+ full_messages = []
139
+ errors = localize_error_messages
140
+ errors.each_key do |attr|
141
+ errors[attr].each do |msg|
142
+ next if msg.nil?
143
+ full_messages << msg
144
+ end
145
+ end
146
+ full_messages
147
+ end
148
+ alias_method_chain :full_messages, :gettext_activerecord
149
+
150
+ private
151
+ def localize_error_message(attr, obj, append_field) # :nodoc:
152
+ msgid, count, value = obj, 0, ""
153
+ if obj.kind_of? Hash
154
+ msgid = obj[:default].select{|v| v.is_a? String}[0]
155
+ unless msgid
156
+ symbol = obj[:default][0].to_s.split(".").last.to_sym
157
+ msgid = @@default_error_messages[symbol]
158
+ end
159
+ attr, count, value = obj[:attribute], obj[:count], obj[:value]
160
+ end
161
+ msgstr = @base.gettext(msgid)
162
+ msgstr = _(msgid) if msgstr == msgid
163
+ msgstr = msgstr.gsub("%{fn}", "%{attribute}").gsub("%d", "%{count}").gsub("%{val}", "%{value}") # for backward compatibility.
164
+ if attr == "base"
165
+ full_message = msgstr
166
+ elsif /%\{attribute\}/ =~ msgstr
167
+ full_message = msgstr % {:attribute => @base.class.human_attribute_name(attr)}
168
+ elsif append_field
169
+ full_message = @base.class.human_attribute_name(attr) + " " + msgstr
170
+ else
171
+ full_message = msgstr
172
+ end
173
+ full_message % {:count => count, :value => value}
174
+ end
175
+
176
+ def localize_error_messages(append_field = true) # :nodoc:
177
+ # e.g.) foo field: "%{fn} foo" => "Foo foo", "foo" => "Foo foo".
178
+ errors = {}
179
+ each_without_gettext_activerecord {|attr, msg|
180
+ next if msg.nil?
181
+ errors[attr] ||= []
182
+ errors[attr] << localize_error_message(attr, msg, append_field)
183
+ }
184
+ errors
185
+ end
186
+
187
+ end
188
+ end
189
+
@@ -0,0 +1,12 @@
1
+ =begin
2
+ version - version information of gettext_activerecord.
3
+
4
+ Copyright (C) 2009 Masao Mutoh
5
+
6
+ You may redistribute it and/or modify it under the same
7
+ license terms as Ruby.
8
+ =end
9
+ module GetTextActiveRecord
10
+ RAILS_VERSION = "2.3.2"
11
+ VERSION = "2.0.0"
12
+ end
@@ -0,0 +1,19 @@
1
+ =begin
2
+ gettext_activerecord.rb - GetText for ActiveRecord
3
+
4
+ Copyright (C) 2009 Masao Mutoh
5
+
6
+ You may redistribute it and/or modify it under the same
7
+ license terms as Ruby.
8
+
9
+ =end
10
+
11
+ require 'gettext'
12
+ require 'active_record'
13
+ require 'gettext_activerecord/migration'
14
+ require 'gettext_activerecord/schema_definitions'
15
+ require 'gettext_activerecord/validations'
16
+ require 'gettext_activerecord/base'
17
+ require 'gettext_activerecord/i18n'
18
+ require 'gettext_activerecord/version'
19
+
@@ -0,0 +1,115 @@
1
+ #
2
+ # a po-file for Ruby-GetText-Package and Ruby on Rails.
3
+ #
4
+ # Copyright (C) 2005,2006 Masao Mutoh
5
+ # This file is distributed under the same license as the Ruby-GetText-Package.
6
+ #
7
+ # Georgi Stoimenov <georgistoimenov@abv.bg>, 2008
8
+ #
9
+ msgid ""
10
+ msgstr ""
11
+ "Project-Id-Version: gettext_activerecord 0.1.0\n"
12
+ "POT-Creation-Date: 2009-02-09 01:48+0900\n"
13
+ "PO-Revision-Date: 2008-07-11 11:35+0300\n"
14
+ "Last-Translator: Sava Chankov <sava.chankov@gmail.com>\n"
15
+ "Language-Team: Bulgarian <ruby-on-rails-bulgaria@googlegroups.com>\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_activerecord/parser.rb:60
22
+ msgid "'%{file}' is not found."
23
+ msgstr ""
24
+
25
+ #: lib/gettext_activerecord/parser.rb:104
26
+ msgid "Ignored '%{file}'. Solve dependencies first."
27
+ msgstr ""
28
+
29
+ #: lib/gettext_activerecord/parser.rb:131
30
+ msgid "No database is available."
31
+ msgstr ""
32
+
33
+ #: lib/gettext_activerecord/parser.rb:167
34
+ msgid "rubygems are not found."
35
+ msgstr ""
36
+
37
+ #: lib/gettext_activerecord/active_record.rb:27
38
+ msgid "Validation failed: %{error_messages}"
39
+ msgstr "Неуспешна валидация: %{error_messages}"
40
+
41
+ #: lib/gettext_activerecord/active_record.rb:218
42
+ msgid "%{attribute} is not included in the list"
43
+ msgstr "Полето „%{attribute}“ не е в списъка"
44
+
45
+ #: lib/gettext_activerecord/active_record.rb:219
46
+ msgid "%{attribute} is reserved"
47
+ msgstr "Полето „%{attribute}“ е резервирано"
48
+
49
+ #: lib/gettext_activerecord/active_record.rb:220
50
+ msgid "%{attribute} is invalid"
51
+ msgstr "Полето „%{attribute}“ е невалидно"
52
+
53
+ #: lib/gettext_activerecord/active_record.rb:221
54
+ msgid "%{attribute} doesn't match confirmation"
55
+ msgstr "%{attribute} не съвпада"
56
+
57
+ #: lib/gettext_activerecord/active_record.rb:222
58
+ msgid "%{attribute} must be accepted"
59
+ msgstr "Полето „%{attribute}“ трябва бъде прието"
60
+
61
+ #: lib/gettext_activerecord/active_record.rb:223
62
+ msgid "%{attribute} can't be empty"
63
+ msgstr "Полето „%{attribute}“ не може да е празно"
64
+
65
+ #: lib/gettext_activerecord/active_record.rb:224
66
+ msgid "%{attribute} can't be blank"
67
+ msgstr "Полето „%{attribute}“ не може да е празно"
68
+
69
+ #: lib/gettext_activerecord/active_record.rb:225
70
+ msgid "%{attribute} is too long (maximum is %{count} characters)"
71
+ msgstr "Полето „%{attribute}“ е много дълго (максимумът е %{count} символа)"
72
+
73
+ #: lib/gettext_activerecord/active_record.rb:226
74
+ msgid "%{attribute} is too short (minimum is %{count} characters)"
75
+ msgstr "Полето „%{attribute}“ е много късо (минимумът е %{count} символа)"
76
+
77
+ #: lib/gettext_activerecord/active_record.rb:227
78
+ msgid "%{attribute} is the wrong length (should be %{count} characters)"
79
+ msgstr "Полето „%{attribute}“ е с неправилна дължина (трябва да е %{count} символа)"
80
+
81
+ #: lib/gettext_activerecord/active_record.rb:228
82
+ msgid "%{attribute} has already been taken"
83
+ msgstr "Полето „%{attribute}“ е вече заето"
84
+
85
+ #: lib/gettext_activerecord/active_record.rb:229
86
+ msgid "%{attribute} is not a number"
87
+ msgstr "Полето „%{attribute}“ не е число"
88
+
89
+ #: lib/gettext_activerecord/active_record.rb:230
90
+ msgid "%{attribute} must be greater than %{count}"
91
+ msgstr "Полето „%{attribute}“ трябва бъде по-голямо от %{count}"
92
+
93
+ #: lib/gettext_activerecord/active_record.rb:231
94
+ msgid "%{attribute} must be greater than or equal to %{count}"
95
+ msgstr "Полето „%{attribute}“ трябва бъде по-голямо или равно на %{count}"
96
+
97
+ #: lib/gettext_activerecord/active_record.rb:232
98
+ msgid "%{attribute} must be equal to %{count}"
99
+ msgstr "Полето „%{attribute}“ трябва бъде равно на %{count}"
100
+
101
+ #: lib/gettext_activerecord/active_record.rb:233
102
+ msgid "%{attribute} must be less than %{count}"
103
+ msgstr "Полето „%{attribute}“ трябва бъде по-малко от %{count}"
104
+
105
+ #: lib/gettext_activerecord/active_record.rb:234
106
+ msgid "%{attribute} must be less than or equal to %{count}"
107
+ msgstr "Полето „%{attribute}“ трябва бъде по-малко или равно на %{count}"
108
+
109
+ #: lib/gettext_activerecord/active_record.rb:235
110
+ msgid "%{attribute} must be odd"
111
+ msgstr "Полето „%{attribute}“ трябва бъде нечетно"
112
+
113
+ #: lib/gettext_activerecord/active_record.rb:236
114
+ msgid "%{attribute} must be even"
115
+ msgstr "Полето „%{attribute}“ трябва бъде четно"