Win32::Locale - get the current MSWin locale or language |
Win32::Locale - get the current MSWin locale or language
use Win32::Locale; my $language = Win32::Locale::get_language(); if($language eq 'en-us') { print "Wasaaap homeslice!\n"; } else { print "You $language people ain't FROM around here, are ya?\n"; }
This library provides some simple functions allowing Perl under MSWin to ask what the current locale/language setting is. (Yes, MSWin conflates locales and languages, it seems; and the way it's conflated is even stranger after MSWin98.)
Note that you should be able to safely use this module under any OS; the functions just won't be able to access any current locale value.
Note that these functions are not exported, nor are they exportable:
Returns nothing if the MS locale value isn't accessible (notably, if you're not running under MSWin!), or if it corresponds to no known language tag. Example: ``en-us''.
In list context, this may in the future be made to return multiple values.
Returns nothing if the MS locale value isn't accessible (notably, if you're not running under MSWin!), or if it corresponds to no locale.
In list context, this may in the future be made to return multiple values.
Note that this function is experimental, and I greatly welcome suggestions.
Returns nothing if the value isn't accessible (notably, if you're not running under MSWin!).
In list context, this may in the future be made to return multiple values.
In list context, this may in the future be made to return multiple values.
(``Nothing'', above, means ``in scalar context, undef; in list context, empty-list''.)
This module provides an (unexported) public hash, %Win32::Locale::MSLocale2LangTag, that maps from the MS locale ID code to my idea of the single best corresponding RFC3066 language tag.
The hash's contents are relatively certain for well-known languages (US English is ``en-us''), but are still experimental in its finer details (like Konkani being ``kok'').
I18N::LangTags, I18N::LangTags::List, Locale::Maketext.
Copyright (c) 2001,2003 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.
This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.
I am not affiliated with the Microsoft corporation, nor the ActiveState corporation.
Product and company names mentioned in this document may be the trademarks or service marks of their respective owners. Trademarks and service marks might not be identified as such, although this must not be construed as anyone's expression of validity or invalidity of each trademark or service mark.
Sean M. Burke sburke@cpan.org
Win32::Locale - get the current MSWin locale or language |