From a8d4608b51f8a0cd55ec8e249f7fd074969548aa Mon Sep 17 00:00:00 2001 From: Alain Reguera Delgado Date: Sep 17 2012 01:22:53 +0000 Subject: Rename the following functionalities: - From `Commons/cli_getCountryCodes' to `Locale/locale_getCountryCodes' - From `Commons/cli_getLangName' to `Locale/locale_getLanguageName' - From `Commons/cli_getLangCodes' to `Locale/locale_getLanguageCodes' - From `Commons/cli_getCountryName' to `Locale/locale_getCountryName' Add the following functionalities: - Locale/locale_getCurrentCountryCode - Locale/locale_getCurrentLanguageCode --- diff --git a/Scripts/Bash/Functions/Commons/cli_getCountryCodes.sh b/Scripts/Bash/Functions/Commons/cli_getCountryCodes.sh deleted file mode 100755 index 711b44a..0000000 --- a/Scripts/Bash/Functions/Commons/cli_getCountryCodes.sh +++ /dev/null @@ -1,276 +0,0 @@ -#!/bin/bash -# -# cli_getCountryCodes.sh -- This function outputs a list with country -# codes as defined in ISO3166 standard. -# -# Copyright (C) 2009, 2010, 2011, 2012 The CentOS Project -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or (at -# your option) any later version. -# -# 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. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function cli_getCountryCodes { - - local FILTER="$(echo $1 | cut -d_ -f2)" - - COUNTRYCODES='AD - AE - AF - AG - AI - AL - AM - AN - AO - AQ - AR - AS - AT - AU - AW - AZ - BA - BB - BD - BE - BF - BG - BH - BI - BJ - BM - BN - BO - BR - BS - BT - BV - BW - BY - BZ - CA - CC - CD - CF - CG - CH - CI - CK - CL - CM - CN - CO - CR - CS - CU - CV - CX - CY - CZ - DE - DJ - DK - DM - DO - DZ - EC - EE - EG - EH - ER - ES - ET - FI - FJ - FK - FM - FO - FR - GA - GB - GD - GE - GF - GH - GI - GL - GM - GN - GP - GQ - GR - GS - GT - GU - GW - GY - HK - HM - HN - HR - HT - HU - ID - IE - IL - IN - IO - IQ - IR - IS - IT - JM - JO - JP - KE - KG - KH - KI - KM - KN - KP - KR - KW - KY - KZ - LA - LB - LC - LI - LK - LR - LS - LT - LU - LV - LY - MA - MC - MD - MG - MH - MK - ML - MM - MN - MO - MP - MQ - MR - MS - MT - MU - MV - MW - MX - MY - MZ - NA - NC - NE - NF - NG - NI - NL - NO - NP - NR - NU - NZ - OM - PA - PE - PF - PG - PH - PK - PL - PM - PN - PR - PS - PT - PW - PY - QA - RE - RO - RU - RW - SA - SB - SC - SD - SE - SG - SH - SI - SJ - SK - SL - SM - SN - SO - SR - ST - SV - SY - SZ - TC - TD - TF - TG - TH - TJ - TK - TL - TM - TN - TO - TR - TT - TV - TW - TZ - UA - UG - UM - US - UY - UZ - VA - VC - VE - VG - VI - VN - VU - WF - WS - YE - YT - ZA - ZM - ZW' - - if [[ $FILTER != '' ]];then - echo $COUNTRYCODES | egrep "$FILTER" - else - echo "$COUNTRYCODES" - fi - -} diff --git a/Scripts/Bash/Functions/Commons/cli_getCountryName.sh b/Scripts/Bash/Functions/Commons/cli_getCountryName.sh deleted file mode 100755 index a755824..0000000 --- a/Scripts/Bash/Functions/Commons/cli_getCountryName.sh +++ /dev/null @@ -1,758 +0,0 @@ -#!/bin/bash -# -# cli_getCountryName.sh -- This function reads one language locale -# code in the format LL_CC and outputs the name of its related -# country. -# -# Copyright (C) 2009, 2010, 2011, 2012 The CentOS Project -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or (at -# your option) any later version. -# -# 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. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function cli_getCountryName { - - local LOCALECODE="$(echo $1 | cut -d_ -f2)" - local COUNTRYNAME="" - - case $LOCALECODE in - - 'AD' ) - COUNTRYNAME="`gettext "Andorra"`" - ;; - 'AE' ) - COUNTRYNAME="`gettext "United Arab Emirates"`" - ;; - 'AF' ) - COUNTRYNAME="`gettext "Afghanistan"`" - ;; - 'AG' ) - COUNTRYNAME="`gettext "Antigua and Barbuda"`" - ;; - 'AI' ) - COUNTRYNAME="`gettext "Anguilla"`" - ;; - 'AL' ) - COUNTRYNAME="`gettext "Albania"`" - ;; - 'AM' ) - COUNTRYNAME="`gettext "Armenia"`" - ;; - 'AN' ) - COUNTRYNAME="`gettext "Netherlands Antilles"`" - ;; - 'AO' ) - COUNTRYNAME="`gettext "Angola"`" - ;; - 'AQ' ) - COUNTRYNAME="`gettext "Antarctica"`" - ;; - 'AR' ) - COUNTRYNAME="`gettext "Argentina"`" - ;; - 'AS' ) - COUNTRYNAME="`gettext "Samoa (American)"`" - ;; - 'AT' ) - COUNTRYNAME="`gettext "Austria"`" - ;; - 'AU' ) - COUNTRYNAME="`gettext "Australia"`" - ;; - 'AW' ) - COUNTRYNAME="`gettext "Aruba"`" - ;; - 'AZ' ) - COUNTRYNAME="`gettext "Azerbaijan"`" - ;; - 'BA' ) - COUNTRYNAME="`gettext "Bosnia and Herzegovina"`" - ;; - 'BB' ) - COUNTRYNAME="`gettext "Barbados"`" - ;; - 'BD' ) - COUNTRYNAME="`gettext "Bangladesh"`" - ;; - 'BE' ) - COUNTRYNAME="`gettext "Belgium"`" - ;; - 'BF' ) - COUNTRYNAME="`gettext "Burkina Faso"`" - ;; - 'BG' ) - COUNTRYNAME="`gettext "Bulgaria"`" - ;; - 'BH' ) - COUNTRYNAME="`gettext "Bahrain"`" - ;; - 'BI' ) - COUNTRYNAME="`gettext "Burundi"`" - ;; - 'BJ' ) - COUNTRYNAME="`gettext "Benin"`" - ;; - 'BM' ) - COUNTRYNAME="`gettext "Bermuda"`" - ;; - 'BN' ) - COUNTRYNAME="`gettext "Brunei"`" - ;; - 'BO' ) - COUNTRYNAME="`gettext "Bolivia"`" - ;; - 'BR' ) - COUNTRYNAME="`gettext "Brazil"`" - ;; - 'BS' ) - COUNTRYNAME="`gettext "Bahamas"`" - ;; - 'BT' ) - COUNTRYNAME="`gettext "Bhutan"`" - ;; - 'BV' ) - COUNTRYNAME="`gettext "Bouvet Island"`" - ;; - 'BW' ) - COUNTRYNAME="`gettext "Botswana"`" - ;; - 'BY' ) - COUNTRYNAME="`gettext "Belarus"`" - ;; - 'BZ' ) - COUNTRYNAME="`gettext "Belize"`" - ;; - 'CA' ) - COUNTRYNAME="`gettext "Canada"`" - ;; - 'CC' ) - COUNTRYNAME="`gettext "Cocos (Keeling) Islands"`" - ;; - 'CD' ) - COUNTRYNAME="`gettext "Congo (Dem. Rep.)"`" - ;; - 'CF' ) - COUNTRYNAME="`gettext "Central African Rep."`" - ;; - 'CG' ) - COUNTRYNAME="`gettext "Congo (Rep.)"`" - ;; - 'CH' ) - COUNTRYNAME="`gettext "Switzerland"`" - ;; - 'CI' ) - COUNTRYNAME="`gettext "Co^te d'Ivoire"`" - ;; - 'CK' ) - COUNTRYNAME="`gettext "Cook Islands"`" - ;; - 'CL' ) - COUNTRYNAME="`gettext "Chile"`" - ;; - 'CM' ) - COUNTRYNAME="`gettext "Cameroon"`" - ;; - 'CN' ) - COUNTRYNAME="`gettext "China"`" - ;; - 'CO' ) - COUNTRYNAME="`gettext "Colombia"`" - ;; - 'CR' ) - COUNTRYNAME="`gettext "Costa Rica"`" - ;; - 'CS' ) - COUNTRYNAME="`gettext "Serbia and Montenegro"`" - ;; - 'CU' ) - COUNTRYNAME="`gettext "Cuba"`" - ;; - 'CV' ) - COUNTRYNAME="`gettext "Cape Verde"`" - ;; - 'CX' ) - COUNTRYNAME="`gettext "Christmas Island"`" - ;; - 'CY' ) - COUNTRYNAME="`gettext "Cyprus"`" - ;; - 'CZ' ) - COUNTRYNAME="`gettext "Czech Republic"`" - ;; - 'DE' ) - COUNTRYNAME="`gettext "Germany"`" - ;; - 'DJ' ) - COUNTRYNAME="`gettext "Djibouti"`" - ;; - 'DK' ) - COUNTRYNAME="`gettext "Denmark"`" - ;; - 'DM' ) - COUNTRYNAME="`gettext "Dominica"`" - ;; - 'DO' ) - COUNTRYNAME="`gettext "Dominican Republic"`" - ;; - 'DZ' ) - COUNTRYNAME="`gettext "Algeria"`" - ;; - 'EC' ) - COUNTRYNAME="`gettext "Ecuador"`" - ;; - 'EE' ) - COUNTRYNAME="`gettext "Estonia"`" - ;; - 'EG' ) - COUNTRYNAME="`gettext "Egypt"`" - ;; - 'EH' ) - COUNTRYNAME="`gettext "Western Sahara"`" - ;; - 'ER' ) - COUNTRYNAME="`gettext "Eritrea"`" - ;; - 'ES' ) - COUNTRYNAME="`gettext "Spain"`" - ;; - 'ET' ) - COUNTRYNAME="`gettext "Ethiopia"`" - ;; - 'FI' ) - COUNTRYNAME="`gettext "Finland"`" - ;; - 'FJ' ) - COUNTRYNAME="`gettext "Fiji"`" - ;; - 'FK' ) - COUNTRYNAME="`gettext "Falkland Islands"`" - ;; - 'FM' ) - COUNTRYNAME="`gettext "Micronesia"`" - ;; - 'FO' ) - COUNTRYNAME="`gettext "Faeroe Islands"`" - ;; - 'FR' ) - COUNTRYNAME="`gettext "France"`" - ;; - 'GA' ) - COUNTRYNAME="`gettext "Gabon"`" - ;; - 'GB' ) - COUNTRYNAME="`gettext "Britain (UK)"`" - ;; - 'GD' ) - COUNTRYNAME="`gettext "Grenada"`" - ;; - 'GE' ) - COUNTRYNAME="`gettext "Georgia"`" - ;; - 'GF' ) - COUNTRYNAME="`gettext "French Guiana"`" - ;; - 'GH' ) - COUNTRYNAME="`gettext "Ghana"`" - ;; - 'GI' ) - COUNTRYNAME="`gettext "Gibraltar"`" - ;; - 'GL' ) - COUNTRYNAME="`gettext "Greenland"`" - ;; - 'GM' ) - COUNTRYNAME="`gettext "Gambia"`" - ;; - 'GN' ) - COUNTRYNAME="`gettext "Guinea"`" - ;; - 'GP' ) - COUNTRYNAME="`gettext "Guadeloupe"`" - ;; - 'GQ' ) - COUNTRYNAME="`gettext "Equatorial Guinea"`" - ;; - 'GR' ) - COUNTRYNAME="`gettext "Greece"`" - ;; - 'GS' ) - COUNTRYNAME="`gettext "South Georgia and the South Sandwich Islands"`" - ;; - 'GT' ) - COUNTRYNAME="`gettext "Guatemala"`" - ;; - 'GU' ) - COUNTRYNAME="`gettext "Guam"`" - ;; - 'GW' ) - COUNTRYNAME="`gettext "Guinea-Bissau"`" - ;; - 'GY' ) - COUNTRYNAME="`gettext "Guyana"`" - ;; - 'HK' ) - COUNTRYNAME="`gettext "Hong Kong"`" - ;; - 'HM' ) - COUNTRYNAME="`gettext "Heard Island and McDonald Islands"`" - ;; - 'HN' ) - COUNTRYNAME="`gettext "Honduras"`" - ;; - 'HR' ) - COUNTRYNAME="`gettext "Croatia"`" - ;; - 'HT' ) - COUNTRYNAME="`gettext "Haiti"`" - ;; - 'HU' ) - COUNTRYNAME="`gettext "Hungary"`" - ;; - 'ID' ) - COUNTRYNAME="`gettext "Indonesia"`" - ;; - 'IE' ) - COUNTRYNAME="`gettext "Ireland"`" - ;; - 'IL' ) - COUNTRYNAME="`gettext "Israel"`" - ;; - 'IN' ) - COUNTRYNAME="`gettext "India"`" - ;; - 'IO' ) - COUNTRYNAME="`gettext "British Indian Ocean Territory"`" - ;; - 'IQ' ) - COUNTRYNAME="`gettext "Iraq"`" - ;; - 'IR' ) - COUNTRYNAME="`gettext "Iran"`" - ;; - 'IS' ) - COUNTRYNAME="`gettext "Iceland"`" - ;; - 'IT' ) - COUNTRYNAME="`gettext "Italy"`" - ;; - 'JM' ) - COUNTRYNAME="`gettext "Jamaica"`" - ;; - 'JO' ) - COUNTRYNAME="`gettext "Jordan"`" - ;; - 'JP' ) - COUNTRYNAME="`gettext "Japan"`" - ;; - 'KE' ) - COUNTRYNAME="`gettext "Kenya"`" - ;; - 'KG' ) - COUNTRYNAME="`gettext "Kyrgyzstan"`" - ;; - 'KH' ) - COUNTRYNAME="`gettext "Cambodia"`" - ;; - 'KI' ) - COUNTRYNAME="`gettext "Kiribati"`" - ;; - 'KM' ) - COUNTRYNAME="`gettext "Comoros"`" - ;; - 'KN' ) - COUNTRYNAME="`gettext "St Kitts and Nevis"`" - ;; - 'KP' ) - COUNTRYNAME="`gettext "Korea (North)"`" - ;; - 'KR' ) - COUNTRYNAME="`gettext "Korea (South)"`" - ;; - 'KW' ) - COUNTRYNAME="`gettext "Kuwait"`" - ;; - 'KY' ) - COUNTRYNAME="`gettext "Cayman Islands"`" - ;; - 'KZ' ) - COUNTRYNAME="`gettext "Kazakhstan"`" - ;; - 'LA' ) - COUNTRYNAME="`gettext "Laos"`" - ;; - 'LB' ) - COUNTRYNAME="`gettext "Lebanon"`" - ;; - 'LC' ) - COUNTRYNAME="`gettext "St Lucia"`" - ;; - 'LI' ) - COUNTRYNAME="`gettext "Liechtenstein"`" - ;; - 'LK' ) - COUNTRYNAME="`gettext "Sri Lanka"`" - ;; - 'LR' ) - COUNTRYNAME="`gettext "Liberia"`" - ;; - 'LS' ) - COUNTRYNAME="`gettext "Lesotho"`" - ;; - 'LT' ) - COUNTRYNAME="`gettext "Lithuania"`" - ;; - 'LU' ) - COUNTRYNAME="`gettext "Luxembourg"`" - ;; - 'LV' ) - COUNTRYNAME="`gettext "Latvia"`" - ;; - 'LY' ) - COUNTRYNAME="`gettext "Libya"`" - ;; - 'MA' ) - COUNTRYNAME="`gettext "Morocco"`" - ;; - 'MC' ) - COUNTRYNAME="`gettext "Monaco"`" - ;; - 'MD' ) - COUNTRYNAME="`gettext "Moldova"`" - ;; - 'MG' ) - COUNTRYNAME="`gettext "Madagascar"`" - ;; - 'MH' ) - COUNTRYNAME="`gettext "Marshall Islands"`" - ;; - 'MK' ) - COUNTRYNAME="`gettext "Macedonia"`" - ;; - 'ML' ) - COUNTRYNAME="`gettext "Mali"`" - ;; - 'MM' ) - COUNTRYNAME="`gettext "Myanmar (Burma)"`" - ;; - 'MN' ) - COUNTRYNAME="`gettext "Mongolia"`" - ;; - 'MO' ) - COUNTRYNAME="`gettext "Macao"`" - ;; - 'MP' ) - COUNTRYNAME="`gettext "Northern Mariana Islands"`" - ;; - 'MQ' ) - COUNTRYNAME="`gettext "Martinique"`" - ;; - 'MR' ) - COUNTRYNAME="`gettext "Mauritania"`" - ;; - 'MS' ) - COUNTRYNAME="`gettext "Montserrat"`" - ;; - 'MT' ) - COUNTRYNAME="`gettext "Malta"`" - ;; - 'MU' ) - COUNTRYNAME="`gettext "Mauritius"`" - ;; - 'MV' ) - COUNTRYNAME="`gettext "Maldives"`" - ;; - 'MW' ) - COUNTRYNAME="`gettext "Malawi"`" - ;; - 'MX' ) - COUNTRYNAME="`gettext "Mexico"`" - ;; - 'MY' ) - COUNTRYNAME="`gettext "Malaysia"`" - ;; - 'MZ' ) - COUNTRYNAME="`gettext "Mozambique"`" - ;; - 'NA' ) - COUNTRYNAME="`gettext "Namibia"`" - ;; - 'NC' ) - COUNTRYNAME="`gettext "New Caledonia"`" - ;; - 'NE' ) - COUNTRYNAME="`gettext "Niger"`" - ;; - 'NF' ) - COUNTRYNAME="`gettext "Norfolk Island"`" - ;; - 'NG' ) - COUNTRYNAME="`gettext "Nigeria"`" - ;; - 'NI' ) - COUNTRYNAME="`gettext "Nicaragua"`" - ;; - 'NL' ) - COUNTRYNAME="`gettext "Netherlands"`" - ;; - 'NO' ) - COUNTRYNAME="`gettext "Norway"`" - ;; - 'NP' ) - COUNTRYNAME="`gettext "Nepal"`" - ;; - 'NR' ) - COUNTRYNAME="`gettext "Nauru"`" - ;; - 'NU' ) - COUNTRYNAME="`gettext "Niue"`" - ;; - 'NZ' ) - COUNTRYNAME="`gettext "New Zealand"`" - ;; - 'OM' ) - COUNTRYNAME="`gettext "Oman"`" - ;; - 'PA' ) - COUNTRYNAME="`gettext "Panama"`" - ;; - 'PE' ) - COUNTRYNAME="`gettext "Peru"`" - ;; - 'PF' ) - COUNTRYNAME="`gettext "French Polynesia"`" - ;; - 'PG' ) - COUNTRYNAME="`gettext "Papua New Guinea"`" - ;; - 'PH' ) - COUNTRYNAME="`gettext "Philippines"`" - ;; - 'PK' ) - COUNTRYNAME="`gettext "Pakistan"`" - ;; - 'PL' ) - COUNTRYNAME="`gettext "Poland"`" - ;; - 'PM' ) - COUNTRYNAME="`gettext "St Pierre and Miquelon"`" - ;; - 'PN' ) - COUNTRYNAME="`gettext "Pitcairn"`" - ;; - 'PR' ) - COUNTRYNAME="`gettext "Puerto Rico"`" - ;; - 'PS' ) - COUNTRYNAME="`gettext "Palestine"`" - ;; - 'PT' ) - COUNTRYNAME="`gettext "Portugal"`" - ;; - 'PW' ) - COUNTRYNAME="`gettext "Palau"`" - ;; - 'PY' ) - COUNTRYNAME="`gettext "Paraguay"`" - ;; - 'QA' ) - COUNTRYNAME="`gettext "Qatar"`" - ;; - 'RE' ) - COUNTRYNAME="`gettext "Reunion"`" - ;; - 'RO' ) - COUNTRYNAME="`gettext "Romania"`" - ;; - 'RU' ) - COUNTRYNAME="`gettext "Russia"`" - ;; - 'RW' ) - COUNTRYNAME="`gettext "Rwanda"`" - ;; - 'SA' ) - COUNTRYNAME="`gettext "Saudi Arabia"`" - ;; - 'SB' ) - COUNTRYNAME="`gettext "Solomon Islands"`" - ;; - 'SC' ) - COUNTRYNAME="`gettext "Seychelles"`" - ;; - 'SD' ) - COUNTRYNAME="`gettext "Sudan"`" - ;; - 'SE' ) - COUNTRYNAME="`gettext "Sweden"`" - ;; - 'SG' ) - COUNTRYNAME="`gettext "Singapore"`" - ;; - 'SH' ) - COUNTRYNAME="`gettext "St Helena"`" - ;; - 'SI' ) - COUNTRYNAME="`gettext "Slovenia"`" - ;; - 'SJ' ) - COUNTRYNAME="`gettext "Svalbard and Jan Mayen"`" - ;; - 'SK' ) - COUNTRYNAME="`gettext "Slovakia"`" - ;; - 'SL' ) - COUNTRYNAME="`gettext "Sierra Leone"`" - ;; - 'SM' ) - COUNTRYNAME="`gettext "San Marino"`" - ;; - 'SN' ) - COUNTRYNAME="`gettext "Senegal"`" - ;; - 'SO' ) - COUNTRYNAME="`gettext "Somalia"`" - ;; - 'SR' ) - COUNTRYNAME="`gettext "Suriname"`" - ;; - 'ST' ) - COUNTRYNAME="`gettext "Sao Tome and Principe"`" - ;; - 'SV' ) - COUNTRYNAME="`gettext "El Salvador"`" - ;; - 'SY' ) - COUNTRYNAME="`gettext "Syria"`" - ;; - 'SZ' ) - COUNTRYNAME="`gettext "Swaziland"`" - ;; - 'TC' ) - COUNTRYNAME="`gettext "Turks and Caicos Islands"`" - ;; - 'TD' ) - COUNTRYNAME="`gettext "Chad"`" - ;; - 'TF' ) - COUNTRYNAME="`gettext "French Southern and Antarctic Lands"`" - ;; - 'TG' ) - COUNTRYNAME="`gettext "Togo"`" - ;; - 'TH' ) - COUNTRYNAME="`gettext "Thailand"`" - ;; - 'TJ' ) - COUNTRYNAME="`gettext "Tajikistan"`" - ;; - 'TK' ) - COUNTRYNAME="`gettext "Tokelau"`" - ;; - 'TL' ) - COUNTRYNAME="`gettext "Timor-Leste"`" - ;; - 'TM' ) - COUNTRYNAME="`gettext "Turkmenistan"`" - ;; - 'TN' ) - COUNTRYNAME="`gettext "Tunisia"`" - ;; - 'TO' ) - COUNTRYNAME="`gettext "Tonga"`" - ;; - 'TR' ) - COUNTRYNAME="`gettext "Turkey"`" - ;; - 'TT' ) - COUNTRYNAME="`gettext "Trinidad and Tobago"`" - ;; - 'TV' ) - COUNTRYNAME="`gettext "Tuvalu"`" - ;; - 'TW' ) - COUNTRYNAME="`gettext "Taiwan"`" - ;; - 'TZ' ) - COUNTRYNAME="`gettext "Tanzania"`" - ;; - 'UA' ) - COUNTRYNAME="`gettext "Ukraine"`" - ;; - 'UG' ) - COUNTRYNAME="`gettext "Uganda"`" - ;; - 'UM' ) - COUNTRYNAME="`gettext "US minor outlying islands"`" - ;; - 'US' ) - COUNTRYNAME="`gettext "United States"`" - ;; - 'UY' ) - COUNTRYNAME="`gettext "Uruguay"`" - ;; - 'UZ' ) - COUNTRYNAME="`gettext "Uzbekistan"`" - ;; - 'VA' ) - COUNTRYNAME="`gettext "Vatican City"`" - ;; - 'VC' ) - COUNTRYNAME="`gettext "St Vincent"`" - ;; - 'VE' ) - COUNTRYNAME="`gettext "Venezuela"`" - ;; - 'VG' ) - COUNTRYNAME="`gettext "Virgin Islands (UK)"`" - ;; - 'VI' ) - COUNTRYNAME="`gettext "Virgin Islands (US)"`" - ;; - 'VN' ) - COUNTRYNAME="`gettext "Vietnam"`" - ;; - 'VU' ) - COUNTRYNAME="`gettext "Vanuatu"`" - ;; - 'WF' ) - COUNTRYNAME="`gettext "Wallis and Futuna"`" - ;; - 'WS' ) - COUNTRYNAME="`gettext "Samoa (Western)"`" - ;; - 'YE' ) - COUNTRYNAME="`gettext "Yemen"`" - ;; - 'YT' ) - COUNTRYNAME="`gettext "Mayotte"`" - ;; - 'ZA' ) - COUNTRYNAME="`gettext "South Africa"`" - ;; - 'ZM' ) - COUNTRYNAME="`gettext "Zambia"`" - ;; - 'ZW' ) - COUNTRYNAME="`gettext "Zimbabwe"`" - ;; - * ) - COUNTRYNAME="`gettext "Unknown"`" - - esac - - echo $COUNTRYNAME - -} diff --git a/Scripts/Bash/Functions/Commons/cli_getLangCodes.sh b/Scripts/Bash/Functions/Commons/cli_getLangCodes.sh deleted file mode 100755 index 0d409a7..0000000 --- a/Scripts/Bash/Functions/Commons/cli_getLangCodes.sh +++ /dev/null @@ -1,222 +0,0 @@ -#!/bin/bash -# -# cli_getLangCodes.sh -- This function outputs a list with language -# codes as defined in ISO639 standard. -# -# Copyright (C) 2009, 2010, 2011, 2012 The CentOS Project -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or (at -# your option) any later version. -# -# 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. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function cli_getLangCodes { - - local FILTER="$(echo $1 | cut -d_ -f1)" - - LANGCODES="aa - ab - ae - af - ak - am - an - ar - as - av - ay - az - ba - be - bg - bh - bi - bm - bn - bo - br - bs - ca - ce - ch - co - cr - cs - cu - cv - cy - da - de - dv - dz - ee - el - en - eo - es - et - eu - fa - ff - fi - fj - fo - fr - fy - ga - gd - gl - gn - gu - gv - ha - he - hi - ho - hr - ht - hu - hy - hz - ia - id - ie - ig - ii - ik - io - is - it - iu - ja - jv - ka - kg - ki - kj - kk - kl - km - kn - ko - kr - ks - ku - kv - kw - ky - la - lb - lg - li - ln - lo - lt - lu - lv - mg - mh - mi - mk - ml - mn - mo - mr - ms - mt - my - na - nb - nd - ne - ng - nl - nn - no - nr - nv - ny - oc - oj - om - or - os - pa - pi - pl - ps - pt - qu - rm - rn - ro - ru - rw - sa - sc - sd - se - sg - si - sk - sl - sm - sn - so - sq - sr - ss - st - su - sv - sw - ta - te - tg - th - ti - tk - tl - tn - to - tr - ts - tt - tw - ty - ug - uk - ur - uz - ve - vi - vo - wa - wo - xh - yi - yo - za - zh - zu" - - if [[ $FILTER != '' ]];then - echo "$LANGCODES" | egrep "$FILTER" | sed -r 's![[:space:]]+!!g' - else - echo "$LANGCODES" - fi - -} diff --git a/Scripts/Bash/Functions/Commons/cli_getLangName.sh b/Scripts/Bash/Functions/Commons/cli_getLangName.sh deleted file mode 100755 index 18a499d..0000000 --- a/Scripts/Bash/Functions/Commons/cli_getLangName.sh +++ /dev/null @@ -1,780 +0,0 @@ -#!/bin/bash -# -# cli_getLangName.sh -- This function reads one language locale code -# in the format LL_CC and outputs its language name. -# -# Copyright (C) 2009, 2010, 2011, 2012 The CentOS Project -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or (at -# your option) any later version. -# -# 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. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function cli_getLangName { - - local LANGCODE="$(echo "$1" | cut -d_ -f1 | tr '[:upper:]' '[:lower:]')" - local LANGNAME='' - - case $LANGCODE in - - 'aa' ) - LANGNAME="`gettext "Afar"`" - ;; - - 'ab' ) - LANGNAME="`gettext "Abkhazian"`" - ;; - - 'ae' ) - LANGNAME="`gettext "Avestan"`" - ;; - - 'af' ) - LANGNAME="`gettext "Afrikaans"`" - ;; - - 'ak' ) - LANGNAME="`gettext "Akan"`" - ;; - - 'am' ) - LANGNAME="`gettext "Amharic"`" - ;; - - 'an' ) - LANGNAME="`gettext "Aragonese"`" - ;; - - 'ar' ) - LANGNAME="`gettext "Arabic"`" - ;; - - 'as' ) - LANGNAME="`gettext "Assamese"`" - ;; - - 'av' ) - LANGNAME="`gettext "Avaric"`" - ;; - - 'ay' ) - LANGNAME="`gettext "Aymara"`" - ;; - - 'az' ) - LANGNAME="`gettext "Azerbaijani"`" - ;; - - 'ba' ) - LANGNAME="`gettext "Bashkir"`" - ;; - - 'be' ) - LANGNAME="`gettext "Byelorussian"`" - ;; - - 'bg' ) - LANGNAME="`gettext "Bulgarian"`" - ;; - - 'bh' ) - LANGNAME="`gettext "Bihari"`" - ;; - - 'bi' ) - LANGNAME="`gettext "Bislama"`" - ;; - - 'bm' ) - LANGNAME="`gettext "Bambara"`" - ;; - - 'bn' ) - LANGNAME="`gettext "Bengali"`" - ;; - - 'bo' ) - LANGNAME="`gettext "Tibetan"`" - ;; - - 'br' ) - LANGNAME="`gettext "Breton"`" - ;; - - 'bs' ) - LANGNAME="`gettext "Bosnian"`" - ;; - - 'ca' ) - LANGNAME="`gettext "Catalan"`" - ;; - - 'ce' ) - LANGNAME="`gettext "Chechen"`" - ;; - - 'ch' ) - LANGNAME="`gettext "Chamorro"`" - ;; - - 'co' ) - LANGNAME="`gettext "Corsican"`" - ;; - - 'cr' ) - LANGNAME="`gettext "Cree"`" - ;; - - 'cs' ) - LANGNAME="`gettext "Czech"`" - ;; - - 'cu' ) - LANGNAME="`gettext "Church Slavic"`" - ;; - - 'cv' ) - LANGNAME="`gettext "Chuvash"`" - ;; - - 'cy' ) - LANGNAME="`gettext "Welsh"`" - ;; - - 'da' ) - LANGNAME="`gettext "Danish"`" - ;; - - 'de' ) - LANGNAME="`gettext "German"`" - ;; - - 'dv' ) - LANGNAME="`gettext "Divehi"`" - ;; - - 'dz' ) - LANGNAME="`gettext "Dzongkha"`" - ;; - - 'ee' ) - LANGNAME="`gettext "E'we"`" - ;; - - 'el' ) - LANGNAME="`gettext "Greek"`" - ;; - - 'en' ) - LANGNAME="`gettext "English"`" - ;; - - 'eo' ) - LANGNAME="`gettext "Esperanto"`" - ;; - - 'es' ) - LANGNAME="`gettext "Spanish"`" - ;; - - 'et' ) - LANGNAME="`gettext "Estonian"`" - ;; - - 'eu' ) - LANGNAME="`gettext "Basque"`" - ;; - 'fa' ) - LANGNAME="`gettext "Persian"`" - ;; - - 'ff' ) - LANGNAME="`gettext "Fulah"`" - ;; - - 'fi' ) - LANGNAME="`gettext "Finnish"`" - ;; - - 'fj' ) - LANGNAME="`gettext "Fijian"`" - ;; - - 'fo' ) - LANGNAME="`gettext "Faroese"`" - ;; - - 'fr' ) - LANGNAME="`gettext "French"`" - ;; - - 'fy' ) - LANGNAME="`gettext "Frisian"`" - ;; - - 'ga' ) - LANGNAME="`gettext "Irish"`" - ;; - - 'gd' ) - LANGNAME="`gettext "Scots"`" - ;; - - 'gl' ) - LANGNAME="`gettext "Gallegan"`" - ;; - - 'gn' ) - LANGNAME="`gettext "Guarani"`" - ;; - - 'gu' ) - LANGNAME="`gettext "Gujarati"`" - ;; - - 'gv' ) - LANGNAME="`gettext "Manx"`" - ;; - - 'ha' ) - LANGNAME="`gettext "Hausa"`" - ;; - - 'he' ) - LANGNAME="`gettext "Hebrew"`" - ;; - - 'hi' ) - LANGNAME="`gettext "Hindi"`" - ;; - - 'ho' ) - LANGNAME="`gettext "Hiri Motu"`" - ;; - - 'hr' ) - LANGNAME="`gettext "Croatian"`" - ;; - - 'ht' ) - LANGNAME="`gettext "Haitian"`" - ;; - - 'hu' ) - LANGNAME="`gettext "Hungarian"`" - ;; - - 'hy' ) - LANGNAME="`gettext "Armenian"`" - ;; - - 'hz' ) - LANGNAME="`gettext "Herero"`" - ;; - - 'ia' ) - LANGNAME="`gettext "Interlingua"`" - ;; - - 'id' ) - LANGNAME="`gettext "Indonesian"`" - ;; - - 'ie' ) - LANGNAME="`gettext "Interlingue"`" - ;; - - 'ig' ) - LANGNAME="`gettext "Igbo"`" - ;; - - 'ii' ) - LANGNAME="`gettext "Sichuan Yi"`" - ;; - - 'ik' ) - LANGNAME="`gettext "Inupiak"`" - ;; - - 'io' ) - LANGNAME="`gettext "Ido"`" - ;; - - 'is' ) - LANGNAME="`gettext "Icelandic"`" - ;; - - 'it' ) - LANGNAME="`gettext "Italian"`" - ;; - - 'iu' ) - LANGNAME="`gettext "Inuktitut"`" - ;; - - 'ja' ) - LANGNAME="`gettext "Japanese"`" - ;; - - 'jv' ) - LANGNAME="`gettext "Javanese"`" - ;; - - 'ka' ) - LANGNAME="`gettext "Georgian"`" - ;; - - 'kg' ) - LANGNAME="`gettext "Kongo"`" - ;; - - 'ki' ) - LANGNAME="`gettext "Kikuyu"`" - ;; - - 'kj' ) - LANGNAME="`gettext "Kuanyama"`" - ;; - - 'kk' ) - LANGNAME="`gettext "Kazakh"`" - ;; - - 'kl' ) - LANGNAME="`gettext "Kalaallisut"`" - ;; - - 'km' ) - LANGNAME="`gettext "Khmer"`" - ;; - - 'kn' ) - LANGNAME="`gettext "Kannada"`" - ;; - - 'ko' ) - LANGNAME="`gettext "Korean"`" - ;; - - 'kr' ) - LANGNAME="`gettext "Kanuri"`" - ;; - - 'ks' ) - LANGNAME="`gettext "Kashmiri"`" - ;; - - 'ku' ) - LANGNAME="`gettext "Kurdish"`" - ;; - - 'kv' ) - LANGNAME="`gettext "Komi"`" - ;; - - 'kw' ) - LANGNAME="`gettext "Cornish"`" - ;; - - 'ky' ) - LANGNAME="`gettext "Kirghiz"`" - ;; - - 'la' ) - LANGNAME="`gettext "Latin"`" - ;; - - 'lb' ) - LANGNAME="`gettext "Letzeburgesch"`" - ;; - - 'lg' ) - LANGNAME="`gettext "Ganda"`" - ;; - - 'li' ) - LANGNAME="`gettext "Limburgish"`" - ;; - - 'ln' ) - LANGNAME="`gettext "Lingala"`" - ;; - - 'lo' ) - LANGNAME="`gettext "Lao"`" - ;; - - 'lt' ) - LANGNAME="`gettext "Lithuanian"`" - ;; - - 'lu' ) - LANGNAME="`gettext "Luba-Katanga"`" - ;; - - 'lv' ) - LANGNAME="`gettext "Latvian"`" - ;; - - 'mg' ) - LANGNAME="`gettext "Malagasy"`" - ;; - - 'mh' ) - LANGNAME="`gettext "Marshall"`" - ;; - - 'mi' ) - LANGNAME="`gettext "Maori"`" - ;; - - 'mk' ) - LANGNAME="`gettext "Macedonian"`" - ;; - - 'ml' ) - LANGNAME="`gettext "Malayalam"`" - ;; - - 'mn' ) - LANGNAME="`gettext "Mongolian"`" - ;; - - 'mo' ) - LANGNAME="`gettext "Moldavian"`" - ;; - - 'mr' ) - LANGNAME="`gettext "Marathi"`" - ;; - - 'ms' ) - LANGNAME="`gettext "Malay"`" - ;; - - 'mt' ) - LANGNAME="`gettext "Maltese"`" - ;; - - 'my' ) - LANGNAME="`gettext "Burmese"`" - ;; - - 'na' ) - LANGNAME="`gettext "Nauru"`" - ;; - - 'nb' ) - LANGNAME="`gettext "Norwegian Bokmaal"`" - ;; - - 'nd' ) - LANGNAME="`gettext "Ndebele, North"`" - ;; - - 'ne' ) - LANGNAME="`gettext "Nepali"`" - ;; - - 'ng' ) - LANGNAME="`gettext "Ndonga"`" - ;; - - 'nl' ) - LANGNAME="`gettext "Dutch"`" - ;; - - 'nn' ) - LANGNAME="`gettext "Norwegian Nynorsk"`" - ;; - - 'no' ) - LANGNAME="`gettext "Norwegian"`" - ;; - - 'nr' ) - LANGNAME="`gettext "Ndebele, South"`" - ;; - - 'nv' ) - LANGNAME="`gettext "Navajo"`" - ;; - - 'ny' ) - LANGNAME="`gettext "Chichewa"`" - ;; - - 'oc' ) - LANGNAME="`gettext "Occitan"`" - ;; - - 'oj' ) - LANGNAME="`gettext "Ojibwa"`" - ;; - - 'om' ) - LANGNAME="`gettext "(Afan) Oromo"`" - ;; - - 'or' ) - LANGNAME="`gettext "Oriya"`" - ;; - - 'os' ) - LANGNAME="`gettext "Ossetian; Ossetic"`" - ;; - - 'pa' ) - LANGNAME="`gettext "Panjabi; Punjabi"`" - ;; - - 'pi' ) - LANGNAME="`gettext "Pali"`" - ;; - - 'pl' ) - LANGNAME="`gettext "Polish"`" - ;; - - 'ps' ) - LANGNAME="`gettext "Pashto, Pushto"`" - ;; - - 'pt' ) - LANGNAME="`gettext "Portuguese"`" - ;; - - 'qu' ) - LANGNAME="`gettext "Quechua"`" - ;; - - 'rm' ) - LANGNAME="`gettext "Rhaeto-Romance"`" - ;; - - 'rn' ) - LANGNAME="`gettext "Rundi"`" - ;; - - 'ro' ) - LANGNAME="`gettext "Romanian"`" - ;; - - 'ru' ) - LANGNAME="`gettext "Russian"`" - ;; - - 'rw' ) - LANGNAME="`gettext "Kinyarwanda"`" - ;; - - 'sa' ) - LANGNAME="`gettext "Sanskrit"`" - ;; - - 'sc' ) - LANGNAME="`gettext "Sardinian"`" - ;; - - 'sd' ) - LANGNAME="`gettext "Sindhi"`" - ;; - - 'se' ) - LANGNAME="`gettext "Northern Sami"`" - ;; - - 'sg' ) - LANGNAME="`gettext "Sango; Sangro"`" - ;; - - 'si' ) - LANGNAME="`gettext "Sinhalese"`" - ;; - - 'sk' ) - LANGNAME="`gettext "Slovak"`" - ;; - - 'sl' ) - LANGNAME="`gettext "Slovenian"`" - ;; - - 'sm' ) - LANGNAME="`gettext "Samoan"`" - ;; - - 'sn' ) - LANGNAME="`gettext "Shona"`" - ;; - - 'so' ) - LANGNAME="`gettext "Somali"`" - ;; - - 'sq' ) - LANGNAME="`gettext "Albanian"`" - ;; - - 'sr' ) - LANGNAME="`gettext "Serbian"`" - ;; - - 'ss' ) - LANGNAME="`gettext "Swati; Siswati"`" - ;; - - 'st' ) - LANGNAME="`gettext "Sesotho; Sotho, Southern"`" - ;; - - 'su' ) - LANGNAME="`gettext "Sundanese"`" - ;; - - 'sv' ) - LANGNAME="`gettext "Swedish"`" - ;; - - 'sw' ) - LANGNAME="`gettext "Swahili"`" - ;; - - 'ta' ) - LANGNAME="`gettext "Tamil"`" - ;; - - 'te' ) - LANGNAME="`gettext "Telugu"`" - ;; - - 'tg' ) - LANGNAME="`gettext "Tajik"`" - ;; - - 'th' ) - LANGNAME="`gettext "Thai"`" - ;; - - 'ti' ) - LANGNAME="`gettext "Tigrinya"`" - ;; - - 'tk' ) - LANGNAME="`gettext "Turkmen"`" - ;; - - 'tl' ) - LANGNAME="`gettext "Tagalog"`" - ;; - - 'tn' ) - LANGNAME="`gettext "Tswana; Setswana"`" - ;; - - 'to' ) - LANGNAME="`gettext "Tonga (?)"`" - ;; - - 'tr' ) - LANGNAME="`gettext "Turkish"`" - ;; - - 'ts' ) - LANGNAME="`gettext "Tsonga"`" - ;; - - - 'tt' ) - LANGNAME="`gettext "Tatar"`" - ;; - - 'tw' ) - LANGNAME="`gettext "Twi"`" - ;; - - 'ty' ) - LANGNAME="`gettext "Tahitian"`" - ;; - - 'ug' ) - LANGNAME="`gettext "Uighur"`" - ;; - - 'uk' ) - LANGNAME="`gettext "Ukrainian"`" - ;; - - 'ur' ) - LANGNAME="`gettext "Urdu"`" - ;; - - 'uz' ) - LANGNAME="`gettext "Uzbek"`" - ;; - - 've' ) - LANGNAME="`gettext "Venda"`" - ;; - - 'vi' ) - LANGNAME="`gettext "Vietnamese"`" - ;; - - 'vo' ) - LANGNAME="`gettext "Volapuk; Volapuk"`" - ;; - - 'wa' ) - LANGNAME="`gettext "Walloon"`" - ;; - - 'wo' ) - LANGNAME="`gettext "Wolof"`" - ;; - - 'xh' ) - LANGNAME="`gettext "Xhosa"`" - ;; - - 'yi' ) - LANGNAME="`gettext "Yiddish (formerly ji)"`" - ;; - - 'yo' ) - LANGNAME="`gettext "Yoruba"`" - ;; - - 'za' ) - LANGNAME="`gettext "Zhuang"`" - ;; - - 'zh' ) - LANGNAME="`gettext "Chinese"`" - ;; - - 'zu' ) - LANGNAME="`gettext "Zulu"`" - ;; - - * ) - LANGNAME="`gettext "Unknown"`" - - esac - - echo $LANGNAME; -} - diff --git a/Scripts/Bash/Functions/Locale/locale_getCountryCodes.sh b/Scripts/Bash/Functions/Locale/locale_getCountryCodes.sh new file mode 100755 index 0000000..6b6309a --- /dev/null +++ b/Scripts/Bash/Functions/Locale/locale_getCountryCodes.sh @@ -0,0 +1,268 @@ +#!/bin/bash +# +# locale_getCountryCodes.sh -- This function outputs a list with country +# codes as defined in ISO3166 standard. +# +# Copyright (C) 2009, 2010, 2011, 2012 The CentOS Project +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# 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. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function locale_getCountryCodes { + + COUNTRYCODES='AD + AE + AF + AG + AI + AL + AM + AN + AO + AQ + AR + AS + AT + AU + AW + AZ + BA + BB + BD + BE + BF + BG + BH + BI + BJ + BM + BN + BO + BR + BS + BT + BV + BW + BY + BZ + CA + CC + CD + CF + CG + CH + CI + CK + CL + CM + CN + CO + CR + CS + CU + CV + CX + CY + CZ + DE + DJ + DK + DM + DO + DZ + EC + EE + EG + EH + ER + ES + ET + FI + FJ + FK + FM + FO + FR + GA + GB + GD + GE + GF + GH + GI + GL + GM + GN + GP + GQ + GR + GS + GT + GU + GW + GY + HK + HM + HN + HR + HT + HU + ID + IE + IL + IN + IO + IQ + IR + IS + IT + JM + JO + JP + KE + KG + KH + KI + KM + KN + KP + KR + KW + KY + KZ + LA + LB + LC + LI + LK + LR + LS + LT + LU + LV + LY + MA + MC + MD + MG + MH + MK + ML + MM + MN + MO + MP + MQ + MR + MS + MT + MU + MV + MW + MX + MY + MZ + NA + NC + NE + NF + NG + NI + NL + NO + NP + NR + NU + NZ + OM + PA + PE + PF + PG + PH + PK + PL + PM + PN + PR + PS + PT + PW + PY + QA + RE + RO + RU + RW + SA + SB + SC + SD + SE + SG + SH + SI + SJ + SK + SL + SM + SN + SO + SR + ST + SV + SY + SZ + TC + TD + TF + TG + TH + TJ + TK + TL + TM + TN + TO + TR + TT + TV + TW + TZ + UA + UG + UM + US + UY + UZ + VA + VC + VE + VG + VI + VN + VU + WF + WS + YE + YT + ZA + ZM + ZW' + +} diff --git a/Scripts/Bash/Functions/Locale/locale_getCountryName.sh b/Scripts/Bash/Functions/Locale/locale_getCountryName.sh new file mode 100755 index 0000000..2553105 --- /dev/null +++ b/Scripts/Bash/Functions/Locale/locale_getCountryName.sh @@ -0,0 +1,757 @@ +#!/bin/bash +# +# locale_getCountryName.sh -- This function reads one language locale +# code in the format LL_CC and outputs the name of its related +# country. +# +# Copyright (C) 2009, 2010, 2011, 2012 The CentOS Project +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# 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. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function locale_getCountryName { + + COUNTRYCODE=$(echo $COUNTRYCODE | sed -r 's!.+_([[:alpha:]]{2}).+!\1!') + + case $COUNTRYCODE in + + 'AD' ) + COUNTRYNAME="`gettext "Andorra"`" + ;; + 'AE' ) + COUNTRYNAME="`gettext "United Arab Emirates"`" + ;; + 'AF' ) + COUNTRYNAME="`gettext "Afghanistan"`" + ;; + 'AG' ) + COUNTRYNAME="`gettext "Antigua and Barbuda"`" + ;; + 'AI' ) + COUNTRYNAME="`gettext "Anguilla"`" + ;; + 'AL' ) + COUNTRYNAME="`gettext "Albania"`" + ;; + 'AM' ) + COUNTRYNAME="`gettext "Armenia"`" + ;; + 'AN' ) + COUNTRYNAME="`gettext "Netherlands Antilles"`" + ;; + 'AO' ) + COUNTRYNAME="`gettext "Angola"`" + ;; + 'AQ' ) + COUNTRYNAME="`gettext "Antarctica"`" + ;; + 'AR' ) + COUNTRYNAME="`gettext "Argentina"`" + ;; + 'AS' ) + COUNTRYNAME="`gettext "Samoa (American)"`" + ;; + 'AT' ) + COUNTRYNAME="`gettext "Austria"`" + ;; + 'AU' ) + COUNTRYNAME="`gettext "Australia"`" + ;; + 'AW' ) + COUNTRYNAME="`gettext "Aruba"`" + ;; + 'AZ' ) + COUNTRYNAME="`gettext "Azerbaijan"`" + ;; + 'BA' ) + COUNTRYNAME="`gettext "Bosnia and Herzegovina"`" + ;; + 'BB' ) + COUNTRYNAME="`gettext "Barbados"`" + ;; + 'BD' ) + COUNTRYNAME="`gettext "Bangladesh"`" + ;; + 'BE' ) + COUNTRYNAME="`gettext "Belgium"`" + ;; + 'BF' ) + COUNTRYNAME="`gettext "Burkina Faso"`" + ;; + 'BG' ) + COUNTRYNAME="`gettext "Bulgaria"`" + ;; + 'BH' ) + COUNTRYNAME="`gettext "Bahrain"`" + ;; + 'BI' ) + COUNTRYNAME="`gettext "Burundi"`" + ;; + 'BJ' ) + COUNTRYNAME="`gettext "Benin"`" + ;; + 'BM' ) + COUNTRYNAME="`gettext "Bermuda"`" + ;; + 'BN' ) + COUNTRYNAME="`gettext "Brunei"`" + ;; + 'BO' ) + COUNTRYNAME="`gettext "Bolivia"`" + ;; + 'BR' ) + COUNTRYNAME="`gettext "Brazil"`" + ;; + 'BS' ) + COUNTRYNAME="`gettext "Bahamas"`" + ;; + 'BT' ) + COUNTRYNAME="`gettext "Bhutan"`" + ;; + 'BV' ) + COUNTRYNAME="`gettext "Bouvet Island"`" + ;; + 'BW' ) + COUNTRYNAME="`gettext "Botswana"`" + ;; + 'BY' ) + COUNTRYNAME="`gettext "Belarus"`" + ;; + 'BZ' ) + COUNTRYNAME="`gettext "Belize"`" + ;; + 'CA' ) + COUNTRYNAME="`gettext "Canada"`" + ;; + 'CC' ) + COUNTRYNAME="`gettext "Cocos (Keeling) Islands"`" + ;; + 'CD' ) + COUNTRYNAME="`gettext "Congo (Dem. Rep.)"`" + ;; + 'CF' ) + COUNTRYNAME="`gettext "Central African Rep."`" + ;; + 'CG' ) + COUNTRYNAME="`gettext "Congo (Rep.)"`" + ;; + 'CH' ) + COUNTRYNAME="`gettext "Switzerland"`" + ;; + 'CI' ) + COUNTRYNAME="`gettext "Co^te d'Ivoire"`" + ;; + 'CK' ) + COUNTRYNAME="`gettext "Cook Islands"`" + ;; + 'CL' ) + COUNTRYNAME="`gettext "Chile"`" + ;; + 'CM' ) + COUNTRYNAME="`gettext "Cameroon"`" + ;; + 'CN' ) + COUNTRYNAME="`gettext "China"`" + ;; + 'CO' ) + COUNTRYNAME="`gettext "Colombia"`" + ;; + 'CR' ) + COUNTRYNAME="`gettext "Costa Rica"`" + ;; + 'CS' ) + COUNTRYNAME="`gettext "Serbia and Montenegro"`" + ;; + 'CU' ) + COUNTRYNAME="`gettext "Cuba"`" + ;; + 'CV' ) + COUNTRYNAME="`gettext "Cape Verde"`" + ;; + 'CX' ) + COUNTRYNAME="`gettext "Christmas Island"`" + ;; + 'CY' ) + COUNTRYNAME="`gettext "Cyprus"`" + ;; + 'CZ' ) + COUNTRYNAME="`gettext "Czech Republic"`" + ;; + 'DE' ) + COUNTRYNAME="`gettext "Germany"`" + ;; + 'DJ' ) + COUNTRYNAME="`gettext "Djibouti"`" + ;; + 'DK' ) + COUNTRYNAME="`gettext "Denmark"`" + ;; + 'DM' ) + COUNTRYNAME="`gettext "Dominica"`" + ;; + 'DO' ) + COUNTRYNAME="`gettext "Dominican Republic"`" + ;; + 'DZ' ) + COUNTRYNAME="`gettext "Algeria"`" + ;; + 'EC' ) + COUNTRYNAME="`gettext "Ecuador"`" + ;; + 'EE' ) + COUNTRYNAME="`gettext "Estonia"`" + ;; + 'EG' ) + COUNTRYNAME="`gettext "Egypt"`" + ;; + 'EH' ) + COUNTRYNAME="`gettext "Western Sahara"`" + ;; + 'ER' ) + COUNTRYNAME="`gettext "Eritrea"`" + ;; + 'ES' ) + COUNTRYNAME="`gettext "Spain"`" + ;; + 'ET' ) + COUNTRYNAME="`gettext "Ethiopia"`" + ;; + 'FI' ) + COUNTRYNAME="`gettext "Finland"`" + ;; + 'FJ' ) + COUNTRYNAME="`gettext "Fiji"`" + ;; + 'FK' ) + COUNTRYNAME="`gettext "Falkland Islands"`" + ;; + 'FM' ) + COUNTRYNAME="`gettext "Micronesia"`" + ;; + 'FO' ) + COUNTRYNAME="`gettext "Faeroe Islands"`" + ;; + 'FR' ) + COUNTRYNAME="`gettext "France"`" + ;; + 'GA' ) + COUNTRYNAME="`gettext "Gabon"`" + ;; + 'GB' ) + COUNTRYNAME="`gettext "Britain (UK)"`" + ;; + 'GD' ) + COUNTRYNAME="`gettext "Grenada"`" + ;; + 'GE' ) + COUNTRYNAME="`gettext "Georgia"`" + ;; + 'GF' ) + COUNTRYNAME="`gettext "French Guiana"`" + ;; + 'GH' ) + COUNTRYNAME="`gettext "Ghana"`" + ;; + 'GI' ) + COUNTRYNAME="`gettext "Gibraltar"`" + ;; + 'GL' ) + COUNTRYNAME="`gettext "Greenland"`" + ;; + 'GM' ) + COUNTRYNAME="`gettext "Gambia"`" + ;; + 'GN' ) + COUNTRYNAME="`gettext "Guinea"`" + ;; + 'GP' ) + COUNTRYNAME="`gettext "Guadeloupe"`" + ;; + 'GQ' ) + COUNTRYNAME="`gettext "Equatorial Guinea"`" + ;; + 'GR' ) + COUNTRYNAME="`gettext "Greece"`" + ;; + 'GS' ) + COUNTRYNAME="`gettext "South Georgia and the South Sandwich Islands"`" + ;; + 'GT' ) + COUNTRYNAME="`gettext "Guatemala"`" + ;; + 'GU' ) + COUNTRYNAME="`gettext "Guam"`" + ;; + 'GW' ) + COUNTRYNAME="`gettext "Guinea-Bissau"`" + ;; + 'GY' ) + COUNTRYNAME="`gettext "Guyana"`" + ;; + 'HK' ) + COUNTRYNAME="`gettext "Hong Kong"`" + ;; + 'HM' ) + COUNTRYNAME="`gettext "Heard Island and McDonald Islands"`" + ;; + 'HN' ) + COUNTRYNAME="`gettext "Honduras"`" + ;; + 'HR' ) + COUNTRYNAME="`gettext "Croatia"`" + ;; + 'HT' ) + COUNTRYNAME="`gettext "Haiti"`" + ;; + 'HU' ) + COUNTRYNAME="`gettext "Hungary"`" + ;; + 'ID' ) + COUNTRYNAME="`gettext "Indonesia"`" + ;; + 'IE' ) + COUNTRYNAME="`gettext "Ireland"`" + ;; + 'IL' ) + COUNTRYNAME="`gettext "Israel"`" + ;; + 'IN' ) + COUNTRYNAME="`gettext "India"`" + ;; + 'IO' ) + COUNTRYNAME="`gettext "British Indian Ocean Territory"`" + ;; + 'IQ' ) + COUNTRYNAME="`gettext "Iraq"`" + ;; + 'IR' ) + COUNTRYNAME="`gettext "Iran"`" + ;; + 'IS' ) + COUNTRYNAME="`gettext "Iceland"`" + ;; + 'IT' ) + COUNTRYNAME="`gettext "Italy"`" + ;; + 'JM' ) + COUNTRYNAME="`gettext "Jamaica"`" + ;; + 'JO' ) + COUNTRYNAME="`gettext "Jordan"`" + ;; + 'JP' ) + COUNTRYNAME="`gettext "Japan"`" + ;; + 'KE' ) + COUNTRYNAME="`gettext "Kenya"`" + ;; + 'KG' ) + COUNTRYNAME="`gettext "Kyrgyzstan"`" + ;; + 'KH' ) + COUNTRYNAME="`gettext "Cambodia"`" + ;; + 'KI' ) + COUNTRYNAME="`gettext "Kiribati"`" + ;; + 'KM' ) + COUNTRYNAME="`gettext "Comoros"`" + ;; + 'KN' ) + COUNTRYNAME="`gettext "St Kitts and Nevis"`" + ;; + 'KP' ) + COUNTRYNAME="`gettext "Korea (North)"`" + ;; + 'KR' ) + COUNTRYNAME="`gettext "Korea (South)"`" + ;; + 'KW' ) + COUNTRYNAME="`gettext "Kuwait"`" + ;; + 'KY' ) + COUNTRYNAME="`gettext "Cayman Islands"`" + ;; + 'KZ' ) + COUNTRYNAME="`gettext "Kazakhstan"`" + ;; + 'LA' ) + COUNTRYNAME="`gettext "Laos"`" + ;; + 'LB' ) + COUNTRYNAME="`gettext "Lebanon"`" + ;; + 'LC' ) + COUNTRYNAME="`gettext "St Lucia"`" + ;; + 'LI' ) + COUNTRYNAME="`gettext "Liechtenstein"`" + ;; + 'LK' ) + COUNTRYNAME="`gettext "Sri Lanka"`" + ;; + 'LR' ) + COUNTRYNAME="`gettext "Liberia"`" + ;; + 'LS' ) + COUNTRYNAME="`gettext "Lesotho"`" + ;; + 'LT' ) + COUNTRYNAME="`gettext "Lithuania"`" + ;; + 'LU' ) + COUNTRYNAME="`gettext "Luxembourg"`" + ;; + 'LV' ) + COUNTRYNAME="`gettext "Latvia"`" + ;; + 'LY' ) + COUNTRYNAME="`gettext "Libya"`" + ;; + 'MA' ) + COUNTRYNAME="`gettext "Morocco"`" + ;; + 'MC' ) + COUNTRYNAME="`gettext "Monaco"`" + ;; + 'MD' ) + COUNTRYNAME="`gettext "Moldova"`" + ;; + 'MG' ) + COUNTRYNAME="`gettext "Madagascar"`" + ;; + 'MH' ) + COUNTRYNAME="`gettext "Marshall Islands"`" + ;; + 'MK' ) + COUNTRYNAME="`gettext "Macedonia"`" + ;; + 'ML' ) + COUNTRYNAME="`gettext "Mali"`" + ;; + 'MM' ) + COUNTRYNAME="`gettext "Myanmar (Burma)"`" + ;; + 'MN' ) + COUNTRYNAME="`gettext "Mongolia"`" + ;; + 'MO' ) + COUNTRYNAME="`gettext "Macao"`" + ;; + 'MP' ) + COUNTRYNAME="`gettext "Northern Mariana Islands"`" + ;; + 'MQ' ) + COUNTRYNAME="`gettext "Martinique"`" + ;; + 'MR' ) + COUNTRYNAME="`gettext "Mauritania"`" + ;; + 'MS' ) + COUNTRYNAME="`gettext "Montserrat"`" + ;; + 'MT' ) + COUNTRYNAME="`gettext "Malta"`" + ;; + 'MU' ) + COUNTRYNAME="`gettext "Mauritius"`" + ;; + 'MV' ) + COUNTRYNAME="`gettext "Maldives"`" + ;; + 'MW' ) + COUNTRYNAME="`gettext "Malawi"`" + ;; + 'MX' ) + COUNTRYNAME="`gettext "Mexico"`" + ;; + 'MY' ) + COUNTRYNAME="`gettext "Malaysia"`" + ;; + 'MZ' ) + COUNTRYNAME="`gettext "Mozambique"`" + ;; + 'NA' ) + COUNTRYNAME="`gettext "Namibia"`" + ;; + 'NC' ) + COUNTRYNAME="`gettext "New Caledonia"`" + ;; + 'NE' ) + COUNTRYNAME="`gettext "Niger"`" + ;; + 'NF' ) + COUNTRYNAME="`gettext "Norfolk Island"`" + ;; + 'NG' ) + COUNTRYNAME="`gettext "Nigeria"`" + ;; + 'NI' ) + COUNTRYNAME="`gettext "Nicaragua"`" + ;; + 'NL' ) + COUNTRYNAME="`gettext "Netherlands"`" + ;; + 'NO' ) + COUNTRYNAME="`gettext "Norway"`" + ;; + 'NP' ) + COUNTRYNAME="`gettext "Nepal"`" + ;; + 'NR' ) + COUNTRYNAME="`gettext "Nauru"`" + ;; + 'NU' ) + COUNTRYNAME="`gettext "Niue"`" + ;; + 'NZ' ) + COUNTRYNAME="`gettext "New Zealand"`" + ;; + 'OM' ) + COUNTRYNAME="`gettext "Oman"`" + ;; + 'PA' ) + COUNTRYNAME="`gettext "Panama"`" + ;; + 'PE' ) + COUNTRYNAME="`gettext "Peru"`" + ;; + 'PF' ) + COUNTRYNAME="`gettext "French Polynesia"`" + ;; + 'PG' ) + COUNTRYNAME="`gettext "Papua New Guinea"`" + ;; + 'PH' ) + COUNTRYNAME="`gettext "Philippines"`" + ;; + 'PK' ) + COUNTRYNAME="`gettext "Pakistan"`" + ;; + 'PL' ) + COUNTRYNAME="`gettext "Poland"`" + ;; + 'PM' ) + COUNTRYNAME="`gettext "St Pierre and Miquelon"`" + ;; + 'PN' ) + COUNTRYNAME="`gettext "Pitcairn"`" + ;; + 'PR' ) + COUNTRYNAME="`gettext "Puerto Rico"`" + ;; + 'PS' ) + COUNTRYNAME="`gettext "Palestine"`" + ;; + 'PT' ) + COUNTRYNAME="`gettext "Portugal"`" + ;; + 'PW' ) + COUNTRYNAME="`gettext "Palau"`" + ;; + 'PY' ) + COUNTRYNAME="`gettext "Paraguay"`" + ;; + 'QA' ) + COUNTRYNAME="`gettext "Qatar"`" + ;; + 'RE' ) + COUNTRYNAME="`gettext "Reunion"`" + ;; + 'RO' ) + COUNTRYNAME="`gettext "Romania"`" + ;; + 'RU' ) + COUNTRYNAME="`gettext "Russia"`" + ;; + 'RW' ) + COUNTRYNAME="`gettext "Rwanda"`" + ;; + 'SA' ) + COUNTRYNAME="`gettext "Saudi Arabia"`" + ;; + 'SB' ) + COUNTRYNAME="`gettext "Solomon Islands"`" + ;; + 'SC' ) + COUNTRYNAME="`gettext "Seychelles"`" + ;; + 'SD' ) + COUNTRYNAME="`gettext "Sudan"`" + ;; + 'SE' ) + COUNTRYNAME="`gettext "Sweden"`" + ;; + 'SG' ) + COUNTRYNAME="`gettext "Singapore"`" + ;; + 'SH' ) + COUNTRYNAME="`gettext "St Helena"`" + ;; + 'SI' ) + COUNTRYNAME="`gettext "Slovenia"`" + ;; + 'SJ' ) + COUNTRYNAME="`gettext "Svalbard and Jan Mayen"`" + ;; + 'SK' ) + COUNTRYNAME="`gettext "Slovakia"`" + ;; + 'SL' ) + COUNTRYNAME="`gettext "Sierra Leone"`" + ;; + 'SM' ) + COUNTRYNAME="`gettext "San Marino"`" + ;; + 'SN' ) + COUNTRYNAME="`gettext "Senegal"`" + ;; + 'SO' ) + COUNTRYNAME="`gettext "Somalia"`" + ;; + 'SR' ) + COUNTRYNAME="`gettext "Suriname"`" + ;; + 'ST' ) + COUNTRYNAME="`gettext "Sao Tome and Principe"`" + ;; + 'SV' ) + COUNTRYNAME="`gettext "El Salvador"`" + ;; + 'SY' ) + COUNTRYNAME="`gettext "Syria"`" + ;; + 'SZ' ) + COUNTRYNAME="`gettext "Swaziland"`" + ;; + 'TC' ) + COUNTRYNAME="`gettext "Turks and Caicos Islands"`" + ;; + 'TD' ) + COUNTRYNAME="`gettext "Chad"`" + ;; + 'TF' ) + COUNTRYNAME="`gettext "French Southern and Antarctic Lands"`" + ;; + 'TG' ) + COUNTRYNAME="`gettext "Togo"`" + ;; + 'TH' ) + COUNTRYNAME="`gettext "Thailand"`" + ;; + 'TJ' ) + COUNTRYNAME="`gettext "Tajikistan"`" + ;; + 'TK' ) + COUNTRYNAME="`gettext "Tokelau"`" + ;; + 'TL' ) + COUNTRYNAME="`gettext "Timor-Leste"`" + ;; + 'TM' ) + COUNTRYNAME="`gettext "Turkmenistan"`" + ;; + 'TN' ) + COUNTRYNAME="`gettext "Tunisia"`" + ;; + 'TO' ) + COUNTRYNAME="`gettext "Tonga"`" + ;; + 'TR' ) + COUNTRYNAME="`gettext "Turkey"`" + ;; + 'TT' ) + COUNTRYNAME="`gettext "Trinidad and Tobago"`" + ;; + 'TV' ) + COUNTRYNAME="`gettext "Tuvalu"`" + ;; + 'TW' ) + COUNTRYNAME="`gettext "Taiwan"`" + ;; + 'TZ' ) + COUNTRYNAME="`gettext "Tanzania"`" + ;; + 'UA' ) + COUNTRYNAME="`gettext "Ukraine"`" + ;; + 'UG' ) + COUNTRYNAME="`gettext "Uganda"`" + ;; + 'UM' ) + COUNTRYNAME="`gettext "US minor outlying islands"`" + ;; + 'US' ) + COUNTRYNAME="`gettext "United States"`" + ;; + 'UY' ) + COUNTRYNAME="`gettext "Uruguay"`" + ;; + 'UZ' ) + COUNTRYNAME="`gettext "Uzbekistan"`" + ;; + 'VA' ) + COUNTRYNAME="`gettext "Vatican City"`" + ;; + 'VC' ) + COUNTRYNAME="`gettext "St Vincent"`" + ;; + 'VE' ) + COUNTRYNAME="`gettext "Venezuela"`" + ;; + 'VG' ) + COUNTRYNAME="`gettext "Virgin Islands (UK)"`" + ;; + 'VI' ) + COUNTRYNAME="`gettext "Virgin Islands (US)"`" + ;; + 'VN' ) + COUNTRYNAME="`gettext "Vietnam"`" + ;; + 'VU' ) + COUNTRYNAME="`gettext "Vanuatu"`" + ;; + 'WF' ) + COUNTRYNAME="`gettext "Wallis and Futuna"`" + ;; + 'WS' ) + COUNTRYNAME="`gettext "Samoa (Western)"`" + ;; + 'YE' ) + COUNTRYNAME="`gettext "Yemen"`" + ;; + 'YT' ) + COUNTRYNAME="`gettext "Mayotte"`" + ;; + 'ZA' ) + COUNTRYNAME="`gettext "South Africa"`" + ;; + 'ZM' ) + COUNTRYNAME="`gettext "Zambia"`" + ;; + 'ZW' ) + COUNTRYNAME="`gettext "Zimbabwe"`" + ;; + * ) + COUNTRYNAME="`gettext "Unknown"`" + + esac + + echo $COUNTRYNAME + +} diff --git a/Scripts/Bash/Functions/Locale/locale_getCurrentCountryCode.sh b/Scripts/Bash/Functions/Locale/locale_getCurrentCountryCode.sh new file mode 100755 index 0000000..49da66c --- /dev/null +++ b/Scripts/Bash/Functions/Locale/locale_getCurrentCountryCode.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# +# locale_getCurrentCountryCode.sh -- This function checks LANG +# environment variable and returns the current locale information in +# the CC format. +# +# Copyright (C) 2009, 2010, 2011, 2012 The CentOS Project +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# 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. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function locale_getCurrentCountryCode { + + # Output current language code. + locale_getCurrentLocale | cut -d'_' -f2 + +} diff --git a/Scripts/Bash/Functions/Locale/locale_getCurrentLanguageCode.sh b/Scripts/Bash/Functions/Locale/locale_getCurrentLanguageCode.sh new file mode 100755 index 0000000..ae97eb5 --- /dev/null +++ b/Scripts/Bash/Functions/Locale/locale_getCurrentLanguageCode.sh @@ -0,0 +1,33 @@ +#!/bin/bash +# +# locale_getCurrentLanguageCode.sh -- This function checks LANG +# environment variable and returns the current locale information in +# the LL format. +# +# Copyright (C) 2009, 2010, 2011, 2012 The CentOS Project +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# 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. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id: locale_getCurrentLanguageCode.sh 5653 2012-09-16 20:37:21Z al $ +# ---------------------------------------------------------------------- + +function locale_getCurrentLanguageCode { + + # Output current language code. + locale_getCurrentLocale | cut -d'_' -f1 + +} + diff --git a/Scripts/Bash/Functions/Locale/locale_getLanguageCodes.sh b/Scripts/Bash/Functions/Locale/locale_getLanguageCodes.sh new file mode 100755 index 0000000..5af9263 --- /dev/null +++ b/Scripts/Bash/Functions/Locale/locale_getLanguageCodes.sh @@ -0,0 +1,214 @@ +#!/bin/bash +# +# locale_getLanguageCodes.sh -- This function outputs a list with language +# codes as defined in ISO639 standard. +# +# Copyright (C) 2009, 2010, 2011, 2012 The CentOS Project +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# 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. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function locale_getLanguageCodes { + + LANGCODES="aa + ab + ae + af + ak + am + an + ar + as + av + ay + az + ba + be + bg + bh + bi + bm + bn + bo + br + bs + ca + ce + ch + co + cr + cs + cu + cv + cy + da + de + dv + dz + ee + el + en + eo + es + et + eu + fa + ff + fi + fj + fo + fr + fy + ga + gd + gl + gn + gu + gv + ha + he + hi + ho + hr + ht + hu + hy + hz + ia + id + ie + ig + ii + ik + io + is + it + iu + ja + jv + ka + kg + ki + kj + kk + kl + km + kn + ko + kr + ks + ku + kv + kw + ky + la + lb + lg + li + ln + lo + lt + lu + lv + mg + mh + mi + mk + ml + mn + mo + mr + ms + mt + my + na + nb + nd + ne + ng + nl + nn + no + nr + nv + ny + oc + oj + om + or + os + pa + pi + pl + ps + pt + qu + rm + rn + ro + ru + rw + sa + sc + sd + se + sg + si + sk + sl + sm + sn + so + sq + sr + ss + st + su + sv + sw + ta + te + tg + th + ti + tk + tl + tn + to + tr + ts + tt + tw + ty + ug + uk + ur + uz + ve + vi + vo + wa + wo + xh + yi + yo + za + zh + zu" + +} diff --git a/Scripts/Bash/Functions/Locale/locale_getLanguageName.sh b/Scripts/Bash/Functions/Locale/locale_getLanguageName.sh new file mode 100755 index 0000000..bef071a --- /dev/null +++ b/Scripts/Bash/Functions/Locale/locale_getLanguageName.sh @@ -0,0 +1,781 @@ +#!/bin/bash +# +# cli_getLangName.sh -- This function reads one language locale code +# in the format LL_CC and outputs its language name. +# +# Copyright (C) 2009, 2010, 2011, 2012 The CentOS Project +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# 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. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function locale_getLanguageName { + + local LANGCODE="$(echo "$1" | cut -d_ -f1 | tr '[:upper:]' '[:lower:]')" + local LANGNAME='' + + case $LANGCODE in + + 'aa' ) + LANGNAME="`gettext "Afar"`" + ;; + + 'ab' ) + LANGNAME="`gettext "Abkhazian"`" + ;; + + 'ae' ) + LANGNAME="`gettext "Avestan"`" + ;; + + 'af' ) + LANGNAME="`gettext "Afrikaans"`" + ;; + + 'ak' ) + LANGNAME="`gettext "Akan"`" + ;; + + 'am' ) + LANGNAME="`gettext "Amharic"`" + ;; + + 'an' ) + LANGNAME="`gettext "Aragonese"`" + ;; + + 'ar' ) + LANGNAME="`gettext "Arabic"`" + ;; + + 'as' ) + LANGNAME="`gettext "Assamese"`" + ;; + + 'av' ) + LANGNAME="`gettext "Avaric"`" + ;; + + 'ay' ) + LANGNAME="`gettext "Aymara"`" + ;; + + 'az' ) + LANGNAME="`gettext "Azerbaijani"`" + ;; + + 'ba' ) + LANGNAME="`gettext "Bashkir"`" + ;; + + 'be' ) + LANGNAME="`gettext "Byelorussian"`" + ;; + + 'bg' ) + LANGNAME="`gettext "Bulgarian"`" + ;; + + 'bh' ) + LANGNAME="`gettext "Bihari"`" + ;; + + 'bi' ) + LANGNAME="`gettext "Bislama"`" + ;; + + 'bm' ) + LANGNAME="`gettext "Bambara"`" + ;; + + 'bn' ) + LANGNAME="`gettext "Bengali"`" + ;; + + 'bo' ) + LANGNAME="`gettext "Tibetan"`" + ;; + + 'br' ) + LANGNAME="`gettext "Breton"`" + ;; + + 'bs' ) + LANGNAME="`gettext "Bosnian"`" + ;; + + 'ca' ) + LANGNAME="`gettext "Catalan"`" + ;; + + 'ce' ) + LANGNAME="`gettext "Chechen"`" + ;; + + 'ch' ) + LANGNAME="`gettext "Chamorro"`" + ;; + + 'co' ) + LANGNAME="`gettext "Corsican"`" + ;; + + 'cr' ) + LANGNAME="`gettext "Cree"`" + ;; + + 'cs' ) + LANGNAME="`gettext "Czech"`" + ;; + + 'cu' ) + LANGNAME="`gettext "Church Slavic"`" + ;; + + 'cv' ) + LANGNAME="`gettext "Chuvash"`" + ;; + + 'cy' ) + LANGNAME="`gettext "Welsh"`" + ;; + + 'da' ) + LANGNAME="`gettext "Danish"`" + ;; + + 'de' ) + LANGNAME="`gettext "German"`" + ;; + + 'dv' ) + LANGNAME="`gettext "Divehi"`" + ;; + + 'dz' ) + LANGNAME="`gettext "Dzongkha"`" + ;; + + 'ee' ) + LANGNAME="`gettext "E'we"`" + ;; + + 'el' ) + LANGNAME="`gettext "Greek"`" + ;; + + 'en' ) + LANGNAME="`gettext "English"`" + ;; + + 'eo' ) + LANGNAME="`gettext "Esperanto"`" + ;; + + 'es' ) + LANGNAME="`gettext "Spanish"`" + ;; + + 'et' ) + LANGNAME="`gettext "Estonian"`" + ;; + + 'eu' ) + LANGNAME="`gettext "Basque"`" + ;; + 'fa' ) + LANGNAME="`gettext "Persian"`" + ;; + + 'ff' ) + LANGNAME="`gettext "Fulah"`" + ;; + + 'fi' ) + LANGNAME="`gettext "Finnish"`" + ;; + + 'fj' ) + LANGNAME="`gettext "Fijian"`" + ;; + + 'fo' ) + LANGNAME="`gettext "Faroese"`" + ;; + + 'fr' ) + LANGNAME="`gettext "French"`" + ;; + + 'fy' ) + LANGNAME="`gettext "Frisian"`" + ;; + + 'ga' ) + LANGNAME="`gettext "Irish"`" + ;; + + 'gd' ) + LANGNAME="`gettext "Scots"`" + ;; + + 'gl' ) + LANGNAME="`gettext "Gallegan"`" + ;; + + 'gn' ) + LANGNAME="`gettext "Guarani"`" + ;; + + 'gu' ) + LANGNAME="`gettext "Gujarati"`" + ;; + + 'gv' ) + LANGNAME="`gettext "Manx"`" + ;; + + 'ha' ) + LANGNAME="`gettext "Hausa"`" + ;; + + 'he' ) + LANGNAME="`gettext "Hebrew"`" + ;; + + 'hi' ) + LANGNAME="`gettext "Hindi"`" + ;; + + 'ho' ) + LANGNAME="`gettext "Hiri Motu"`" + ;; + + 'hr' ) + LANGNAME="`gettext "Croatian"`" + ;; + + 'ht' ) + LANGNAME="`gettext "Haitian"`" + ;; + + 'hu' ) + LANGNAME="`gettext "Hungarian"`" + ;; + + 'hy' ) + LANGNAME="`gettext "Armenian"`" + ;; + + 'hz' ) + LANGNAME="`gettext "Herero"`" + ;; + + 'ia' ) + LANGNAME="`gettext "Interlingua"`" + ;; + + 'id' ) + LANGNAME="`gettext "Indonesian"`" + ;; + + 'ie' ) + LANGNAME="`gettext "Interlingue"`" + ;; + + 'ig' ) + LANGNAME="`gettext "Igbo"`" + ;; + + 'ii' ) + LANGNAME="`gettext "Sichuan Yi"`" + ;; + + 'ik' ) + LANGNAME="`gettext "Inupiak"`" + ;; + + 'io' ) + LANGNAME="`gettext "Ido"`" + ;; + + 'is' ) + LANGNAME="`gettext "Icelandic"`" + ;; + + 'it' ) + LANGNAME="`gettext "Italian"`" + ;; + + 'iu' ) + LANGNAME="`gettext "Inuktitut"`" + ;; + + 'ja' ) + LANGNAME="`gettext "Japanese"`" + ;; + + 'jv' ) + LANGNAME="`gettext "Javanese"`" + ;; + + 'ka' ) + LANGNAME="`gettext "Georgian"`" + ;; + + 'kg' ) + LANGNAME="`gettext "Kongo"`" + ;; + + 'ki' ) + LANGNAME="`gettext "Kikuyu"`" + ;; + + 'kj' ) + LANGNAME="`gettext "Kuanyama"`" + ;; + + 'kk' ) + LANGNAME="`gettext "Kazakh"`" + ;; + + 'kl' ) + LANGNAME="`gettext "Kalaallisut"`" + ;; + + 'km' ) + LANGNAME="`gettext "Khmer"`" + ;; + + 'kn' ) + LANGNAME="`gettext "Kannada"`" + ;; + + 'ko' ) + LANGNAME="`gettext "Korean"`" + ;; + + 'kr' ) + LANGNAME="`gettext "Kanuri"`" + ;; + + 'ks' ) + LANGNAME="`gettext "Kashmiri"`" + ;; + + 'ku' ) + LANGNAME="`gettext "Kurdish"`" + ;; + + 'kv' ) + LANGNAME="`gettext "Komi"`" + ;; + + 'kw' ) + LANGNAME="`gettext "Cornish"`" + ;; + + 'ky' ) + LANGNAME="`gettext "Kirghiz"`" + ;; + + 'la' ) + LANGNAME="`gettext "Latin"`" + ;; + + 'lb' ) + LANGNAME="`gettext "Letzeburgesch"`" + ;; + + 'lg' ) + LANGNAME="`gettext "Ganda"`" + ;; + + 'li' ) + LANGNAME="`gettext "Limburgish"`" + ;; + + 'ln' ) + LANGNAME="`gettext "Lingala"`" + ;; + + 'lo' ) + LANGNAME="`gettext "Lao"`" + ;; + + 'lt' ) + LANGNAME="`gettext "Lithuanian"`" + ;; + + 'lu' ) + LANGNAME="`gettext "Luba-Katanga"`" + ;; + + 'lv' ) + LANGNAME="`gettext "Latvian"`" + ;; + + 'mg' ) + LANGNAME="`gettext "Malagasy"`" + ;; + + 'mh' ) + LANGNAME="`gettext "Marshall"`" + ;; + + 'mi' ) + LANGNAME="`gettext "Maori"`" + ;; + + 'mk' ) + LANGNAME="`gettext "Macedonian"`" + ;; + + 'ml' ) + LANGNAME="`gettext "Malayalam"`" + ;; + + 'mn' ) + LANGNAME="`gettext "Mongolian"`" + ;; + + 'mo' ) + LANGNAME="`gettext "Moldavian"`" + ;; + + 'mr' ) + LANGNAME="`gettext "Marathi"`" + ;; + + 'ms' ) + LANGNAME="`gettext "Malay"`" + ;; + + 'mt' ) + LANGNAME="`gettext "Maltese"`" + ;; + + 'my' ) + LANGNAME="`gettext "Burmese"`" + ;; + + 'na' ) + LANGNAME="`gettext "Nauru"`" + ;; + + 'nb' ) + LANGNAME="`gettext "Norwegian Bokmaal"`" + ;; + + 'nd' ) + LANGNAME="`gettext "Ndebele, North"`" + ;; + + 'ne' ) + LANGNAME="`gettext "Nepali"`" + ;; + + 'ng' ) + LANGNAME="`gettext "Ndonga"`" + ;; + + 'nl' ) + LANGNAME="`gettext "Dutch"`" + ;; + + 'nn' ) + LANGNAME="`gettext "Norwegian Nynorsk"`" + ;; + + 'no' ) + LANGNAME="`gettext "Norwegian"`" + ;; + + 'nr' ) + LANGNAME="`gettext "Ndebele, South"`" + ;; + + 'nv' ) + LANGNAME="`gettext "Navajo"`" + ;; + + 'ny' ) + LANGNAME="`gettext "Chichewa"`" + ;; + + 'oc' ) + LANGNAME="`gettext "Occitan"`" + ;; + + 'oj' ) + LANGNAME="`gettext "Ojibwa"`" + ;; + + 'om' ) + LANGNAME="`gettext "(Afan) Oromo"`" + ;; + + 'or' ) + LANGNAME="`gettext "Oriya"`" + ;; + + 'os' ) + LANGNAME="`gettext "Ossetian; Ossetic"`" + ;; + + 'pa' ) + LANGNAME="`gettext "Panjabi; Punjabi"`" + ;; + + 'pi' ) + LANGNAME="`gettext "Pali"`" + ;; + + 'pl' ) + LANGNAME="`gettext "Polish"`" + ;; + + 'ps' ) + LANGNAME="`gettext "Pashto, Pushto"`" + ;; + + 'pt' ) + LANGNAME="`gettext "Portuguese"`" + ;; + + 'qu' ) + LANGNAME="`gettext "Quechua"`" + ;; + + 'rm' ) + LANGNAME="`gettext "Rhaeto-Romance"`" + ;; + + 'rn' ) + LANGNAME="`gettext "Rundi"`" + ;; + + 'ro' ) + LANGNAME="`gettext "Romanian"`" + ;; + + 'ru' ) + LANGNAME="`gettext "Russian"`" + ;; + + 'rw' ) + LANGNAME="`gettext "Kinyarwanda"`" + ;; + + 'sa' ) + LANGNAME="`gettext "Sanskrit"`" + ;; + + 'sc' ) + LANGNAME="`gettext "Sardinian"`" + ;; + + 'sd' ) + LANGNAME="`gettext "Sindhi"`" + ;; + + 'se' ) + LANGNAME="`gettext "Northern Sami"`" + ;; + + 'sg' ) + LANGNAME="`gettext "Sango; Sangro"`" + ;; + + 'si' ) + LANGNAME="`gettext "Sinhalese"`" + ;; + + 'sk' ) + LANGNAME="`gettext "Slovak"`" + ;; + + 'sl' ) + LANGNAME="`gettext "Slovenian"`" + ;; + + 'sm' ) + LANGNAME="`gettext "Samoan"`" + ;; + + 'sn' ) + LANGNAME="`gettext "Shona"`" + ;; + + 'so' ) + LANGNAME="`gettext "Somali"`" + ;; + + 'sq' ) + LANGNAME="`gettext "Albanian"`" + ;; + + 'sr' ) + LANGNAME="`gettext "Serbian"`" + ;; + + 'ss' ) + LANGNAME="`gettext "Swati; Siswati"`" + ;; + + 'st' ) + LANGNAME="`gettext "Sesotho; Sotho, Southern"`" + ;; + + 'su' ) + LANGNAME="`gettext "Sundanese"`" + ;; + + 'sv' ) + LANGNAME="`gettext "Swedish"`" + ;; + + 'sw' ) + LANGNAME="`gettext "Swahili"`" + ;; + + 'ta' ) + LANGNAME="`gettext "Tamil"`" + ;; + + 'te' ) + LANGNAME="`gettext "Telugu"`" + ;; + + 'tg' ) + LANGNAME="`gettext "Tajik"`" + ;; + + 'th' ) + LANGNAME="`gettext "Thai"`" + ;; + + 'ti' ) + LANGNAME="`gettext "Tigrinya"`" + ;; + + 'tk' ) + LANGNAME="`gettext "Turkmen"`" + ;; + + 'tl' ) + LANGNAME="`gettext "Tagalog"`" + ;; + + 'tn' ) + LANGNAME="`gettext "Tswana; Setswana"`" + ;; + + 'to' ) + LANGNAME="`gettext "Tonga (?)"`" + ;; + + 'tr' ) + LANGNAME="`gettext "Turkish"`" + ;; + + 'ts' ) + LANGNAME="`gettext "Tsonga"`" + ;; + + + 'tt' ) + LANGNAME="`gettext "Tatar"`" + ;; + + 'tw' ) + LANGNAME="`gettext "Twi"`" + ;; + + 'ty' ) + LANGNAME="`gettext "Tahitian"`" + ;; + + 'ug' ) + LANGNAME="`gettext "Uighur"`" + ;; + + 'uk' ) + LANGNAME="`gettext "Ukrainian"`" + ;; + + 'ur' ) + LANGNAME="`gettext "Urdu"`" + ;; + + 'uz' ) + LANGNAME="`gettext "Uzbek"`" + ;; + + 've' ) + LANGNAME="`gettext "Venda"`" + ;; + + 'vi' ) + LANGNAME="`gettext "Vietnamese"`" + ;; + + 'vo' ) + LANGNAME="`gettext "Volapuk; Volapuk"`" + ;; + + 'wa' ) + LANGNAME="`gettext "Walloon"`" + ;; + + 'wo' ) + LANGNAME="`gettext "Wolof"`" + ;; + + 'xh' ) + LANGNAME="`gettext "Xhosa"`" + ;; + + 'yi' ) + LANGNAME="`gettext "Yiddish (formerly ji)"`" + ;; + + 'yo' ) + LANGNAME="`gettext "Yoruba"`" + ;; + + 'za' ) + LANGNAME="`gettext "Zhuang"`" + ;; + + 'zh' ) + LANGNAME="`gettext "Chinese"`" + ;; + + 'zu' ) + LANGNAME="`gettext "Zulu"`" + ;; + + * ) + LANGNAME="`gettext "Unknown"`" + ;; + + esac + + echo $LANGNAME; + +}