MOON
Server: Apache/2.2.31 (Unix) mod_ssl/2.2.31 OpenSSL/0.9.8e-fips-rhel5 mod_bwlimited/1.4
System: Linux csr818.wilogic.com 2.6.18-419.el5xen #1 SMP Fri Feb 24 22:50:37 UTC 2017 x86_64
User: digitals (531)
PHP: 5.4.45
Disabled: NONE
Upload Files
File: //scripts.20110531.215904.25158/get_locale_from_legacy_name_info
#!/usr/bin/perl
# cpanel - get_locale_from_legacy_name_info       Copyright(c) 2010 cPanel, Inc.
#                                                           All rights Reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited

BEGIN { unshift @INC, '/usr/local/cpanel'; }

use Cpanel::Locale::Utils::Legacy ();

if ( !@ARGV || grep /\-\-help/, @ARGV ) {
    print <<"END_HELP";
$0 - lookup a locale code for one or more given legacy names

Example:
  $0 fr French スペイン語 italiano spanish-utf8 中文 DANISH.lng Swedish.special "Heart cPanel"

Cpanel::Locale uses standard ISO language (and sometimes territory) codes to identify locales.

The codes are used by and have data defined in the CLDR (http://cldr.unicode.org/).

The legacy language system used arbitrary names for identification. In order to bring legacy data into Cpanel::Locale there needs to be a process to determine what locale a legacy name corresponds to.

This script is a utility that does the lookup and reports what locale it maps to.

Names that can not be mapped are turned in to 'i_' tag codes. An 'i_' tag is a standard way to create, identify, and work with a non-standard locale by prefixing the code with the letter 'i' followed by an underscore.

END_HELP
    exit;
}

for my $arg (@ARGV) {
    print "'$arg' maps to '" . Cpanel::Locale::Utils::Legacy::get_new_langtag_of_old_style_langname($arg) . "'\n";
}