Skip to content

Instantly share code, notes, and snippets.

on the client side's HTML HEAD tag you include:
<script src="/dictionary.js" type="text/javascript" charset="utf-8"></script>
<script>
var current_language = "italian";
</script>
you manage current_language variable according to user's langauge
and where translated text is needed you use the amazing <dictkey> tag:
class Node
attr_accessor :children
attr_accessor :title
def general_deep_copy
Marshal.load(Marshal.dump(self))
end
def specific_deep_copy
Node.new(@title,children.map(&:specific_deep_copy))