You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
554 B
24 lines
554 B
8 months ago
|
class TranslationsController < ApplicationController
|
||
|
def index
|
||
|
@translation_overrides = Translation.all
|
||
|
|
||
|
committed_translations = YAML.load_file("config/locales/forms/questions/2024/en.yml")
|
||
|
@default_translations = flatten(committed_translations["en"]).to_a
|
||
|
render "translations/index"
|
||
|
end
|
||
|
end
|
||
|
|
||
|
private
|
||
|
|
||
|
def flatten(translation_hash)
|
||
|
translation_hash.each_with_object({}) do |(k, v), h|
|
||
|
if v.is_a? Hash
|
||
|
flatten(v).map do |h_k, h_v|
|
||
|
h["#{k}.#{h_k}".to_sym] = h_v
|
||
|
end
|
||
|
else
|
||
|
h[k] = v
|
||
|
end
|
||
|
end
|
||
|
end
|