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 undef if 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::LangTags
  • Win32::Locale
  • Locale::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 (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