Server IP : 127.0.0.2 / Your IP : 3.149.249.184 Web Server : Apache/2.4.18 (Ubuntu) System : User : www-data ( ) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : disk_free_space,disk_total_space,diskfreespace,dl,exec,fpaththru,getmyuid,getmypid,highlight_file,ignore_user_abord,leak,listen,link,opcache_get_configuration,opcache_get_status,passthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,php_uname,phpinfo,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,pclose,popen,proc_open,proc_close,proc_get_status,proc_nice,proc_terminate,shell_exec,source,show_source,system,virtual MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/sbin/ |
Upload File : |
#!/usr/bin/perl -w # # Author: Petter Reinholdtsen <pere@hungry.com> # Date: 2002-02-23 # # Test if the locale given as argument is a valid locale. If it # is not, print on stdout the string to add to /etc/locale.gen to make # locale-gen generate the locale (if it exists at all). use POSIX qw(setlocale LC_ALL); my $debug = 0; my $defaultcharset = $ENV{"DEFAULTCHARSET"} || "ISO-8859-1"; my $supportedlist = "/usr/share/i18n/SUPPORTED"; unless (defined $ARGV[0]) { usage(); exit 1; } my $LANG = $ARGV[0]; my $loc = setlocale(LC_ALL, $LANG); if ( ! $loc) { print STDERR "locale '$LANG' not available\n"; my ($locale) = $LANG =~ m/^([^.@]+)/; my ($charset) = $LANG =~ m/^[^.]+\.([^@]+)/; my ($modifier) = $LANG =~ m/(@.+)$/; $modifier = "" unless defined $modifier; # Hm, if charset is missing, how to we pick the correct one to # use? Fetching the value from /usr/share/i18n/SUPPORTED should # work on Debian. my $codeset = ""; if (defined $charset) { $codeset = '.' . $charset; } else { $charset = get_default_charset("$locale$modifier"); } # print "L: $locale C: $charset M: $modifier\n"; print "$locale$codeset$modifier $charset\n"; exit 1; } else { print STDERR "locale '$LANG' valid and available\n"; exit 0; } sub usage { print "Usage: $0 <locale>\n" } sub get_default_charset { my ($locale) = @_; my ($l, $c); open(SUPPORTED, "< $supportedlist") || die "Unable to open $supportedlist"; while (<SUPPORTED>) { chomp; ($l, $c) = split(/\s+/); print "Checking '$l' '$c' != '$locale'\n" if $debug; last if ($l eq $locale); } close(SUPPORTED); if ($l eq $locale) { return $c; } else { return $defaultcharset; } }