french_rails 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,8 +1,6 @@
1
1
  # FrenchRails
2
2
  module FrenchRails
3
3
  class Railtie < Rails::Railtie
4
- railtie_name :french_rails
5
-
6
4
  initializer :load_french_rails => :load_application_initializers do
7
5
  require 'french_rails/backend/simple'
8
6
  require 'french_rails/action_view/text_helper'
@@ -1,25 +1,23 @@
1
- require 'i18n/backend/base'
2
- require 'i18n/backend/fast'
1
+ require 'i18n/backend/simple'
2
+ require 'i18n/backend/memoize'
3
3
 
4
4
  module FrenchRails
5
- module Backend
6
- class Simple
7
- include I18n::Backend::Base
8
- include I18n::Backend::Fast
9
-
10
- # The french grammar rules are not the same that for english.
11
- # For our concern, the main difference is 0:
12
- # in english, 0 is plural, but in french, it's singular.
13
- #
14
- def pluralize(locale, entry, count)
15
- return entry unless entry.is_a?(Hash) and count
16
- key = :zero if count == 0 && entry.has_key?(:zero)
17
- key ||= count <= 1 ? :one : :other
18
- raise InvalidPluralizationData.new(entry, count) unless entry.has_key?(key)
19
- entry[key]
20
- end
21
-
5
+ module Pluralization
6
+ # The french grammar rules are not the same that for english.
7
+ # For our concern, the main difference is 0:
8
+ # in english, 0 is plural, but in french, it's singular.
9
+ #
10
+ def pluralize(locale, entry, count)
11
+ return entry unless entry.is_a?(Hash) and count
12
+ key = :zero if count == 0 && entry.has_key?(:zero)
13
+ key ||= count <= 1 ? :one : :other
14
+ raise InvalidPluralizationData.new(entry, count) unless entry.has_key?(key)
15
+ entry[key]
22
16
  end
23
17
  end
24
18
  end
25
19
 
20
+ class I18n::Backend::Simple
21
+ include FrenchRails::Pluralization
22
+ include I18n::Backend::Memoize
23
+ end
@@ -1,3 +1,2 @@
1
- I18n.backend = FrenchRails::Backend::Simple.new
2
1
  I18n.load_path << Dir[File.join(File.dirname(__FILE__), '..', '..', 'locales', '*.{rb,yml}')]
3
2
  I18n.default_locale = :fr
@@ -4,14 +4,29 @@ fr:
4
4
  separator: ","
5
5
  delimiter: " "
6
6
  precision: 3
7
+ significant: false
8
+ strip_insignificant_zeros: false
7
9
  currency:
8
10
  format:
9
11
  format: "%n %u"
10
12
  unit: "€"
13
+ separator: ","
14
+ delimiter: " "
11
15
  precision: 2
16
+ significant: false
17
+ strip_insignificant_zeros: false
18
+ percentage:
19
+ format:
20
+ delimiter: ""
21
+ precision:
22
+ format:
23
+ delimiter: ""
12
24
  human:
13
25
  format:
26
+ delimiter: ""
14
27
  precision: 2
28
+ significant: true
29
+ strip_insignificant_zeros: true
15
30
  storage_units:
16
31
  format: "%n %u"
17
32
  units:
@@ -22,6 +37,15 @@ fr:
22
37
  mb: "Mo"
23
38
  gb: "Go"
24
39
  tb: "To"
40
+ decimal_units:
41
+ format: "%n %u"
42
+ units:
43
+ unit: ""
44
+ thousand: Millier
45
+ million: Million
46
+ billion: Milliard
47
+ trillion: Mille milliard
48
+ quadrillion: Million de milliard
25
49
 
26
50
  datetime:
27
51
  distance_in_words:
@@ -29,35 +53,38 @@ fr:
29
53
  less_than_x_seconds:
30
54
  zero: "moins d'une seconde"
31
55
  one: "moins d'une seconde"
32
- other: "moins de {{count}} secondes"
56
+ other: "moins de %{count} secondes"
33
57
  x_seconds:
34
58
  one: "1 seconde"
35
- other: "{{count}} secondes"
59
+ other: "%{count} secondes"
36
60
  less_than_x_minutes:
37
61
  zero: "moins d'une minute"
38
62
  one: "moins d'une minute"
39
- other: "moins de {{count}} minutes"
63
+ other: "moins de %{count} minutes"
40
64
  x_minutes:
41
65
  one: "1 minute"
42
- other: "{{count}} minutes"
66
+ other: "%{count} minutes"
43
67
  about_x_hours:
44
68
  one: "environ une heure"
45
- other: "environ {{count}} heures"
69
+ other: "environ %{count} heures"
46
70
  x_days:
47
71
  one: "1 jour"
48
- other: "{{count}} jours"
72
+ other: "%{count} jours"
49
73
  about_x_months:
50
74
  one: "environ un mois"
51
- other: "environ {{count}} mois"
75
+ other: "environ %{count} mois"
52
76
  x_months:
53
77
  one: "1 mois"
54
- other: "{{count}} mois"
78
+ other: "%{count} mois"
55
79
  about_x_years:
56
80
  one: "environ un an"
57
- other: "environ {{count}} ans"
81
+ other: "environ %{count} ans"
58
82
  over_x_years:
59
83
  one: "plus d'un an"
60
- other: "plus de {{count}} ans"
84
+ other: "plus de %{count} ans"
85
+ almost_x_years:
86
+ one: "presqu'un an"
87
+ other: "presque %{count} ans"
61
88
  prompts:
62
89
  year: "Année"
63
90
  month: "Mois"
@@ -69,15 +96,14 @@ fr:
69
96
  errors:
70
97
  template:
71
98
  header:
72
- one: "Impossible d'enregistrer ce {{model}} : 1 erreur"
73
- other: "Impossible d'enregistrer ce {{model}} : {{count}} erreurs"
99
+ one: "Impossible d'enregistrer ce %{model} : 1 erreur"
100
+ other: "Impossible d'enregistrer ce %{model} : %{count} erreurs"
74
101
  body: "Veuillez vérifier les champs suivants : "
75
102
 
76
103
  helpers:
77
104
  select:
78
105
  prompt: "Veuillez sélectionner"
79
106
  submit:
80
- create: "Créer {{model}}"
81
- update: "Modifier {{model}}"
82
- submit: "Enregistrer {{model}}"
83
-
107
+ create: "Créer un %{model}"
108
+ update: "Modifier ce %{model}"
109
+ submit: "Enregistrer ce %{model}"
@@ -1,6 +1,6 @@
1
1
  fr:
2
2
  errors:
3
- format: "Le {{attribute}} {{message}}"
3
+ format: "Le %{attribute} %{message}"
4
4
  messages:
5
5
  inclusion: "n'est pas inclus(e) dans la liste"
6
6
  exclusion: "n'est pas disponible"
@@ -9,14 +9,15 @@ fr:
9
9
  accepted: "doit être accepté(e)"
10
10
  empty: "doit être rempli(e)"
11
11
  blank: "doit être rempli(e)"
12
- too_long: "est trop long (pas plus de {{count}} caractères)"
13
- too_short: "est trop court (au moins {{count}} caractères)"
14
- wrong_length: "ne fait pas la bonne longueur (doit comporter {{count}} caractères)"
12
+ too_long: "est trop long (pas plus de %{count} caractères)"
13
+ too_short: "est trop court (au moins %{count} caractères)"
14
+ wrong_length: "ne fait pas la bonne longueur (doit comporter %{count} caractères)"
15
15
  not_a_number: "n'est pas un nombre"
16
- greater_than: "doit être supérieur à {{count}}"
17
- greater_than_or_equal_to: "doit être supérieur ou égal à {{count}}"
18
- equal_to: "doit être égal à {{count}}"
19
- less_than: "doit être inférieur à {{count}}"
20
- less_than_or_equal_to: "doit être inférieur ou égal à {{count}}"
16
+ not_an_integer: "doit être un nombre entier"
17
+ greater_than: "doit être supérieur à %{count}"
18
+ greater_than_or_equal_to: "doit être supérieur ou égal à %{count}"
19
+ equal_to: "doit être égal à %{count}"
20
+ less_than: "doit être inférieur à %{count}"
21
+ less_than_or_equal_to: "doit être inférieur ou égal à %{count}"
21
22
  odd: "doit être impair"
22
23
  even: "doit être pair"
@@ -6,4 +6,4 @@ fr:
6
6
  errors:
7
7
  messages:
8
8
  taken: "n'est pas disponible"
9
- record_invalid: "Échec de la validation : {{errors}}"
9
+ record_invalid: "Échec de la validation : %{errors}"
@@ -3,12 +3,11 @@ fr:
3
3
  flash:
4
4
  actions:
5
5
  create:
6
- notice: "{{resource_name}} créé(e)"
7
- alert: "{{resource_name}} impossible à créer"
6
+ notice: "%{resource_name} créé(e)"
7
+ alert: "%{resource_name} impossible à créer"
8
8
  update:
9
- notice: "{{resource_name}} mis(e) à jour"
10
- alert: "{{resource_name}} impossible à mettre à jour"
9
+ notice: "%{resource_name} mis(e) à jour"
10
+ alert: "%{resource_name} impossible à mettre à jour"
11
11
  destroy:
12
- notice: "{{resource_name}} supprimé(e)"
13
- alert: "{{resource_name}} impossible à supprimer"
14
-
12
+ notice: "%{resource_name} supprimé(e)"
13
+ alert: "%{resource_name} impossible à supprimer"
metadata CHANGED
@@ -1,7 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: french_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ hash: 19
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 2
9
+ - 2
10
+ version: 0.2.2
5
11
  platform: ruby
6
12
  authors:
7
13
  - Bruno Michel
@@ -9,11 +15,26 @@ autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
17
 
12
- date: 2010-02-16 00:00:00 +01:00
18
+ date: 2010-06-09 00:00:00 +02:00
13
19
  default_executable:
14
- dependencies: []
15
-
16
- description: A plugin for Ruby on Rails for simple french localization
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: i18n
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 13
30
+ segments:
31
+ - 0
32
+ - 4
33
+ - 1
34
+ version: 0.4.1
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ description: A Rails3 plugin for simple french localization
17
38
  email: bmichel@menfin.info
18
39
  executables: []
19
40
 
@@ -22,51 +43,52 @@ extensions: []
22
43
  extra_rdoc_files:
23
44
  - README
24
45
  files:
25
- - .document
26
- - .gitignore
27
46
  - MIT-LICENSE
28
47
  - README
29
- - Rakefile
30
- - VERSION
31
- - french_rails.gemspec
32
48
  - init.rb
33
49
  - lib/french_rails.rb
50
+ - lib/french_rails/i18n.rb
51
+ - lib/french_rails/backend/simple.rb
34
52
  - lib/french_rails/action_dispatch/resources_path_names.rb
35
53
  - lib/french_rails/action_view/text_helper.rb
36
- - lib/french_rails/backend/simple.rb
37
- - lib/french_rails/i18n.rb
38
54
  - locales/fr_actionpack.yml
39
55
  - locales/fr_activemodel.yml
40
- - locales/fr_activerecord.yml
41
56
  - locales/fr_activesupport.yml
42
57
  - locales/fr_responders.yml
58
+ - locales/fr_activerecord.yml
43
59
  has_rdoc: true
44
60
  homepage: http://github.com/nono/french-rails
45
61
  licenses: []
46
62
 
47
63
  post_install_message:
48
- rdoc_options:
49
- - --charset=UTF-8
64
+ rdoc_options: []
65
+
50
66
  require_paths:
51
67
  - lib
52
68
  required_ruby_version: !ruby/object:Gem::Requirement
69
+ none: false
53
70
  requirements:
54
71
  - - ">="
55
72
  - !ruby/object:Gem::Version
73
+ hash: 3
74
+ segments:
75
+ - 0
56
76
  version: "0"
57
- version:
58
77
  required_rubygems_version: !ruby/object:Gem::Requirement
78
+ none: false
59
79
  requirements:
60
80
  - - ">="
61
81
  - !ruby/object:Gem::Version
82
+ hash: 3
83
+ segments:
84
+ - 0
62
85
  version: "0"
63
- version:
64
86
  requirements: []
65
87
 
66
88
  rubyforge_project:
67
- rubygems_version: 1.3.5
89
+ rubygems_version: 1.3.7
68
90
  signing_key:
69
91
  specification_version: 3
70
- summary: Simple french localization for Rails
92
+ summary: Simple french localization for Rails3
71
93
  test_files: []
72
94
 
data/.document DELETED
@@ -1,6 +0,0 @@
1
- README.rdoc
2
- lib/**/*.rb
3
- locales/*
4
- bin/*
5
- features/**/*.feature
6
- LICENSE
data/.gitignore DELETED
@@ -1 +0,0 @@
1
- pkg
data/Rakefile DELETED
@@ -1,19 +0,0 @@
1
- require 'rubygems'
2
- require 'rake'
3
-
4
- begin
5
- require 'jeweler'
6
- Jeweler::Tasks.new do |gem|
7
- gem.name = "french_rails"
8
- gem.summary = %Q{Simple french localization for Rails}
9
- gem.description = %Q{A plugin for Ruby on Rails for simple french localization}
10
- gem.email = "bmichel@menfin.info"
11
- gem.homepage = "http://github.com/nono/french-rails"
12
- gem.authors = ["Bruno Michel"]
13
- end
14
- Jeweler::GemcutterTasks.new
15
- rescue LoadError
16
- puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
17
- end
18
-
19
- task :default => :check_dependencies
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.2.1
@@ -1,54 +0,0 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
- # -*- encoding: utf-8 -*-
5
-
6
- Gem::Specification.new do |s|
7
- s.name = %q{french_rails}
8
- s.version = "0.2.1"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Bruno Michel"]
12
- s.date = %q{2010-02-16}
13
- s.description = %q{A plugin for Ruby on Rails for simple french localization}
14
- s.email = %q{bmichel@menfin.info}
15
- s.extra_rdoc_files = [
16
- "README"
17
- ]
18
- s.files = [
19
- ".document",
20
- ".gitignore",
21
- "MIT-LICENSE",
22
- "README",
23
- "Rakefile",
24
- "VERSION",
25
- "french_rails.gemspec",
26
- "init.rb",
27
- "lib/french_rails.rb",
28
- "lib/french_rails/action_dispatch/resources_path_names.rb",
29
- "lib/french_rails/action_view/text_helper.rb",
30
- "lib/french_rails/backend/simple.rb",
31
- "lib/french_rails/i18n.rb",
32
- "locales/fr_actionpack.yml",
33
- "locales/fr_activemodel.yml",
34
- "locales/fr_activerecord.yml",
35
- "locales/fr_activesupport.yml",
36
- "locales/fr_responders.yml"
37
- ]
38
- s.homepage = %q{http://github.com/nono/french-rails}
39
- s.rdoc_options = ["--charset=UTF-8"]
40
- s.require_paths = ["lib"]
41
- s.rubygems_version = %q{1.3.5}
42
- s.summary = %q{Simple french localization for Rails}
43
-
44
- if s.respond_to? :specification_version then
45
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
46
- s.specification_version = 3
47
-
48
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
49
- else
50
- end
51
- else
52
- end
53
- end
54
-