Added translate function to templates