localizing variable on front-page.php template fails but succeeds on single page and taxonomy archive

Managed to work it out, the problem was down to how I had set up my home page to display only my custom posts.

I had set a static home page in Settings > Reading and I was using the following new WP_Query in front-page.php to show all my CPT ‘portfolio’ posts.

<?php 
$args = array(
    'post_type' => array('portfolio'),
    'posts_per_page' => '-1'
    );

$the_query = new WP_Query( $args );

    if ( $the_query->have_posts() ) :
        while ( $the_query->have_posts() ) : $the_query->the_post();
            get_template_part( 'content', 'portfolio' );
        endwhile;
    endif; ?>

The Fix:

I changed the Settings > Reading back to their default settings

I changed the query on front-page.php to the standard query:

<?php while ( have_posts() ) : the_post();

get_template_part( 'content', 'portfolio' );

endwhile; ?>

I used the pre_get_posts to modify the main query to only show my custom post type as explained here http://justintadlock.com/archives/2010/02/02/showing-custom-post-types-on-your-home-blog-page

After this my function to localize the variable worked on the front-page.php template.