How to Customize Polylang Language Items

You can use the display_names_as parameter when calling pll_the_languages(). I tried it on an installation with English and French languages and it returned me en and fr respectively.

<?php pll_the_languages( array( 'display_names_as' => 'slug' ) );?>

You can find the function reference for the Polylang plugin on this page.