Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @translations_split = {}
- @translations.each do |key, default_translation|
- tran_parts = key.split('.')
- current_position = @translations_split
- while tran_parts.length > 1
- next_part = tran_parts.shift
- unless current_position[next_part]
- current_position[next_part] = {}
- end
- current_position = current_position[next_part]
- end
- current_position[tran_parts.first] = default_translation
- end
Add Comment
Please, Sign In to add comment