I18N::L...:Detect(3pm)
π NAME π
okay so bestie, this is the manual page for I18N::LangTags::Detect(3pm) from the Perl Programmers Reference Guide β and it is literally the module for detecting the user's language preferences π No cap, that's the whole vibe.
β¨ SYNOPSIS β¨
copy-paste this, bestie:
use I18N::LangTags::Detect;
my @user_wants = I18N::LangTags::Detect::detect();
πΈ DESCRIPTION πΈ
It is a common problem to want to detect what language(s) the user would prefer output in. Like, that's the whole quest: figure out their language vibe before you serve them words β¨
π FUNCTIONS π
This module defines one public function, I18N::LangTags::Detect::detect(). This function is not exported (nor is even exportable), and it takes no parameters.
- In scalar context: it returns the most preferred language tag (or
undefif no preference was seen). - In list context (which is usually what you want): it 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()
);
π¦ ENVIRONMENT π¦
This module looks at several environment variables: REQUEST_METHOD, HTTP_ACCEPT_LANGUAGE, LANGUAGE, LC_ALL, LC_MESSAGES, and LANG.
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.
π SEE ALSO π
I18N::LangTagsWin32::LocaleLocale::Maketext
Fun lore from the page: (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.) π«Ά
π COPYRIGHT π
Copyright (c) 1998-2004 Sean M. Burke. All rights reserved.
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.
π AUTHOR π
Sean M. Burke β "sburke@cpan.org"
π okay that's the whole page, bestie β it's perl v5.42.3, dated 2026-11-03. Go detect those language prefs and slay, periodt. π
β¨
π¦ where this page comes from
- alpine 3.24: perl-doc 5.42.3-r0 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms