Create languages dropdown on registration form


My site is both English and Latvian. How to add frontend dropdown on registration form where users can choose their preferred language (the language they receive WP emails, etc.)?

add_filter( 'locale', 'set_my_locale' ); function set_my_locale( $  lang ) {   if ( 'gl' == $  _GET['latvian'] ) {     // set to Latvian     return 'ka_LV';   } else {     // return original language     return $  lang;   } } 

Can someone point out how to adjust this code, so there is a dropdown on frontend registration?