french_rails 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ pkg
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Bruno Michel
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README ADDED
@@ -0,0 +1,20 @@
1
+ FrenchRails
2
+ ===========
3
+
4
+ Summary (in english)
5
+ --------------------
6
+
7
+ A plugin for Rails for simple french localization.
8
+
9
+
10
+ Description (en français)
11
+ -------------------------
12
+
13
+ Ce plugin permet de profiter de l'internationalisation de Rails pour des
14
+ applications entièrement en français. Il modifie les règles d'accord des
15
+ pluriels de Rails pour se conformer à la grammaire française, et il charge les
16
+ traductions des termes utilisés par Rails. Il traduit également les 'new' et
17
+ 'edit' se trouvant dans les URL générées par Rails.
18
+
19
+
20
+ Copyright (c) 2009 Bruno Michel <bmichel@menfin.info>, released under the MIT license
data/Rakefile ADDED
@@ -0,0 +1,19 @@
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 ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
@@ -0,0 +1,50 @@
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.1.0"
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{2009-12-23}
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_controller/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_rails.yml"
33
+ ]
34
+ s.homepage = %q{http://github.com/nono/french-rails}
35
+ s.rdoc_options = ["--charset=UTF-8"]
36
+ s.require_paths = ["lib"]
37
+ s.rubygems_version = %q{1.3.5}
38
+ s.summary = %q{Simple french localization for Rails}
39
+
40
+ if s.respond_to? :specification_version then
41
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
42
+ s.specification_version = 3
43
+
44
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
45
+ else
46
+ end
47
+ else
48
+ end
49
+ end
50
+
data/init.rb ADDED
@@ -0,0 +1 @@
1
+ require 'french_rails'
@@ -0,0 +1,4 @@
1
+ # FrenchRails
2
+ require 'french_rails/backend/simple'
3
+ require 'french_rails/action_view/text_helper'
4
+ require 'french_rails/action_controller/resources_path_names'
@@ -0,0 +1,4 @@
1
+ ActionController::Base.resources_path_names = {
2
+ :new => 'nouveau',
3
+ :edit => 'modifier'
4
+ }
@@ -0,0 +1,21 @@
1
+ require 'action_view/helpers/text_helper'
2
+
3
+ module ActionView
4
+ module Helpers
5
+ module TextHelper
6
+
7
+ # Monkey-patch the pluralize from ActionView::Helpers::TextHelper
8
+ # to the french grammar rules (ie 0 is singular).
9
+ #
10
+ # Example:
11
+ # pluralize(0, 'image') => 0 image
12
+ # pluralize(1, 'image') => 1 image
13
+ # pluralize(2, 'image') => 2 images
14
+ #
15
+ def pluralize(count, singular, plural = nil)
16
+ "#{count || 0} " + ((count.to_i <= 1) ? singular : (plural || singular.pluralize))
17
+ end
18
+
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,22 @@
1
+ require 'i18n/backend/simple'
2
+
3
+ module FrenchRails
4
+ module Backend
5
+ class Simple < I18n::Backend::Simple
6
+
7
+ # The french grammar rules are not the same that for english.
8
+ # For our concern, the main difference is 0:
9
+ # in english, 0 is plural, but in french, it's singular.
10
+ #
11
+ def pluralize(locale, entry, count)
12
+ return entry unless entry.is_a?(Hash) and count
13
+ key = :zero if count == 0 && entry.has_key?(:zero)
14
+ key ||= count <= 1 ? :one : :other
15
+ raise InvalidPluralizationData.new(entry, count) unless entry.has_key?(key)
16
+ entry[key]
17
+ end
18
+
19
+ end
20
+ end
21
+ end
22
+
@@ -0,0 +1,3 @@
1
+ I18n.backend = FrenchRails::Backend::Simple.new
2
+ I18n.load_path << Dir[File.join(File.dirname(__FILE__), 'locales', '*.{rb,yml}')]
3
+ I18n.default_locale = :fr
@@ -0,0 +1,123 @@
1
+ # French translations for Ruby on Rails
2
+ # by Christian Lescuyer (christian@flyingcoders.com)
3
+ # contributor: Sebastien Grosjean - ZenCocoon.com
4
+
5
+ fr:
6
+ date:
7
+ formats:
8
+ default: "%d/%m/%Y"
9
+ short: "%e %b"
10
+ long: "%e %B %Y"
11
+ long_ordinal: "%e %B %Y"
12
+ only_day: "%e"
13
+
14
+ day_names: [dimanche, lundi, mardi, mercredi, jeudi, vendredi, samedi]
15
+ abbr_day_names: [dim, lun, mar, mer, jeu, ven, sam]
16
+ month_names: [~, janvier, février, mars, avril, mai, juin, juillet, août, septembre, octobre, novembre, décembre]
17
+ abbr_month_names: [~, jan., fév., mar., avr., mai, juin, juil., août, sept., oct., nov., déc.]
18
+ order: [ :day, :month, :year ]
19
+
20
+ time:
21
+ formats:
22
+ default: "%d %B %Y %H:%M"
23
+ time: "%H:%M"
24
+ short: "%d %b %H:%M"
25
+ long: "%A %d %B %Y %H:%M:%S %Z"
26
+ long_ordinal: "%A %d %B %Y %H:%M:%S %Z"
27
+ only_second: "%S"
28
+ am: 'am'
29
+ pm: 'pm'
30
+
31
+ datetime:
32
+ distance_in_words:
33
+ half_a_minute: "une demi-minute"
34
+ less_than_x_seconds:
35
+ zero: "moins d'une seconde"
36
+ one: "moins de 1 seconde"
37
+ other: "moins de {{count}} secondes"
38
+ x_seconds:
39
+ one: "1 seconde"
40
+ other: "{{count}} secondes"
41
+ less_than_x_minutes:
42
+ zero: "moins d'une minute"
43
+ one: "moins de 1 minute"
44
+ other: "moins de {{count}} minutes"
45
+ x_minutes:
46
+ one: "1 minute"
47
+ other: "{{count}} minutes"
48
+ about_x_hours:
49
+ one: "environ une heure"
50
+ other: "environ {{count}} heures"
51
+ x_days:
52
+ one: "1 jour"
53
+ other: "{{count}} jours"
54
+ about_x_months:
55
+ one: "environ un mois"
56
+ other: "environ {{count}} mois"
57
+ x_months:
58
+ one: "1 mois"
59
+ other: "{{count}} mois"
60
+ about_x_years:
61
+ one: "environ un an"
62
+ other: "environ {{count}} ans"
63
+ over_x_years:
64
+ one: "plus d'un an"
65
+ other: "plus de {{count}} ans"
66
+ prompts:
67
+ year: "Année"
68
+ month: "Mois"
69
+ day: "Jour"
70
+ hour: "Heure"
71
+ minute: "Minute"
72
+ second: "Seconde"
73
+
74
+ number:
75
+ format:
76
+ precision: 3
77
+ separator: ','
78
+ delimiter: ' '
79
+ currency:
80
+ format:
81
+ unit: '€'
82
+ precision: 2
83
+ format: '%n %u'
84
+ human:
85
+ format:
86
+ precision: 2
87
+ storage_units: [ Octet, ko, Mo, Go, To ]
88
+
89
+ support:
90
+ array:
91
+ sentence_connector: 'et'
92
+ skip_last_comma: true
93
+ words_connector: ", "
94
+ two_words_connector: " et "
95
+ last_word_connector: " et "
96
+
97
+ activerecord:
98
+ errors:
99
+ template:
100
+ header:
101
+ one: "Impossible d'enregistrer {{model}}: 1 erreur"
102
+ other: "Impossible d'enregistrer {{model}}: {{count}} erreurs."
103
+ body: "Veuillez vérifier les champs suivants :"
104
+ messages:
105
+ inclusion: "n'est pas inclus(e) dans la liste"
106
+ exclusion: "n'est pas disponible"
107
+ invalid: "n'est pas valide"
108
+ confirmation: "ne concorde pas avec la confirmation"
109
+ accepted: "doit être accepté(e)"
110
+ empty: "doit être rempli(e)"
111
+ blank: "doit être rempli(e)"
112
+ too_long: "est trop long (pas plus de {{count}} caractères)"
113
+ too_short: "est trop court (au moins {{count}} caractères)"
114
+ wrong_length: "ne fait pas la bonne longueur (doit comporter {{count}} caractères)"
115
+ taken: "n'est pas disponible"
116
+ not_a_number: "n'est pas un nombre"
117
+ greater_than: "doit être supérieur à {{count}}"
118
+ greater_than_or_equal_to: "doit être supérieur ou égal à {{count}}"
119
+ equal_to: "doit être égal à {{count}}"
120
+ less_than: "doit être inférieur à {{count}}"
121
+ less_than_or_equal_to: "doit être inférieur ou égal à {{count}}"
122
+ odd: "doit être impair"
123
+ even: "doit être pair"
metadata ADDED
@@ -0,0 +1,68 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: french_rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Bruno Michel
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-12-23 00:00:00 +01:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: A plugin for Ruby on Rails for simple french localization
17
+ email: bmichel@menfin.info
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - README
24
+ files:
25
+ - .document
26
+ - .gitignore
27
+ - MIT-LICENSE
28
+ - README
29
+ - Rakefile
30
+ - VERSION
31
+ - french_rails.gemspec
32
+ - init.rb
33
+ - lib/french_rails.rb
34
+ - lib/french_rails/action_controller/resources_path_names.rb
35
+ - lib/french_rails/action_view/text_helper.rb
36
+ - lib/french_rails/backend/simple.rb
37
+ - lib/french_rails/i18n.rb
38
+ - locales/fr_rails.yml
39
+ has_rdoc: true
40
+ homepage: http://github.com/nono/french-rails
41
+ licenses: []
42
+
43
+ post_install_message:
44
+ rdoc_options:
45
+ - --charset=UTF-8
46
+ require_paths:
47
+ - lib
48
+ required_ruby_version: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: "0"
53
+ version:
54
+ required_rubygems_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: "0"
59
+ version:
60
+ requirements: []
61
+
62
+ rubyforge_project:
63
+ rubygems_version: 1.3.5
64
+ signing_key:
65
+ specification_version: 3
66
+ summary: Simple french localization for Rails
67
+ test_files: []
68
+