wp_localize_script is not adding a global variable for javascript

Your timing is off. You are enqueueing script to echo in header, but you try to localize it long after the fact in footer.

You should be doing registration and localization in proper wp_enqueue_scripts hook (not init by the way).