Fixes bug with format_lang_code

Couple of bugs fixed in this:

 - Removes storing of result as a static
 - Uses `reset()` rather than `array_shift()` so that it doesn't modify the array