mozo-user connection changes
This commit is contained in:
Executable
+42
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env ruby
|
||||
#require 'pathname'
|
||||
#require 'active_support/all'
|
||||
#require 'yaml'
|
||||
#require 'pry'
|
||||
#$root = Pathname.new File.expand_path('../../', __FILE__)
|
||||
class UserApp
|
||||
def path
|
||||
Pathname.new File.expand_path('../../../mozo-user', __FILE__)
|
||||
end
|
||||
|
||||
def user_translations
|
||||
Dir.glob(Rails.root.join('config/user_locales/**/*.yml')).each_with_object({}) do |user_yaml, obj|
|
||||
obj.deep_merge! YAML.load_file(user_yaml)
|
||||
end
|
||||
end
|
||||
|
||||
def all_translations
|
||||
user_translations.deep_merge general_translations
|
||||
end
|
||||
|
||||
def general_translations
|
||||
Rails.application.config.i18n.available_locales.each_with_object({}) do |locale, obj|
|
||||
obj[locale.to_s] = {
|
||||
models: I18n.t('activemodel.models', locale: locale),
|
||||
attributes: I18n.t('activemodel.attributes', locale: locale),
|
||||
helpers: I18n.t('helpers', locale: locale),
|
||||
pagination: I18n.t('views.pagination', locale: locale),
|
||||
errors: I18n.t('errors', locale: locale),
|
||||
date: {day_name: Hash[Date::DAYNAMES.map(&:downcase).zip(I18n.t('date.day_names', locale: locale))]}
|
||||
}
|
||||
end.deep_stringify_keys
|
||||
end
|
||||
|
||||
def write_translations
|
||||
File.open path.join('vendor/i18n/translations.js'), 'w+' do |f|
|
||||
f.puts "$translations = #{JSON.pretty_generate all_translations}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
UserApp.new.write_translations
|
||||
Reference in New Issue
Block a user