There is already a site setting (set locale from accept language header
) which uses the browser’s Accept-Language
HTTP header for anonymous users. I guess this could be used to set the initial value for the locale on the registration form and it might already set the locale during signup.
You can find out more about this feature in Variable default interface language for new users. If I remember correctly there were some issues with caching.