16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/rails/generators/metaslug/locale/locale_generator.rb', line 16
def generate_locale_file
routes = get_paths_from_routes
locales = options.locale? ?
[options.locale] :
I18n.available_locales
metas = options.metas? ?
options.metas.split(',') :
["description", "title"]
locales.each do |locale|
buffer = "#{locale}:\n"
add_metas_to_buffer(buffer, 'default', { quote_section: false }, *metas)
routes.each do |route|
add_metas_to_buffer(buffer, route, { quote_section: true }, *metas)
end
if options.output?
$stdout.puts buffer
else
create_file "config/metaslug/#{locale}.yml", buffer
end
end
end
|