lbs-config 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +19 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +29 -0
- data/Rakefile +2 -0
- data/lbs-config.gemspec +17 -0
- data/lib/generators/lbs/hispanizar/USAGE +9 -0
- data/lib/generators/lbs/hispanizar/hispanizar_generator.rb +22 -0
- data/lib/generators/lbs/hispanizar/templates/es.yml +219 -0
- data/lib/generators/lbs/hispanizar/templates/inflections.rb +28 -0
- data/lib/lbs-config/version.rb +5 -0
- data/lib/lbs-config.rb +7 -0
- metadata +60 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Azarel Doroteo Pacheco
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Lbs::Config
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'lbs-config'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install lbs-config
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/lbs-config.gemspec
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/lbs-config/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Azarel Doroteo Pacheco"]
|
6
|
+
gem.email = ["azarel.doroteo@logicalbricks.com"]
|
7
|
+
gem.description = %q{Instala templates para el scaffold, incluye opciones para generarlos con erb, haml, simple_form, formtastic, bootstrap y cancan. Incluye la posibilidad de generarlos en Inglés y Español, con su respectivo inflection.}
|
8
|
+
gem.summary = %q{Instala archivos de templates usuales en LogicalBricks Solutions para el scaffold}
|
9
|
+
gem.homepage = ""
|
10
|
+
|
11
|
+
gem.files = `git ls-files`.split($\)
|
12
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
|
+
gem.name = "lbs-config"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = Lbs::Config::VERSION
|
17
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
Description:
|
2
|
+
Genera un archivo de inflections para obtener el plural y singular de las palabras, según las reglas en Español e incluye la traducción por omisión de rails para el locale es.yml
|
3
|
+
|
4
|
+
Example:
|
5
|
+
rails generate lbs:hispanizar
|
6
|
+
|
7
|
+
This will create:
|
8
|
+
config/initializers/inflections.rb
|
9
|
+
config/locales/es.rb
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
require 'rails/generators'
|
3
|
+
|
4
|
+
module Lbs
|
5
|
+
module Generators
|
6
|
+
class HispanizarGenerator < Rails::Generators::Base
|
7
|
+
source_root File.expand_path('../templates', __FILE__)
|
8
|
+
class_option :keep_current, :type => :boolean, :default => false, :desc => 'Indica si en lugar de tratar de sobreescribir el archivo de inflections, se debe crear un archivo adicional (inflections_es)'
|
9
|
+
|
10
|
+
def generate_inflections
|
11
|
+
copy_file 'inflections.rb', "config/initializers/#{file_name}.rb"
|
12
|
+
copy_file 'es.yml', 'config/locales/es.yml'
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def file_name
|
18
|
+
file_name = options.keep_current? ? 'inflections_es' : 'inflections'
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,219 @@
|
|
1
|
+
# Basado en https://github.com/svenfuchs/rails-i18n/blob/master/rails/locale/es-MX.yml
|
2
|
+
|
3
|
+
es:
|
4
|
+
number:
|
5
|
+
percentage:
|
6
|
+
format:
|
7
|
+
delimiter: ","
|
8
|
+
currency:
|
9
|
+
format:
|
10
|
+
format: "%u%n"
|
11
|
+
unit: "$"
|
12
|
+
separator: "."
|
13
|
+
delimiter: ","
|
14
|
+
precision: 2
|
15
|
+
significant: false
|
16
|
+
strip_insignificant_zeros: false
|
17
|
+
format:
|
18
|
+
delimiter: ","
|
19
|
+
precision: 2
|
20
|
+
significant: false
|
21
|
+
strip_insignificant_zeros: false
|
22
|
+
separator: "."
|
23
|
+
human:
|
24
|
+
format:
|
25
|
+
delimiter: ","
|
26
|
+
precision: 3
|
27
|
+
significant: true
|
28
|
+
strip_insignificant_zeros: true
|
29
|
+
storage_units:
|
30
|
+
format: "%n %u"
|
31
|
+
units:
|
32
|
+
byte:
|
33
|
+
one: "Byte"
|
34
|
+
other: "Bytes"
|
35
|
+
kb: "KB"
|
36
|
+
mb: "MB"
|
37
|
+
gb: "GB"
|
38
|
+
tb: "TB"
|
39
|
+
decimal_units:
|
40
|
+
format: "%n %u"
|
41
|
+
units:
|
42
|
+
unit: ""
|
43
|
+
thousand: "Mil"
|
44
|
+
million: "Millón"
|
45
|
+
billion: "Mil millones"
|
46
|
+
trillion: "Trillón"
|
47
|
+
quadrillion: "Cuatrillón"
|
48
|
+
precision:
|
49
|
+
format:
|
50
|
+
delimiter: ","
|
51
|
+
|
52
|
+
date:
|
53
|
+
order:
|
54
|
+
- :day
|
55
|
+
- :month
|
56
|
+
- :year
|
57
|
+
abbr_day_names:
|
58
|
+
- dom
|
59
|
+
- lun
|
60
|
+
- mar
|
61
|
+
- mié
|
62
|
+
- jue
|
63
|
+
- vie
|
64
|
+
- sáb
|
65
|
+
abbr_month_names:
|
66
|
+
- ~
|
67
|
+
- ene
|
68
|
+
- feb
|
69
|
+
- mar
|
70
|
+
- abr
|
71
|
+
- may
|
72
|
+
- jun
|
73
|
+
- jul
|
74
|
+
- ago
|
75
|
+
- sep
|
76
|
+
- oct
|
77
|
+
- nov
|
78
|
+
- dic
|
79
|
+
day_names:
|
80
|
+
- domingo
|
81
|
+
- lunes
|
82
|
+
- martes
|
83
|
+
- miércoles
|
84
|
+
- jueves
|
85
|
+
- viernes
|
86
|
+
- sábado
|
87
|
+
month_names:
|
88
|
+
- ~
|
89
|
+
- enero
|
90
|
+
- febrero
|
91
|
+
- marzo
|
92
|
+
- abril
|
93
|
+
- mayo
|
94
|
+
- junio
|
95
|
+
- julio
|
96
|
+
- agosto
|
97
|
+
- septiembre
|
98
|
+
- octubre
|
99
|
+
- noviembre
|
100
|
+
- diciembre
|
101
|
+
formats:
|
102
|
+
short: "%d de %b"
|
103
|
+
default: "%d/%m/%Y"
|
104
|
+
long: "%A, %d de %B de %Y"
|
105
|
+
time:
|
106
|
+
formats:
|
107
|
+
short: "%d de %b a las %H:%M hrs"
|
108
|
+
default: "%a, %d de %b de %Y a las %H:%M:%S %Z"
|
109
|
+
long: "%A, %d de %B de %Y a las %I:%M %p"
|
110
|
+
am: "am"
|
111
|
+
pm: "pm"
|
112
|
+
|
113
|
+
support:
|
114
|
+
array:
|
115
|
+
words_connector: ", "
|
116
|
+
two_words_connector: " y "
|
117
|
+
last_word_connector: " y "
|
118
|
+
|
119
|
+
select:
|
120
|
+
prompt: "Por favor selecciona"
|
121
|
+
|
122
|
+
datetime:
|
123
|
+
distance_in_words:
|
124
|
+
half_a_minute: "medio minuto"
|
125
|
+
less_than_x_seconds:
|
126
|
+
one: "menos de 1 segundo"
|
127
|
+
other: "menos de %{count} segundos"
|
128
|
+
x_seconds:
|
129
|
+
one: "1 segundo"
|
130
|
+
other: "%{count} segundos"
|
131
|
+
less_than_x_minutes:
|
132
|
+
one: "menos de 1 minuto"
|
133
|
+
other: "menos de %{count} minutos"
|
134
|
+
x_minutes:
|
135
|
+
one: "1 minuto"
|
136
|
+
other: "%{count} minutos"
|
137
|
+
about_x_hours:
|
138
|
+
one: "cerca de 1 hora"
|
139
|
+
other: "cerca de %{count} horas"
|
140
|
+
x_days:
|
141
|
+
one: "1 día"
|
142
|
+
other: "%{count} días"
|
143
|
+
about_x_months:
|
144
|
+
one: "cerca de 1 mes"
|
145
|
+
other: "cerca de %{count} meses"
|
146
|
+
x_months:
|
147
|
+
one: "1 mes"
|
148
|
+
other: "%{count} meses"
|
149
|
+
about_x_years:
|
150
|
+
other: "cerca de %{count} años"
|
151
|
+
one: "cerca de 1 año"
|
152
|
+
over_x_years:
|
153
|
+
one: "más de 1 año"
|
154
|
+
other: "más de %{count} años"
|
155
|
+
almost_x_years:
|
156
|
+
one: "casi 1 año"
|
157
|
+
other: "casi %{count} años"
|
158
|
+
prompts:
|
159
|
+
year: 'Año'
|
160
|
+
month: 'Mes'
|
161
|
+
day: 'Día'
|
162
|
+
hour: 'Hora'
|
163
|
+
minute: 'Minuto'
|
164
|
+
second: 'Segundos'
|
165
|
+
|
166
|
+
helpers:
|
167
|
+
select:
|
168
|
+
prompt: "Por favor selecciona"
|
169
|
+
|
170
|
+
submit:
|
171
|
+
create: 'Crear %{model}'
|
172
|
+
update: 'Actualizar %{model}'
|
173
|
+
submit: 'Guardar %{model}'
|
174
|
+
|
175
|
+
errors:
|
176
|
+
format: "%{attribute} %{message}"
|
177
|
+
|
178
|
+
messages: &errors_messages
|
179
|
+
inclusion: "no está incluído en la lista"
|
180
|
+
exclusion: "está reservado"
|
181
|
+
invalid: "es inválido"
|
182
|
+
confirmation: "no coincide con la confirmación"
|
183
|
+
blank: "no puede estar en blanco"
|
184
|
+
empty: "no puede estar vacío"
|
185
|
+
not_a_number: "no es un número"
|
186
|
+
not_an_integer: "debe ser un entero"
|
187
|
+
less_than: "debe ser menor que %{count}"
|
188
|
+
less_than_or_equal_to: "debe ser menor o igual que %{count}"
|
189
|
+
greater_than: "debe ser mayor que %{count}"
|
190
|
+
greater_than_or_equal_to: "debe ser mayor o igual que %{count}"
|
191
|
+
too_short:
|
192
|
+
one: "es demasiado corto (mínimo 1 caracter)"
|
193
|
+
other: "es demasiado corto (mínimo %{count} caracteres)"
|
194
|
+
too_long:
|
195
|
+
one: "es demasiado largo (máximo 1 caracter)"
|
196
|
+
other: "es demasiado largo (máximo %{count} caracteres)"
|
197
|
+
equal_to: "debe ser igual a %{count}"
|
198
|
+
wrong_length:
|
199
|
+
one: "longitud errónea (debe ser de 1 caracter)"
|
200
|
+
other: "longitud errónea (debe ser de %{count} caracteres)"
|
201
|
+
accepted: "debe ser aceptado"
|
202
|
+
even: "debe ser un número par"
|
203
|
+
odd: "debe ser un número non"
|
204
|
+
|
205
|
+
activerecord:
|
206
|
+
errors:
|
207
|
+
template:
|
208
|
+
header:
|
209
|
+
one: "%{article} %{model} no pudo guardarse debido a 1 error"
|
210
|
+
other: "%{article} %{model} no pudo guardarse debido a %{count} errores"
|
211
|
+
body: "Revise que los siguientes campos sean válidos:"
|
212
|
+
|
213
|
+
messages:
|
214
|
+
taken: "ya ha sido tomado"
|
215
|
+
record_invalid: "La validación falló: %{errors}"
|
216
|
+
<<: *errors_messages
|
217
|
+
|
218
|
+
full_messages:
|
219
|
+
format: "%{attribute} %{message}"
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
ActiveSupport::Inflector.inflections do |inflect|
|
4
|
+
inflect.plural(/([rndl])([A-Z]|_|$)/, '\1es\2')
|
5
|
+
inflect.plural(/([aeiou])([A-Z]|_|$)/, '\1s\2')
|
6
|
+
inflect.plural(/([aeiou])([A-Z]|_)([a-z]+)([rndl])([A-Z]|_|$)/,
|
7
|
+
'\1s\2\3\4es\5')
|
8
|
+
inflect.plural(/([rndl])([A-Z]|_)([a-z]+)([aeiou])([A-Z]|_|$)/,
|
9
|
+
'\1es\2\3\4s\5')
|
10
|
+
inflect.plural(/(z)$/i, 'ces')
|
11
|
+
|
12
|
+
final_plural_rndl = /([aeiou][rndl])es([A-Z]|_|$)/
|
13
|
+
final_plural_vocal = /((?<![aeiou][nrdl])[aeiou])s([A-Z]|_|$)/
|
14
|
+
palabra_compuesta_1 = /#{final_plural_rndl}([a-z]+)#{final_plural_vocal}/
|
15
|
+
palabra_compuesta_2 = /#{final_plural_vocal}([a-z]+)#{final_plural_rndl}/
|
16
|
+
|
17
|
+
inflect.singular(/(ia)$/i, '\1')
|
18
|
+
inflect.singular(final_plural_rndl, '\1\2')
|
19
|
+
inflect.singular(final_plural_vocal, '\1\2')
|
20
|
+
inflect.singular(palabra_compuesta_1, '\1\2\3\4\5')
|
21
|
+
inflect.singular(palabra_compuesta_2, '\1\2\3\4\5')
|
22
|
+
inflect.singular(/ces$/, 'z')
|
23
|
+
|
24
|
+
inflect.irregular 'pais', 'paises'
|
25
|
+
inflect.singular /(pais)([A-Z]|_|$)/, '\1\2'
|
26
|
+
|
27
|
+
inflect.uncountable %w( campus lunes martes miercoles jueves viernes )
|
28
|
+
end
|
data/lib/lbs-config.rb
ADDED
metadata
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: lbs-config
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Azarel Doroteo Pacheco
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-04-17 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: Instala templates para el scaffold, incluye opciones para generarlos
|
15
|
+
con erb, haml, simple_form, formtastic, bootstrap y cancan. Incluye la posibilidad
|
16
|
+
de generarlos en Inglés y Español, con su respectivo inflection.
|
17
|
+
email:
|
18
|
+
- azarel.doroteo@logicalbricks.com
|
19
|
+
executables: []
|
20
|
+
extensions: []
|
21
|
+
extra_rdoc_files: []
|
22
|
+
files:
|
23
|
+
- .gitignore
|
24
|
+
- Gemfile
|
25
|
+
- LICENSE
|
26
|
+
- README.md
|
27
|
+
- Rakefile
|
28
|
+
- lbs-config.gemspec
|
29
|
+
- lib/generators/lbs/hispanizar/USAGE
|
30
|
+
- lib/generators/lbs/hispanizar/hispanizar_generator.rb
|
31
|
+
- lib/generators/lbs/hispanizar/templates/es.yml
|
32
|
+
- lib/generators/lbs/hispanizar/templates/inflections.rb
|
33
|
+
- lib/lbs-config.rb
|
34
|
+
- lib/lbs-config/version.rb
|
35
|
+
homepage: ''
|
36
|
+
licenses: []
|
37
|
+
post_install_message:
|
38
|
+
rdoc_options: []
|
39
|
+
require_paths:
|
40
|
+
- lib
|
41
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ! '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
48
|
+
none: false
|
49
|
+
requirements:
|
50
|
+
- - ! '>='
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0'
|
53
|
+
requirements: []
|
54
|
+
rubyforge_project:
|
55
|
+
rubygems_version: 1.8.22
|
56
|
+
signing_key:
|
57
|
+
specification_version: 3
|
58
|
+
summary: Instala archivos de templates usuales en LogicalBricks Solutions para el
|
59
|
+
scaffold
|
60
|
+
test_files: []
|