activesambaldap 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. data/NEWS.en +8 -1
  2. data/NEWS.ja +8 -1
  3. data/README.en +9 -6
  4. data/README.ja +5 -3
  5. data/Rakefile +47 -1
  6. data/bin/asl-groupadd +8 -5
  7. data/bin/asl-groupdel +6 -3
  8. data/bin/asl-groupmod +15 -11
  9. data/bin/asl-groupshow +3 -1
  10. data/bin/asl-passwd +14 -11
  11. data/bin/asl-populate +19 -14
  12. data/bin/asl-purge +3 -1
  13. data/bin/asl-samba-computeradd +8 -6
  14. data/bin/asl-samba-groupadd +4 -2
  15. data/bin/asl-samba-groupdel +4 -2
  16. data/bin/asl-samba-groupmod +8 -7
  17. data/bin/asl-samba-useradd +8 -6
  18. data/bin/asl-samba-userdel +4 -2
  19. data/bin/asl-samba-usermod +15 -8
  20. data/bin/asl-useradd +50 -49
  21. data/bin/asl-userdel +17 -8
  22. data/bin/asl-usermod +54 -49
  23. data/bin/asl-usershow +3 -1
  24. data/data/locale/ja/LC_MESSAGES/active-samba-ldap.mo +0 -0
  25. data/lib/active_samba_ldap.rb +2 -1
  26. data/lib/active_samba_ldap/account_entry.rb +13 -11
  27. data/lib/active_samba_ldap/base.rb +26 -25
  28. data/lib/active_samba_ldap/command.rb +11 -7
  29. data/lib/active_samba_ldap/configuration.rb +6 -4
  30. data/lib/active_samba_ldap/entry.rb +5 -4
  31. data/lib/active_samba_ldap/get_text_support.rb +12 -0
  32. data/lib/active_samba_ldap/group_entry.rb +4 -3
  33. data/lib/active_samba_ldap/populate.rb +1 -1
  34. data/lib/active_samba_ldap/samba_account_entry.rb +4 -4
  35. data/lib/active_samba_ldap/samba_group_entry.rb +4 -3
  36. data/lib/active_samba_ldap/user.rb +5 -4
  37. data/lib/active_samba_ldap/version.rb +1 -1
  38. data/po/active-samba-ldap.pot +463 -0
  39. data/po/ja/active-samba-ldap.po +469 -0
  40. data/rails/plugin/active_samba_ldap/generators/{scaffold_asl/scaffold_asl_generator.rb → scaffold_active_samba_ldap/scaffold_active_samba_ldap_generator.rb} +1 -2
  41. data/rails/plugin/active_samba_ldap/generators/{scaffold_asl → scaffold_active_samba_ldap}/templates/computer.rb +0 -0
  42. data/rails/plugin/active_samba_ldap/generators/{scaffold_asl → scaffold_active_samba_ldap}/templates/dc.rb +0 -0
  43. data/rails/plugin/active_samba_ldap/generators/{scaffold_asl → scaffold_active_samba_ldap}/templates/group.rb +0 -0
  44. data/rails/plugin/active_samba_ldap/generators/{scaffold_asl → scaffold_active_samba_ldap}/templates/idmap.rb +0 -0
  45. data/rails/plugin/active_samba_ldap/generators/{scaffold_asl → scaffold_active_samba_ldap}/templates/ldap.yml +0 -0
  46. data/rails/plugin/active_samba_ldap/generators/{scaffold_asl → scaffold_active_samba_ldap}/templates/ou.rb +0 -0
  47. data/rails/plugin/active_samba_ldap/generators/{scaffold_asl → scaffold_active_samba_ldap}/templates/samba_controller.rb +0 -0
  48. data/rails/plugin/active_samba_ldap/generators/{scaffold_asl → scaffold_active_samba_ldap}/templates/samba_helper.rb +0 -0
  49. data/rails/plugin/active_samba_ldap/generators/{scaffold_asl → scaffold_active_samba_ldap}/templates/samba_index.rhtml +0 -0
  50. data/rails/plugin/active_samba_ldap/generators/{scaffold_asl → scaffold_active_samba_ldap}/templates/samba_populate.rhtml +0 -0
  51. data/rails/plugin/active_samba_ldap/generators/{scaffold_asl → scaffold_active_samba_ldap}/templates/samba_purge.rhtml +0 -0
  52. data/rails/plugin/active_samba_ldap/generators/{scaffold_asl → scaffold_active_samba_ldap}/templates/unix_id_pool.rb +0 -0
  53. data/rails/plugin/active_samba_ldap/generators/{scaffold_asl → scaffold_active_samba_ldap}/templates/user.rb +0 -0
  54. data/rails/plugin/active_samba_ldap/init.rb +15 -3
  55. data/test/asl-test-utils.rb +2 -1
  56. data/test/command.rb +5 -2
  57. data/test/run-test.rb +6 -2
  58. data/test/test-unit-ext.rb +4 -2
  59. data/test/test-unit-ext/backtrace-filter.rb +17 -0
  60. data/test/test-unit-ext/long-display-for-emacs.rb +25 -0
  61. data/test/test-unit-ext/priority.rb +20 -7
  62. data/test/test_asl_groupadd.rb +2 -2
  63. data/test/test_asl_groupdel.rb +11 -11
  64. data/test/test_asl_groupmod.rb +7 -6
  65. data/test/test_asl_groupshow.rb +1 -1
  66. data/test/test_asl_passwd.rb +11 -10
  67. data/test/test_asl_populate.rb +6 -6
  68. data/test/test_asl_purge.rb +1 -1
  69. data/test/test_asl_useradd.rb +11 -9
  70. data/test/test_asl_userdel.rb +6 -4
  71. data/test/test_asl_usermod.rb +8 -8
  72. data/test/test_asl_usershow.rb +1 -1
  73. data/test/test_entry.rb +21 -0
  74. metadata +38 -30
data/bin/asl-userdel CHANGED
@@ -3,6 +3,8 @@
3
3
  require 'active_samba_ldap'
4
4
  require 'active_samba_ldap/command'
5
5
 
6
+ include ActiveSambaLdap::GetTextSupport
7
+
6
8
  argv, opts, options = ActiveSambaLdap::Command.parse_options do |opts, options|
7
9
  options.remove_home_directory = false
8
10
  options.interactive = false
@@ -11,17 +13,19 @@ argv, opts, options = ActiveSambaLdap::Command.parse_options do |opts, options|
11
13
  opts.banner += " USER_NAME"
12
14
 
13
15
  opts.on("-c", "--[no-]computer-account",
14
- "is a Windows Workstation",
15
- "(otherwise, Windows user)",
16
+ _("is a Windows Workstation"),
17
+ _("(otherwise, Windows user)"),
16
18
  "(#{options.computer_account})") {|options.computer_account|}
17
19
 
18
20
  opts.on("-r", "--[no-]remove-home-directory",
19
- "remove home directory (#{options.remove_home_directory})") do |bool|
21
+ _("remove home directory"),
22
+ "(#{options.remove_home_directory})") do |bool|
20
23
  options.remove_home_directory = bool
21
24
  end
22
25
 
23
26
  opts.on("-i", "--[no-]interactive",
24
- "do interactively (#{options.interactive})") do |bool|
27
+ _("do interactively"),
28
+ "(#{options.interactive})") do |bool|
25
29
  options.interactive = bool
26
30
  end
27
31
  end
@@ -35,7 +39,7 @@ else
35
39
  end
36
40
 
37
41
  unless Process.uid.zero?
38
- $stderr.puts "need root authority."
42
+ $stderr.puts(_("need root authority."))
39
43
  exit 1
40
44
  end
41
45
 
@@ -53,15 +57,20 @@ class Group < ActiveSambaLdap::Group
53
57
  ldap_mapping
54
58
  end
55
59
 
56
- member_class = options.computer_account ? Computer : User
57
- member_type = member_class.name.downcase
60
+ if options.computer_account
61
+ member_class = Computer
62
+ member_type = _("computer")
63
+ else
64
+ member_class = User
65
+ member_type = _("user")
66
+ end
58
67
 
59
68
  if options.computer_account
60
69
  name = name.chomp("$") + "$"
61
70
  end
62
71
 
63
72
  unless member_class.exists?(name)
64
- $stderr.puts "#{member_type} '#{name}' doesn't exist."
73
+ $stderr.puts(_("%s doesn't exist: %s") % [member_type, name])
65
74
  exit 1
66
75
  end
67
76
  member = member_class.find(name)
data/bin/asl-usermod CHANGED
@@ -6,6 +6,8 @@ require 'fileutils'
6
6
  require 'active_samba_ldap'
7
7
  require 'active_samba_ldap/command'
8
8
 
9
+ include ActiveSambaLdap::GetTextSupport
10
+
9
11
  argv, opts, options = ActiveSambaLdap::Command.parse_options do |opts, options|
10
12
  options.computer_account = false
11
13
  options.gecos = nil
@@ -20,7 +22,7 @@ argv, opts, options = ActiveSambaLdap::Command.parse_options do |opts, options|
20
22
  options.supplementary_groups = nil
21
23
  options.shell = nil
22
24
  options.given_name = nil
23
- options.canonical_name = nil
25
+ options.common_name = nil
24
26
  options.surname = nil
25
27
 
26
28
  options.expire_date = nil
@@ -39,94 +41,94 @@ argv, opts, options = ActiveSambaLdap::Command.parse_options do |opts, options|
39
41
  opts.banner += " USER_NAME"
40
42
 
41
43
  opts.on("-c", "--[no-]computer-account",
42
- "is a Windows Workstation",
43
- "(otherwise, Windows user)",
44
+ _("is a Windows Workstation"),
45
+ _("(otherwise, Windows user)"),
44
46
  "(#{options.computer_account})") {|options.computer_account|}
45
47
 
46
- opts.on("--gecos=GECOS", "gecos") {|options.gecos|}
48
+ opts.on("--gecos=GECOS", _("gecos")) {|options.gecos|}
47
49
  opts.on("-d", "--home-directory=HOME_DIR",
48
- "home directory") {|options.home_directory|}
50
+ _("home directory")) {|options.home_directory|}
49
51
  opts.on("-m", "--[no-]move-home-directory",
50
- "move home directory (#{options.move_home_directory})") do |bool|
52
+ _("move home directory"),
53
+ "(#{options.move_home_directory})") do |bool|
51
54
  options.move_home_directory = bool
52
55
  end
53
56
  opts.on("-r", "--rename=NEW_NAME",
54
- "new user name (cn and dn are updated)") do |name|
57
+ _("new user name (cn and dn are updated)")) do |name|
55
58
  options.new_user_name = name
56
59
  end
57
- opts.on("-u", "--uid=UID", Integer, "uid") {|options.uid|}
60
+ opts.on("-u", "--uid=UID", Integer, _("uid")) {|options.uid|}
58
61
  opts.on("--[no-]allow-non-unique-uid",
59
- "uid can be non unique " +
62
+ _("uid can be non unique "),
60
63
  "(#{options.allow_non_unique_uid_number})") do |bool|
61
64
  options.allow_non_unique_uid_number = bool
62
65
  end
63
66
  opts.on("-g", "--gid=GID", "gid") {|options.gid|}
64
67
  opts.on("-G", "--groups=GID1,GID2,GID3", Array,
65
- "supplementary groups (comma separated)") do |groups|
68
+ _("supplementary groups (comma separated)")) do |groups|
66
69
  options.supplementary_groups = groups
67
70
  end
68
71
  opts.on("--[no-]merge-groups",
69
- "replace supplementary groups " +
72
+ _("replace supplementary groups "),
70
73
  "(#{!options.merge_groups})") {|options.merge_groups|}
71
- opts.on("-s", "--shell=SHELL", "shell") {|options.shell|}
72
- opts.on("--given-name=NAME", "given name") {|options.given_name|}
73
- opts.on("-N", "--canonical-name=NAME",
74
- "canonical name") {|options.canonical_name|}
75
- opts.on("-S", "--surname=NAME", "surname") {|options.surname|}
74
+ opts.on("-s", "--shell=SHELL", _("shell")) {|options.shell|}
75
+ opts.on("--given-name=NAME", _("given name")) {|options.given_name|}
76
+ opts.on("-N", "--common-name=NAME",
77
+ _("common name")) {|options.common_name|}
78
+ opts.on("-S", "--surname=NAME", _("surname")) {|options.surname|}
76
79
 
77
80
  opts.separator("")
78
- opts.separator("For samba users:")
81
+ opts.separator(_("For samba accounts:"))
79
82
 
80
- opts.on("-e", "--expire-date=DATE", "expire date") do |date|
83
+ opts.on("-e", "--expire-date=DATE", _("expire date")) do |date|
81
84
  options.expire_date = Time.parse(date)
82
85
  end
83
86
  opts.on("-C", "--[no-]can-change-password",
84
- "can change password") do |bool|
87
+ _("can change password")) do |bool|
85
88
  options.can_change_password = bool
86
89
  end
87
90
  opts.on("-M", "--[no-]must-change-password",
88
- "must change password") do |bool|
91
+ _("must change password")) do |bool|
89
92
  options.must_change_password = bool
90
93
  end
91
94
  opts.on("--samba-home-path=PATH",
92
- "sambaHomePath",
93
- "(SMB home share, like '\\\\PDC\\user'") do |path|
95
+ _("sambaHomePath"),
96
+ _("(SMB home share, like '\\\\PDC\\user'")) do |path|
94
97
  options.samba_home_path = path
95
98
  end
96
99
  opts.on("--samba-home-drive=DRIVE",
97
- "sambaHomeDrive",
98
- "(letter associated with home share,",
99
- " like 'H:')") do |drive|
100
+ _("sambaHomeDrive"),
101
+ _("(letter associated with home share, like 'H:')")) do |drive|
100
102
  options.samba_home_drive = drive
101
103
  end
102
104
  opts.on("--samba-logon-script=SCRIPT",
103
- "sambaLogonScript",
104
- "(DOS script to execute on login)") do |script|
105
+ _("sambaLogonScript"),
106
+ _("(DOS script to execute on login)")) do |script|
105
107
  options.samba_logon_script = script
106
108
  end
107
109
  opts.on("--samba-profile-path=PATH",
108
- "sambaProfilePath",
109
- "(profile directory,",
110
- " like '\\\\PDC\\profiles\\user')") do |path|
110
+ _("sambaProfilePath"),
111
+ _("(profile directory, " \
112
+ "like '\\\\PDC\\profiles\\user')")) do |path|
111
113
  options.samba_profile_path = path
112
114
  end
113
115
  opts.on("--samba-account-flags=FLAGS",
114
- "sambaAcctFlags",
115
- "(samba account control bits,",
116
- " like '[NDHTUMWSLXI]')") {|options.samba_account_flags|}
117
- opts.on("-D", "--[no-]disable-user", "disable an user") do |bool|
116
+ _("sambaAcctFlags"),
117
+ _("(samba account control bits, " \
118
+ "like '[NDHTUMWSLXI]')")) {|options.samba_account_flags|}
119
+ opts.on("-D", "--[no-]disable-user", _("disable this user")) do |bool|
118
120
  options.enable = !bool
119
121
  end
120
- opts.on("-E", "--[no-]enable-user", "enable an user") do |bool|
122
+ opts.on("-E", "--[no-]enable-user", _("enable this user")) do |bool|
121
123
  options.enable = bool
122
124
  end
123
125
  # opts.on("--mail-addresses=ADDRESS1,ADDRESS2,ADDRESS3",
124
126
  # Array,
125
- # "mailAddresses (comma separated)") {|options.mail_addresses|}
127
+ # _("mailAddresses (comma separated)")) {|options.mail_addresses|}
126
128
  # opts.on("--mail-to-addresses=ADDRESS1,ADDRESS2,ADDRESS3",
127
129
  # Array,
128
- # "mailToAddresses (forward address)",
129
- # "(comma separated)") do |addresses|
130
+ # _("mailToAddresses (forward address)"),
131
+ # _("(comma separated)")) do |addresses|
130
132
  # options.mail_to_addresses = addresses
131
133
  # end
132
134
  end
@@ -155,21 +157,23 @@ end
155
157
 
156
158
  options.computer_account = true if /\$$/ =~ name
157
159
 
158
- member_class = options.computer_account ? Computer : User
159
- member_type = member_class.name.downcase
160
-
161
160
  if options.computer_account
161
+ member_class = Computer
162
+ member_type = _("computer")
162
163
  name = name.chomp("$") + "$"
164
+ else
165
+ member_class = User
166
+ member_type = _("user")
163
167
  end
164
168
 
165
169
  unless member_class.exists?(name)
166
- $stderr.puts "#{member_type} '#{name}' doesn't exist."
170
+ $stderr.puts(_("%s doesn't exist: %s") % [member_type, name])
167
171
  exit 1
168
172
  end
169
173
  member = member_class.find(name)
170
174
 
171
175
  unless Process.uid.zero?
172
- password = ActiveSambaLdap::Command.read_password("Enter your password: ")
176
+ password = ActiveSambaLdap::Command.read_password(_("Enter your password: "))
173
177
 
174
178
  auth_class = Class.new(ActiveSambaLdap::Base)
175
179
  config = ActiveSambaLdap::Base.configurations["reference"]
@@ -178,7 +182,7 @@ unless Process.uid.zero?
178
182
  :password => password,
179
183
  :allow_anonymous => false))
180
184
  rescue ActiveLdap::AuthenticationError
181
- $stderr.puts "password isn't match"
185
+ $stderr.puts(_("password isn't match."))
182
186
  exit 1
183
187
  ensure
184
188
  auth_class.remove_connection
@@ -220,8 +224,8 @@ if options.home_directory
220
224
  member.home_directory = options.home_directory
221
225
  end
222
226
 
223
- if options.canonical_name
224
- member.cn = options.canonical_name
227
+ if options.common_name
228
+ member.cn = options.common_name
225
229
  end
226
230
 
227
231
  if options.surname
@@ -233,11 +237,11 @@ if options.given_name
233
237
  end
234
238
 
235
239
  if options.mail_addresses
236
- raise "not implemented"
240
+ raise _("not implemented.")
237
241
  end
238
242
 
239
243
  if options.mail_to_addresses
240
- raise "not implemented"
244
+ raise _("not implemented.")
241
245
  end
242
246
 
243
247
  if options.supplementary_groups
@@ -307,7 +311,8 @@ if options.new_user_name
307
311
  options.new_user_name = options.new_user_name.chomp("$") + "$"
308
312
  end
309
313
  if member_class.exists?(options.new_user_name)
310
- $stderr.puts "#{member_type} '#{options.new_user_name}' always exists."
314
+ format = _("%s already exists: %s")
315
+ $stderr.puts(format % [member_type, options.new_user_name])
311
316
  exit 1
312
317
  end
313
318
  new_member = member_class.new(options.new_user_name)
data/bin/asl-usershow CHANGED
@@ -3,6 +3,8 @@
3
3
  require 'active_samba_ldap'
4
4
  require 'active_samba_ldap/command'
5
5
 
6
+ include ActiveSambaLdap::GetTextSupport
7
+
6
8
  argv, opts, options = ActiveSambaLdap::Command.parse_options do |opts, options|
7
9
  opts.banner += " USER_NAME"
8
10
  end
@@ -22,7 +24,7 @@ class User < ActiveSambaLdap::User
22
24
  end
23
25
 
24
26
  unless User.exists?(name)
25
- $stderr.puts "user '#{name}' doesn't exist."
27
+ $stderr.puts(_("user doesn't exist: %s") % name)
26
28
  exit 1
27
29
  end
28
30
  user = User.find(name)
@@ -8,7 +8,7 @@ require_gem_if_need = Proc.new do |library_name, gem_name, *options|
8
8
  end
9
9
  end
10
10
 
11
- required_active_ldap_version = ">= 0.8.2"
11
+ required_active_ldap_version = ">= 0.8.3.1"
12
12
  require_gem_if_need.call("active_ldap", "ruby-activeldap",
13
13
  required_active_ldap_version)
14
14
 
@@ -17,6 +17,7 @@ if Dependencies.respond_to?(:load_paths)
17
17
  end
18
18
 
19
19
  require 'active_samba_ldap/version'
20
+ require 'active_samba_ldap/get_text_support'
20
21
  require 'active_samba_ldap/base'
21
22
  require "active_samba_ldap/configuration"
22
23
  require 'active_samba_ldap/populate'
@@ -72,7 +72,7 @@ module ActiveSambaLdap
72
72
  end
73
73
 
74
74
  def prepare_create_options(account, options)
75
- prepare_create_options_for_number(:uid_number, account, options)
75
+ prepare_create_options_for_number("uid_number", account, options)
76
76
  end
77
77
  end
78
78
 
@@ -85,15 +85,16 @@ module ActiveSambaLdap
85
85
  self.home_directory ||= substituted_value(:user_home_directory)
86
86
  self.login_shell ||= self.class.configuration[:user_login_shell]
87
87
 
88
- password = options[:password]
88
+ options = options.stringify_keys
89
+ password = options["password"]
89
90
  change_password(password) if password
90
91
  self.user_password ||= "{crypt}x"
91
92
 
92
- uid_number = options[:uid_number]
93
+ uid_number = options["uid_number"]
93
94
  self.change_uid_number(uid_number) if uid_number
94
95
 
95
- group = options[:group] || retrieve_default_group(options)
96
- self.primary_group = group if group
96
+ primary_group = options["group"] || retrieve_default_primary_group(options)
97
+ self.primary_group = primary_group if primary_group
97
98
 
98
99
  self
99
100
  end
@@ -177,20 +178,21 @@ module ActiveSambaLdap
177
178
  uid
178
179
  end
179
180
 
180
- def retrieve_default_group(options={})
181
+ def retrieve_default_primary_group(options={})
181
182
  group = nil
182
183
 
183
- gid_number = options[:gid_number]
184
- group_class = options[:group_class]
184
+ gid_number = options["gid_number"]
185
+ group_class = options["group_class"]
186
+ group_class ||= self.class.associated_class(:primary_group)
185
187
  unless gid_number
186
- if options[:create_group]
188
+ if options["create_group"]
187
189
  group_name = created_group_name
188
190
  if group_class.exists?(group_name)
189
191
  group = group_class.find(group_name)
190
192
  else
191
193
  group = group_class.create(:cn => group_name,
192
- :pool => options[:pool],
193
- :pool_class => options[:pool_class])
194
+ :pool => options["pool"],
195
+ :pool_class => options["pool_class"])
194
196
  end
195
197
  else
196
198
  gid_number = default_gid_number
@@ -2,21 +2,21 @@ require 'active_samba_ldap/reloadable'
2
2
 
3
3
  module ActiveSambaLdap
4
4
  class Error < StandardError
5
+ include ActiveSambaLdap::GetTextSupport
5
6
  end
6
7
 
7
- class RequiredVariableIsNotSet < Error
8
- attr_reader :name
9
- def initialize(name)
10
- @name = name
11
- super("required variable '#{name}' is not set")
12
- end
13
- end
14
-
15
- class RequiredVariablesAreNotSet < RequiredVariableIsNotSet
8
+ class MissingRequiredVariableError < Error
16
9
  attr_reader :names
17
10
  def initialize(names)
11
+ names = names.to_a
18
12
  @names = names
19
- super("required variables '#{names.join(', ')}' are not set")
13
+ super(n_("required variable is not set: %s",
14
+ "required variables are not set: %s",
15
+ names.size) % names.join(', '))
16
+ end
17
+
18
+ def name
19
+ @names.first
20
20
  end
21
21
  end
22
22
 
@@ -24,7 +24,7 @@ module ActiveSambaLdap
24
24
  attr_reader :number
25
25
  def initialize(number)
26
26
  @number = number
27
- super("uid number '#{@number}' already exists")
27
+ super(_("uid number already exists: %s") % number)
28
28
  end
29
29
  end
30
30
 
@@ -32,7 +32,7 @@ module ActiveSambaLdap
32
32
  attr_reader :name
33
33
  def initialize(name)
34
34
  @name = name
35
- super("group '#{@name}' doesn't exist")
35
+ super(_("group doesn't exist: %s") % name)
36
36
  end
37
37
  end
38
38
 
@@ -40,7 +40,7 @@ module ActiveSambaLdap
40
40
  attr_reader :number
41
41
  def initialize(number)
42
42
  @number = number
43
- super("gid number '#{@number}' already exists")
43
+ super(_("gid number already exists: %s") % number)
44
44
  end
45
45
  end
46
46
 
@@ -48,7 +48,7 @@ module ActiveSambaLdap
48
48
  attr_reader :number
49
49
  def initialize(number)
50
50
  @number = number
51
- super("gid number '#{@number}' doesn't exist")
51
+ super(_("gid number doesn't exist: %s") % number)
52
52
  end
53
53
  end
54
54
 
@@ -56,7 +56,7 @@ module ActiveSambaLdap
56
56
  attr_reader :number
57
57
  def initialize(number)
58
58
  @number = number
59
- super("sambaSID attribute doesn't exist for gid number '#{@number}'")
59
+ super(_("sambaSID attribute doesn't exist for gid number '%s'") % number)
60
60
  end
61
61
  end
62
62
 
@@ -65,9 +65,9 @@ module ActiveSambaLdap
65
65
  def initialize(group, members)
66
66
  @group = group
67
67
  @members = members
68
- message = "cannot change primary group from '#{group}' to other group "
69
- message << "due to no other belonged groups: #{members.join(', ')}"
70
- super(message)
68
+ format = _("cannot change primary group from '%s' to other group " \
69
+ "due to no other belonged groups: %s")
70
+ super(format % [group, members.join(', ')])
71
71
  end
72
72
  end
73
73
 
@@ -76,9 +76,9 @@ module ActiveSambaLdap
76
76
  def initialize(group, members)
77
77
  @group = group
78
78
  @members = members
79
- message = "cannot destroy group '#{group}' due to members who belong "
80
- message << "to the group as primary group: #{members.join(', ')}"
81
- super(message)
79
+ format = _("cannot destroy group '%s' due to members who belong " \
80
+ "to the group as primary group: %s")
81
+ super(format % [group, members.join(', ')])
82
82
  end
83
83
  end
84
84
 
@@ -88,8 +88,8 @@ module ActiveSambaLdap
88
88
  @file = file
89
89
  @location = location
90
90
  @detail = detail
91
- super("found invalid configuration format at #{@file}:#{@location}" +
92
- ": #{@detail}")
91
+ format = _("found invalid configuration format at %s:%s: %s")
92
+ super(format % [file, location, detail])
93
93
  end
94
94
  end
95
95
 
@@ -99,7 +99,8 @@ module ActiveSambaLdap
99
99
  @name = name
100
100
  @value = value
101
101
  @detail = detail
102
- super("the value of #{@name} '#{@value.inspect}' is invalid: #{@detail}")
102
+ format = _("the value of %s '%s' is invalid: %s")
103
+ super(format % [name, value.inspect, detail])
103
104
  end
104
105
  end
105
106
 
@@ -107,7 +108,7 @@ module ActiveSambaLdap
107
108
  attr_reader :object
108
109
  def initialize(object)
109
110
  @object = object
110
- super("#{@object.inspect} is not Samba available")
111
+ super(_("%s is not Samba available") % [object.inspect])
111
112
  end
112
113
  end
113
114