From 5e600005bf6368a8f46e69f961e347e5e17bd215 Mon Sep 17 00:00:00 2001 From: Siep Kroonenberg Date: Wed, 23 Jan 2008 17:04:36 +0000 Subject: Added function reg_country() to TLWinGoo which is a two-letter country code representing the locale of the current user. Test added to wingoo-demo.pl. git-svn-id: svn://tug.org/texlive/trunk@6379 c570f23f-e606-0410-a88d-b1316a301751 --- Master/tlpkg/TeXLive/TLWinGoo.pm | 17 +++++++++++++++++ Master/wingoo-demo.pl | 4 ++++ 2 files changed, 21 insertions(+) diff --git a/Master/tlpkg/TeXLive/TLWinGoo.pm b/Master/tlpkg/TeXLive/TLWinGoo.pm index de2f6255b60..2acaf622950 100644 --- a/Master/tlpkg/TeXLive/TLWinGoo.pm +++ b/Master/tlpkg/TeXLive/TLWinGoo.pm @@ -24,6 +24,7 @@ C -- Additional utilities for Windows TeXLive::TLWinGoo::wg_error; TeXLive::TLWinGoo::admin; + TeXLive::TLWinGoo::reg_country; TeXLive::TLWinGoo::dir_writable($d); TeXLive::TLWinGoo::expand_string($s); TeXLive::TLWinGoo::global_tmpdir; @@ -48,6 +49,7 @@ BEGIN { @EXPORT = qw( &wg_error &admin + ®_country &dir_writable &expand_string &global_tmpdir @@ -145,6 +147,21 @@ sub admin { return $is_admin; } =pod +=item C + +Two-letter country code representing the locale of the current user + +=cut + +sub reg_country { + my $value = $Registry -> {"CUser/Control Panel/International//Locale"}; + my $lm = $Registry -> Open("LMachine/SYSTEM/CurrentControlSet/Control/" . + "Keyboard Layout/DosKeybCodes/", {Access => sys_access_permissions()}); + return $lm -> {$value}; +} + +=pod + =item C Tests whether its argument is writable by trying to write to diff --git a/Master/wingoo-demo.pl b/Master/wingoo-demo.pl index fec3ecdf48b..c73e3626d64 100644 --- a/Master/wingoo-demo.pl +++ b/Master/wingoo-demo.pl @@ -54,6 +54,10 @@ if (admin()) { print "Not admin\n"; } +# country + +print "Country: " . reg_country() . "\n"; + # global_tmpdir print "Global tempdir: " . global_tmpdir()."\n"; -- cgit v1.2.3