6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/rails_maint/helpers/maintenance_page_helper.rb', line 6
def default_maintenance_page_content(locale = 'en')
base_path = File.expand_path('../../', __FILE__)
css_file = File.join(base_path, 'assets/default.css')
html_file = File.join(base_path, 'assets/maintenance.html')
locale_file = File.join(base_path, "assets/locales/#{locale}.yml")
css_content = File.read(css_file)
html_template = File.read(html_file)
app_locale_file = "config/locales/rails_maint.#{locale}.yml"
puts "APP LOCALE FILE: #{app_locale_file}"
translations = if File.exist?(app_locale_file)
YAML.load_file(app_locale_file)[locale]['rails_maint']
else
YAML.load_file(locale_file)[locale]['rails_maint']
end
html_content = html_template
.gsub('<%= css_content %>', css_content)
.gsub('<%= lang %>', locale)
.gsub('<%= title %>', translations['title'])
.gsub('<%= description %>', translations['description'])
.gsub('<%= estimated_time %>', translations['estimated_time'])
html_content
end
|