1234567891011121314151617181920212223 |
- #!/usr/bin/perl
- use strict;
- use integer;
- our %langid;
- require 'lcid.ph';
- sub langid($) {
- my($s) = @_;
- $s = lc($s);
- $s =~ s/\P{Alnum}+/-/g;
- while (1) {
- my $lcid = $langid{$s};
- return $lcid if (defined($lcid));
- last unless ($s =~ /(.*)\-[^-]+$/);
- $s = $1;
- }
- return undef;
- }
|