Guest User

Untitled

a guest
Apr 25th, 2018
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. class Tm
  2.  
  3. def self.hi
  4. puts "Hey Tm here for duty!"
  5. end
  6.  
  7. def auxload(hash, lang, concat='')
  8. ans = {}
  9. hash.each do |key, val|
  10. if val.class == Hash
  11. aux = auxload(val, lang, concat+key+'.')
  12. aux.each do |k, v|
  13. ans[k]=v
  14. end
  15. else
  16. ans[concat+key]={lang => val}
  17. end
  18. end
  19. return ans
  20. end
  21.  
  22. # load the translation from the yaml files
  23. def load_translation(hash)
  24. key,value = hash.first
  25. return auxload(value,key)
  26. end
  27.  
  28. end
Add Comment
Please, Sign In to add comment