makeloc 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e3d4e4f0024656f307a78ca6f2666e6c393dc05d
4
- data.tar.gz: 00f1cb02e417f676c20b02ac87334711841a10a9
3
+ metadata.gz: 4c74450bd222df9ba64b23e9c924f060555ddbcf
4
+ data.tar.gz: 0aafb67596028add57d400e719e01152543b7253
5
5
  SHA512:
6
- metadata.gz: 5cf55090558bb393400048527940adb4e7aca1c1241b3b2d33edd13db4e697b92a2a2b0037d568f12f848323fbb8c236dc5997f0cdc3bff3e46e3c095fa682d8
7
- data.tar.gz: 883bedc6f342a923d02a9b7e230a4ecb7f1e07b9211b7273b7f3237e298bd316ab813b1039a3c8794d58035d93e0dfec8839d5c22f626accf317e5bac9d36260
6
+ metadata.gz: 18c45c7b83d80b79cc749db30f6129993cc1876f8e91cd95702cfe77d5b374795aee2f82d83f414029b20ddccb9eec0cbfce8d3f473c5b63a9e9ed8650ad5693
7
+ data.tar.gz: 2d21f992816d135be53a1c0dff4e70fa64477833b17fa596442fa3367d35c4af23ae1f27df0941e08b0309dfbeb010a8a72f75cf047b1660b9b7662652e9ae73
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.2.1
@@ -2,12 +2,8 @@ class Hash
2
2
  def flatten_keys(prefix="")
3
3
  keys = []
4
4
  self.keys.each do |key|
5
- keys << if self[key].is_a? Hash
6
- current_prefix = prefix + "#{key}."
7
- self[key].flatten_keys(current_prefix)
8
- else
9
- "#{prefix}#{key}"
10
- end
5
+ keys << "#{prefix}#{key}"
6
+ (keys << self[key].flatten_keys(prefix + "#{key}.")) if self[key].is_a? Hash
11
7
  end
12
8
  prefix == "" ? keys.flatten : keys
13
9
  end
@@ -62,22 +58,71 @@ class Hash
62
58
 
63
59
  end
64
60
 
65
- # # hash = { a: 1, b: { d: 2, e: [3, 4] }, c: {f: 0, g: 3} }
61
+ # hash = { a: 1, b: { d: 2, e: [3, 4] }, c: {f: 0, h: {i: 9}, g: 3} }
66
62
  # hash = {"date"=>{"abbr_day_names"=>["Dom", "Lun", "Mar", "Mer", "Gio", "Ven", "Sab"], "abbr_month_names"=>[nil, "Gen", "Feb", "Mar", "Apr", "Mag", "Giu", "Lug", "Ago", "Set", "Ott", "Nov", "Dic"], "day_names"=>["Domenica", "Lunedì", "Martedì", "Mercoledì", "Giovedì", "Venerdì", "Sabato"], "formats"=>{"default"=>"%d-%m-%Y", "long"=>"%d %B %Y", "short"=>"%d %b"}, "month_names"=>[nil, "Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre"], "order"=>[:day, :month, :year]}, "datetime"=>{"distance_in_words"=>{"about_x_hours"=>{"one"=>"circa un'ora", "other"=>"circa %{count} ore"}, "about_x_months"=>{"one"=>"circa un mese", "other"=>"circa %{count} mesi"}, "about_x_years"=>{"one"=>"circa un anno", "other"=>"circa %{count} anni"}, "almost_x_years"=>{"one"=>"circa 1 anno", "other"=>"circa %{count} anni"}, "half_a_minute"=>"mezzo minuto", "less_than_x_minutes"=>{"one"=>"meno di un minuto", "other"=>"meno di %{count} minuti"}, "less_than_x_seconds"=>{"one"=>"meno di un secondo", "other"=>"meno di %{count} secondi"}, "over_x_years"=>{"one"=>"oltre un anno", "other"=>"oltre %{count} anni"}, "x_days"=>{"one"=>"1 giorno", "other"=>"%{count} giorni"}, "x_minutes"=>{"one"=>"1 minuto", "other"=>"%{count} minuti"}, "x_months"=>{"one"=>"1 mese", "other"=>"%{count} mesi"}, "x_seconds"=>{"one"=>"1 secondo", "other"=>"%{count} secondi"}}, "prompts"=>{"day"=>"Giorno", "hour"=>"Ora", "minute"=>"Minuto", "month"=>"Mese", "second"=>"Secondi", "year"=>"Anno"}}, "errors"=>{"format"=>"%{attribute} %{message}", "messages"=>{"accepted"=>"deve essere accettata", "blank"=>"non può essere lasciato in bianco", "confirmation"=>"non coincide con la conferma", "empty"=>"non può essere vuoto", "equal_to"=>"deve essere uguale a %{count}", "even"=>"deve essere pari", "exclusion"=>"è riservato", "greater_than"=>"deve essere superiore a %{count}", "greater_than_or_equal_to"=>"deve essere superiore o uguale a %{count}", "inclusion"=>"non è incluso nella lista", "invalid"=>"non è valido", "less_than"=>"deve essere meno di %{count}", "less_than_or_equal_to"=>"deve essere meno o uguale a %{count}", "not_a_number"=>"non è un numero", "not_an_integer"=>"non è un intero", "odd"=>"deve essere dispari", "record_invalid"=>"Validazione fallita: %{errors}", "taken"=>"è già in uso", "too_long"=>{"one"=>"è troppo lungo (il massimo è 1 carattere)", "other"=>"è troppo lungo (il massimo è %{count} caratteri)"}, "too_short"=>{"one"=>"è troppo corto (il minimo è 1 carattere)", "other"=>"è troppo corto (il minimo è %{count} caratteri)"}, "wrong_length"=>{"one"=>"è della lunghezza sbagliata (deve essere di 1 carattere)", "other"=>"è della lunghezza sbagliata (deve essere di %{count} caratteri)"}}, "template"=>{"body"=>"Per favore ricontrolla i seguenti campi:", "header"=>{"one"=>"Non posso salvare questo %{model}: 1 errore", "other"=>"Non posso salvare questo %{model}: %{count} errori."}}}, "helpers"=>{"select"=>{"prompt"=>"Per favore, seleziona", "prompt_allow_nil"=>"Per favore, seleziona o lascia in binaco"}, "submit"=>{"create"=>"Crea %{model}", "submit"=>"Invia %{model}", "update"=>"Aggiorna %{model}", "cancel"=>"Annulla %{model}", "reset"=>"Cancella %{model}", "add"=>"Aggiungi %{model}"}, "links"=>{"new"=>"Nuovo %{model}", "add"=>"Aggiungi %{model}", "edit"=>"Modifica %{model}", "reset"=>"Reset", "back"=>"Indietro", "cancel"=>"Annulla", "confirm"=>"Sei sicuro?", "destroy"=>"Elimina %{model}", "show"=>"Visualizza %{model}"}, "titles"=>{"index"=>"Lista %{model}", "edit"=>"Modifica %{model}", "new"=>"Nuovo %{model}", "show"=>"Riepilogo %{model}"}, "tooltips"=>{"edit"=>"Modifica %{model}", "save"=>"Salva %{model}", "new"=>"Crea %{model}", "destroy"=>"Elimina %{model}", "back"=>"Torna alla lista", "show"=>"Visualizza %{model}", "add"=>"Aggiungi %{model}"}}, "sign_out"=>"Esci", "sign_in"=>"Accedi", "number"=>{"currency"=>{"format"=>{"delimiter"=>",", "format"=>"%n %u", "precision"=>2, "separator"=>".", "significant"=>false, "strip_insignificant_zeros"=>false, "unit"=>"€"}}, "format"=>{"delimiter"=>",", "precision"=>2, "separator"=>".", "significant"=>false, "strip_insignificant_zeros"=>false}, "human"=>{"decimal_units"=>{"format"=>"%n %u", "units"=>{"billion"=>"Miliardi", "million"=>"Milioni", "quadrillion"=>"Biliardi", "thousand"=>"Mila", "trillion"=>"Bilioni", "unit"=>""}}, "format"=>{"delimiter"=>"", "precision"=>1, "significant"=>true, "strip_insignificant_zeros"=>true}, "storage_units"=>{"format"=>"%n %u", "units"=>{"byte"=>{"one"=>"Byte", "other"=>"Byte"}, "gb"=>"GB", "kb"=>"KB", "mb"=>"MB", "tb"=>"TB"}}}, "percentage"=>{"format"=>{"delimiter"=>""}}, "precision"=>{"format"=>{"delimiter"=>""}}}, "support"=>{"array"=>{"last_word_connector"=>" e ", "two_words_connector"=>" e ", "words_connector"=>", "}}, "time"=>{"am"=>"am", "formats"=>{"default"=>"%a %d %b %Y, %H:%M:%S %z", "long"=>"%d %B %Y %H:%M", "short"=>"%d %b %H:%M"}, "pm"=>"pm"}, "gender_suffix"=>{"M"=>"o", "F"=>"a"}, "activemodel"=>{"errors"=>{"format"=>"%{attribute} %{message}", "messages"=>{"accepted"=>"deve essere accettata", "blank"=>"non può essere lasciato in bianco", "confirmation"=>"non coincide con la conferma", "empty"=>"non può essere vuoto", "equal_to"=>"deve essere uguale a %{count}", "even"=>"deve essere pari", "exclusion"=>"è riservato", "greater_than"=>"deve essere superiore a %{count}", "greater_than_or_equal_to"=>"deve essere superiore o uguale a %{count}", "inclusion"=>"non è incluso nella lista", "invalid"=>"non è valido", "less_than"=>"deve essere meno di %{count}", "less_than_or_equal_to"=>"deve essere meno o uguale a %{count}", "not_a_number"=>"non è un numero", "not_an_integer"=>"non è un intero", "odd"=>"deve essere dispari", "record_invalid"=>"Validazione fallita: %{errors}", "taken"=>"è già in uso", "too_long"=>{"one"=>"è troppo lungo (il massimo è 1 carattere)", "other"=>"è troppo lungo (il massimo è %{count} caratteri)"}, "too_short"=>{"one"=>"è troppo corto (il minimo è 1 carattere)", "other"=>"è troppo corto (il minimo è %{count} caratteri)"}, "wrong_length"=>{"one"=>"è della lunghezza sbagliata (deve essere di 1 carattere)", "other"=>"è della lunghezza sbagliata (deve essere di %{count} caratteri)"}}, "template"=>{"body"=>"Per favore ricontrolla i seguenti campi:", "header"=>{"one"=>"Non posso salvare questo %{model}: 1 errore", "other"=>"Non posso salvare questo %{model}: %{count} errori."}}}}, "activerecord"=>{"errors"=>{"format"=>"%{attribute} %{message}", "messages"=>{"accepted"=>"deve essere accettata", "blank"=>"non può essere lasciato in bianco", "confirmation"=>"non coincide con la conferma", "empty"=>"non può essere vuoto", "equal_to"=>"deve essere uguale a %{count}", "even"=>"deve essere pari", "exclusion"=>"è riservato", "greater_than"=>"deve essere superiore a %{count}", "greater_than_or_equal_to"=>"deve essere superiore o uguale a %{count}", "inclusion"=>"non è incluso nella lista", "invalid"=>"non è valido", "less_than"=>"deve essere meno di %{count}", "less_than_or_equal_to"=>"deve essere meno o uguale a %{count}", "not_a_number"=>"non è un numero", "not_an_integer"=>"non è un intero", "odd"=>"deve essere dispari", "record_invalid"=>"Validazione fallita: %{errors}", "taken"=>"è già in uso", "too_long"=>{"one"=>"è troppo lungo (il massimo è 1 carattere)", "other"=>"è troppo lungo (il massimo è %{count} caratteri)"}, "too_short"=>{"one"=>"è troppo corto (il minimo è 1 carattere)", "other"=>"è troppo corto (il minimo è %{count} caratteri)"}, "wrong_length"=>{"one"=>"è della lunghezza sbagliata (deve essere di 1 carattere)", "other"=>"è della lunghezza sbagliata (deve essere di %{count} caratteri)"}}, "template"=>{"body"=>"Per favore ricontrolla i seguenti campi:", "header"=>{"one"=>"Non posso salvare questo %{model}: 1 errore", "other"=>"Non posso salvare questo %{model}: %{count} errori."}}}}}
63
+ # hash = {"date"=>
64
+ # {"abbr_day_names"=>"date.abbr_day_names",
65
+ # "abbr_month_names"=>
66
+ # [nil,
67
+ # "Jan",
68
+ # "Feb",
69
+ # "Mar",
70
+ # "Apr",
71
+ # "May",
72
+ # "Jun",
73
+ # "Jul",
74
+ # "Aug",
75
+ # "Sep",
76
+ # "Oct",
77
+ # "Nov",
78
+ # "Dec"],
79
+ # "day_names"=>
80
+ # ["Sunday",
81
+ # "Monday",
82
+ # "Tuesday",
83
+ # "Wednesday",
84
+ # "Thursday",
85
+ # "Friday",
86
+ # "Saturday"],
87
+ # "formats"=>{"default"=>"%Y-%m-%d", "long"=>"%B %d, %Y", "short"=>"%b %d"},
88
+ # "month_names"=>
89
+ # [nil,
90
+ # "January",
91
+ # "February",
92
+ # "March",
93
+ # "April",
94
+ # "May",
95
+ # "June",
96
+ # "July",
97
+ # "August",
98
+ # "September",
99
+ # "October",
100
+ # "November",
101
+ # "December"],
102
+ # "order"=>[:year, :month, :day],
103
+ # "show"=>{
104
+ # "header"=>{
105
+ # "a" => "b"
106
+ # }
107
+ # }
108
+ # }
109
+ # }
67
110
 
68
- # # puts hash.at('date.dady_names').nil?
69
- # # puts hash.at('datetime.distance_in_words.about_x_hours.one', :set => 'ciccio')
70
- # # puts hash.at('datetime.distance_in_words.about_x_hours.one')
71
- # # puts hash.at('datetime.distance_in_words.about_x_hours.one', :set => :delete)
111
+ # p uts hash.flatten_keys
112
+ # puts hash.at('date.dady_names').nil?
113
+ # puts hash.at('datetime.distance_in_words.about_x_hours.one', :set => 'ciccio')
114
+ # puts hash.at('datetime.distance_in_words.about_x_hours.one')
115
+ # puts hash.at('datetime.distance_in_words.about_x_hours.one', :set => :delete)
72
116
  # puts hash.delete_at('datetime.distance_in_words.about_x_hours.one')
73
117
  # puts hash.at('datetime.distance_in_words.about_x_hours')
74
118
 
75
- # # hash.parse{|k,v| puts "#{k} => #{v}"}
76
- # # puts
77
- # # hash.parse_leaves{|k,v| puts "#{k} => #{v}"}
78
- # # puts
79
- # # hash.parse(true){|k,v| puts "#{k} => #{v}"}
80
- # # puts
81
- # # hash.update_leaves!{|k,v| nil }
119
+ # hash.parse{|k,v| puts "#{k} => #{v}"}
120
+ # puts
121
+ # hash.parse_leaves{|k,v| puts "#{k} => #{v}"}
122
+ # puts
123
+ # hash.parse(true){|k,v| puts "#{k} => #{v}"}
124
+ # puts
125
+ # puts hash
126
+ # hash.update_leaves_with_pathkey!
127
+ # hash.update_leaves_with_pathkey!{|k| "TR for #{k}"}
82
128
 
83
- # # puts hash
data/makeloc.gemspec CHANGED
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: makeloc 0.2.0 ruby lib
5
+ # stub: makeloc 0.2.1 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "makeloc"
9
- s.version = "0.2.0"
9
+ s.version = "0.2.1"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["masciugo"]
14
- s.date = "2014-07-09"
14
+ s.date = "2014-07-10"
15
15
  s.description = ""
16
16
  s.email = "masciugo@gmail.com"
17
17
  s.extra_rdoc_files = [
@@ -10,7 +10,7 @@ module Makeloc
10
10
  let!(:incomplete_target_hash_with_root) { YAML.load(File.read(TARGET_INCOMPLETE_ORIGINAL_FP)) }
11
11
  let!(:incomplete_target_hash) { incomplete_target_hash_with_root[TARGET_LANG] }
12
12
 
13
- EXTRA_KEYS = %w{ date.extra_key_1 date.formats.extra_key_2 }
13
+ EXTRA_KEYS = %w{ date.extra_key_1 date.formats.extra_key_2 date.extra_key_0.extra_key_00.extra_key_000 date.extra_key_0.extra_key_00.extra_key_001}
14
14
  MISSING_KEYS = %w{ datetime.distance_in_words.about_x_hours.other date.abbr_day_names }
15
15
 
16
16
  # loaded at runtime after each generation
@@ -1,3 +1,4 @@
1
+ ---
1
2
  it:
2
3
  date:
3
4
  abbr_day_names:
@@ -1,5 +1,11 @@
1
1
  en:
2
2
  date:
3
+ extra_key_0:
4
+ extra_key_00:
5
+ extra_key_000: foo bar
6
+ extra_key_001: bar
7
+ extra_key_002: foo
8
+
3
9
  extra_key_1: foo
4
10
  # abbr_day_names:
5
11
  # - Sun
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: makeloc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - masciugo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-09 00:00:00.000000000 Z
11
+ date: 2014-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails