brails 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,14 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = 'brails'
3
+ s.version = '0.0.8'
4
+ s.date = '2013-01-29'
5
+ s.summary = "Brails!"
6
+ s.description = "The solutions for your ugly hack translations"
7
+ s.authors = ["Waldyr Araújo"]
8
+ s.email = 'waldyr.ar@gmail.com'
9
+ s.homepage = 'https://github.com/waldyr/brails'
10
+
11
+ s.files = `git ls-files`.split("\n")
12
+ s.test_files = `git ls-files -- test/*`.split("\n")
13
+ s.require_paths = ["lib"]
14
+ end
@@ -0,0 +1,4 @@
1
+ require 'rails'
2
+
3
+ module Brails
4
+ end
@@ -0,0 +1,13 @@
1
+ module Brails
2
+ module Generators
3
+ class InstallGenerator < Rails::Generators::Base
4
+ source_root File.expand_path("../../templates", __FILE__)
5
+
6
+ desc "Creates Brails inflections file to your application."
7
+
8
+ def generate_inflections
9
+ template "brails_inflections.rb", "config/initializers/brails_inflections.rb"
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,55 @@
1
+ ActiveSupport::Inflector.inflections do |inflect|
2
+ inflect.clear
3
+
4
+ inflect.plural(/$/, 's')
5
+ inflect.plural(/(s)$/i, '\1')
6
+ inflect.plural(/^(paí)s$/i, '\1ses')
7
+ inflect.plural(/(z|r)$/i, '\1es')
8
+ inflect.plural(/al$/i, 'ais')
9
+ inflect.plural(/el$/i, 'eis')
10
+ inflect.plural(/ol$/i, 'ois')
11
+ inflect.plural(/ul$/i, 'uis')
12
+ inflect.plural(/([^aeou])il$/i, '\1is')
13
+ inflect.plural(/m$/i, 'ns')
14
+ inflect.plural(/^(japon|escoc|ingl|dinamarqu|fregu|portugu)ês$/i, '\1eses')
15
+ inflect.plural(/^(|g)ás$/i, '\1ases')
16
+ inflect.plural(/ão$/i, 'ões')
17
+ inflect.plural(/^(irm|m)ão$/i, '\1ãos')
18
+ inflect.plural(/^(alem|c|p)ão$/i, '\1ães')
19
+
20
+ # Sem acentos...
21
+ inflect.plural(/ao$/i, 'oes')
22
+ inflect.plural(/^(irm|m)ao$/i, '\1aos')
23
+ inflect.plural(/^(alem|c|p)ao$/i, '\1aes')
24
+
25
+ inflect.singular(/([^ê])s$/i, '\1')
26
+ inflect.singular(/^(á|gá|paí)s$/i, '\1s')
27
+ inflect.singular(/(r|z)es$/i, '\1')
28
+ inflect.singular(/([^p])ais$/i, '\1al')
29
+ inflect.singular(/eis$/i, 'el')
30
+ inflect.singular(/ois$/i, 'ol')
31
+ inflect.singular(/uis$/i, 'ul')
32
+ inflect.singular(/(r|t|f|v)is$/i, '\1il')
33
+ inflect.singular(/ns$/i, 'm')
34
+ inflect.singular(/sses$/i, 'sse')
35
+ inflect.singular(/^(.*[^s]s)es$/i, '\1')
36
+ inflect.singular(/ães$/i, 'ão')
37
+ inflect.singular(/aes$/i, 'ao')
38
+ inflect.singular(/ãos$/i, 'ão')
39
+ inflect.singular(/aos$/i, 'ao')
40
+ inflect.singular(/ões$/i, 'ão')
41
+ inflect.singular(/oes$/i, 'ao')
42
+ inflect.singular(/(japon|escoc|ingl|dinamarqu|fregu|portugu)eses$/i, '\1ês')
43
+ inflect.singular(/^(g|)ases$/i, '\1ás')
44
+
45
+ # #irregulares
46
+ # irregulares = {'país' => 'paises'}
47
+ #
48
+ #
49
+ # irregulares.each do |key, value|
50
+ # inflect.plural(/^#{key.to_s}$/, value)
51
+ # inflect.singular(/^#{value}$/, key.to_s)
52
+ # end
53
+
54
+ inflect.uncountable %w( tórax tênis ônibus lápis fênix )
55
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -19,6 +19,10 @@ extra_rdoc_files: []
19
19
  files:
20
20
  - .gitignore
21
21
  - README.md
22
+ - brails.gemspec
23
+ - lib/brails.rb
24
+ - lib/generators/brails/install_generator.rb
25
+ - lib/generators/templates/brails_inflections.rb
22
26
  homepage: https://github.com/waldyr/brails
23
27
  licenses: []
24
28
  post_install_message: