use I18N::LangTags::Detect; my @user_wants = I18N::LangTags::Detect::detect();
In scalar context, the function returns the most preferred language tag (or undef if no preference was seen).
In list context (which is usually what you want), the function returns a (possibly empty) list of language tags representing (best first) what languages the user apparently would accept output in. You will probably want to pass the output of this through "I18N::LangTags::implicate_supers_tightly(...)" or "I18N::LangTags::implicate_supers(...)", like so:
my @languages = I18N::LangTags::implicate_supers_tightly( I18N::LangTags::Detect::detect() );
It will also use the Win32::Locale module, if it's installed and IGNORE_WIN32_LOCALE is not set to a true value in the environment.
(This module's core code started out as a routine in Locale::Maketext; but I moved it here once I realized it was more generally useful.)
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The programs and documentation in this dist are distributed in the hope that they will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.