i18n_rails_helpers 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,11 +9,12 @@ Example
9
9
 
10
10
  t_attr('first_name') => 'Vorname' # when called in patients_controller views
11
11
  t_model => 'Konto' # when called in patients_controller views
12
- t_crud('delete') => 'Konto löschen' # when called in accounts_controller views
12
+ t_title('delete') => 'Konto löschen' # when called in accounts_controller views
13
+ t_action('index') => 'Liste'
13
14
  t_confirm_delete(@account) => 'Konto Kasse wirklich löschen'
14
15
 
15
16
 
16
17
  Copyright (c) 2010 Simon Hürlimann <simon.huerlimann@cyt.ch>
17
18
  Copyright (c) 2010 CyT <http://www.cyt.ch>
18
19
 
19
- Released under the MIT license
20
+ Released under the MIT license.
data/Rakefile CHANGED
@@ -22,7 +22,7 @@ begin
22
22
  s.author = AUTHOR
23
23
 
24
24
  s.require_path = 'lib'
25
- s.files = %w(MIT-LICENSE README Rakefile) + Dir.glob("{lib,test,rails,config}/**/*")
25
+ s.files = %w(MIT-LICENSE README.markdown Rakefile) + Dir.glob("{lib,test,rails,config}/**/*")
26
26
 
27
27
  # Runtime dependencies: When installing i18n_rails_helpers these will be checked if they are installed.
28
28
  # Will be offered to install these if they are not already installed.
@@ -51,6 +51,6 @@ Rake::RDocTask.new(:rdoc) do |rdoc|
51
51
  rdoc.rdoc_dir = 'rdoc'
52
52
  rdoc.title = 'I18nRailsHelpers'
53
53
  rdoc.options << '--line-numbers' << '--inline-source'
54
- rdoc.rdoc_files.include('README')
54
+ rdoc.rdoc_files.include('README.markdown')
55
55
  rdoc.rdoc_files.include('lib/**/*.rb')
56
56
  end
@@ -3,8 +3,19 @@ de:
3
3
  confirm_delete: "%{model} %{record} wirklich löschen?"
4
4
 
5
5
  crud:
6
- index: "%{model} Liste"
7
- edit: "%{model} bearbeiten"
8
- show: "%{model} anzeigen"
9
- new: "%{model} anlegen"
10
- back: "zurück"
6
+ title:
7
+ index: "%{model} Liste"
8
+ edit: "%{model} bearbeiten"
9
+ show: "%{model} anzeigen"
10
+ new: "%{model} anlegen"
11
+ delete: "%{model} löschen"
12
+ back: "Zurück"
13
+ action:
14
+ index: "Liste"
15
+ edit: "Bearbeiten"
16
+ show: "Anzeigen"
17
+ new: "Anlegen"
18
+ delete: "Löschen"
19
+ back: "Zurück"
20
+
21
+
@@ -47,14 +47,34 @@ module I18nRailsHelpers
47
47
  # If no +model+ is given, it uses the controller name to guess the model by
48
48
  # singularize it. +model+ can be both a class or an actual instance.
49
49
  #
50
+ # The translation file comming with the plugin supports the following actions
51
+ # by default: index, edit, show, new, delete, back
52
+ #
53
+ # Example:
54
+ # t_title('new', Account') => 'Konto anlegen'
55
+ # t_title('delete') => 'Konto löschen' # when called in accounts_controller views
56
+ # t_title => 'Konto ändern' # when called in accounts_controller edit view
57
+ #
58
+ def t_title(action = nil, model = nil)
59
+ action ||= action_name
60
+ I18n::translate(action, :scope => 'crud.title', :model => t_model(model))
61
+ end
62
+ alias :t_crud :t_title
63
+
64
+ # Returns translated string for current +action+.
65
+ #
66
+ # If no +action+ is given, it uses the current action.
67
+ #
68
+ # The translation file comming with the plugin supports the following actions
69
+ # by default: index, edit, show, new, delete, back
70
+ #
50
71
  # Example:
51
- # t_crud('new', Account') => 'Konto anlegen'
52
- # t_crud('delete') => 'Konto löschen' # when called in accounts_controller views
53
- # t_crud => 'Konto ändern' # when called in accounts_controller edit view
72
+ # t_action('delete') => 'Löschen'
73
+ # t_action => 'Ändern' # when called in an edit view
54
74
  #
55
- def t_crud(action = nil, model = nil)
75
+ def t_action(action = nil, model = nil)
56
76
  action ||= action_name
57
- I18n::translate(action, :scope => :crud, :model => t_model(model))
77
+ I18n::translate(action, :scope => 'crud.action', :model => t_model(model))
58
78
  end
59
79
 
60
80
  # Returns translated deletion confirmation for +record+.
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 6
7
+ - 7
8
8
  - 0
9
- version: 0.6.0
9
+ version: 0.7.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - "Simon H\xC3\xBCrlimann"
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-07-28 00:00:00 +02:00
17
+ date: 2010-07-29 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -48,10 +48,10 @@ executables: []
48
48
  extensions: []
49
49
 
50
50
  extra_rdoc_files:
51
- - README
51
+ - README.markdown
52
52
  files:
53
53
  - MIT-LICENSE
54
- - README
54
+ - README.markdown
55
55
  - Rakefile
56
56
  - config/locales/de.yml
57
57
  - lib/i18n_rails_helpers.rb