OLD | NEW |
(Empty) | |
| 1 # This file is part of the Adblock Plus web scripts, |
| 2 # Copyright (C) 2006-2014 Eyeo GmbH |
| 3 # |
| 4 # Adblock Plus is free software: you can redistribute it and/or modify |
| 5 # it under the terms of the GNU General Public License version 3 as |
| 6 # published by the Free Software Foundation. |
| 7 # |
| 8 # Adblock Plus is distributed in the hope that it will be useful, |
| 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 # GNU General Public License for more details. |
| 12 # |
| 13 # You should have received a copy of the GNU General Public License |
| 14 # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
| 15 |
| 16 ISO2PAD = { |
| 17 'ab': 'Abkhazian', |
| 18 'aa': 'Afar', |
| 19 'af': 'Afrikaans', |
| 20 'sq': 'Albanian', |
| 21 'am': 'Amharic', |
| 22 'ar': 'Arabic', |
| 23 'hy': 'Armenian', |
| 24 'as': 'Assamese', |
| 25 'ay': 'Aymara', |
| 26 'az': 'Azerbaijani', |
| 27 'ba': 'Bashkir', |
| 28 'eu': 'Basque', |
| 29 'be': 'Byelorussian', |
| 30 'bn': 'Bengali', |
| 31 'bh': 'Bihari', |
| 32 'bi': 'Bislama', |
| 33 'br': 'Breton', |
| 34 'bg': 'Bulgarian', |
| 35 'my': 'Burmese', |
| 36 'ca': 'Catalan', |
| 37 'zh': 'Chinese', |
| 38 'zh-cn': 'ChineseSimplified', |
| 39 'zh-tw': 'ChineseTraditional', |
| 40 'co': 'Corsican', |
| 41 'hr': 'Croatian', |
| 42 'cs': 'Czech', |
| 43 'da': 'Danish', |
| 44 'nl': 'Dutch', |
| 45 'en': 'English', |
| 46 'eo': 'Esperanto', |
| 47 'et': 'Estonian', |
| 48 'fo': 'Faeroese', |
| 49 'fj': 'Fiji', |
| 50 'fi': 'Finnish', |
| 51 'fr': 'French', |
| 52 'gl': 'Galician', |
| 53 'ka': 'Georgian', |
| 54 'de': 'German', |
| 55 'el': 'Greek', |
| 56 'gn': 'Guarani', |
| 57 'gu': 'Gujarati', |
| 58 'ha': 'Hausa', |
| 59 'he': 'Hebrew', |
| 60 'hi': 'Hindi', |
| 61 'hu': 'Hungarian', |
| 62 'ia': 'Interlingua', |
| 63 'id': 'Indonesian', |
| 64 'ie': 'Interlingue', |
| 65 'ga': 'Irish', |
| 66 'ik': 'Inupiak', |
| 67 'is': 'Icelandic', |
| 68 'it': 'Italian', |
| 69 'ja': 'Japanese', |
| 70 'jv': 'Javanese', |
| 71 'kl': 'Greenlandic', |
| 72 'kn': 'Kannada', |
| 73 'ks': 'Kashmiri', |
| 74 'kk': 'Kazakh', |
| 75 'km': 'Cambodian', |
| 76 'rw': 'Kinyarwanda', |
| 77 'ky': 'Kirghiz', |
| 78 'ko': 'Korean', |
| 79 'ku': 'Kurdish', |
| 80 'la': 'Latin', |
| 81 'ln': 'Lingala', |
| 82 'lo': 'Laothian', |
| 83 'lt': 'Lithuanian', |
| 84 'lv': 'Latvian', |
| 85 'mk': 'Macedonian', |
| 86 'mg': 'Malagasy', |
| 87 'ms': 'Malay', |
| 88 'ml': 'Malayalam', |
| 89 'mt': 'Maltese', |
| 90 'mi': 'Maori', |
| 91 'mr': 'Marathi', |
| 92 'mn': 'Mongolian', |
| 93 'na': 'Nauru', |
| 94 'ne': 'Nepali', |
| 95 'no': 'Norwegian', |
| 96 'oc': 'Occitan', |
| 97 'om': 'Oromo', |
| 98 'or': 'Oriya', |
| 99 'pa': 'Punjabi', |
| 100 'fa': 'Persian', |
| 101 'pl': 'Polish', |
| 102 'ps': 'Pashto', |
| 103 'pt': 'Portuguese', |
| 104 'qu': 'Quechua', |
| 105 'rm': 'Rhaeto-Romance', |
| 106 'rn': 'Kirundi', |
| 107 'ro': 'Romanian', |
| 108 'ru': 'Russian', |
| 109 'sa': 'Sanskrit', |
| 110 'sd': 'Sindhi', |
| 111 'sm': 'Samoan', |
| 112 'sg': 'Sangro', |
| 113 'sr': 'Serbian', |
| 114 'gd': 'Gaelic', |
| 115 'sn': 'Shona', |
| 116 'si': 'Singhalese', |
| 117 'sk': 'Slovak', |
| 118 'sl': 'Slovenian', |
| 119 'so': 'Somali', |
| 120 'st': 'Sesotho', |
| 121 'es': 'Spanish', |
| 122 'sw': 'Swahili', |
| 123 'ss': 'Siswati', |
| 124 'sv': 'Swedish', |
| 125 'sh': 'Serbo-Croatian', |
| 126 'ta': 'Tamil', |
| 127 'te': 'Telugu', |
| 128 'tg': 'Tajik', |
| 129 'th': 'Thai', |
| 130 'ti': 'Tigrinya', |
| 131 'bo': 'Tibetan', |
| 132 'tk': 'Turkmen', |
| 133 'tl': 'Tagalog', |
| 134 'tn': 'Setswana', |
| 135 'to': 'Tonga', |
| 136 'tr': 'Turkish', |
| 137 'ts': 'Tsonga', |
| 138 'tt': 'Tatar', |
| 139 'tw': 'Twi', |
| 140 'uk': 'Ukrainian', |
| 141 'ur': 'Urdu', |
| 142 'uz': 'Uzbek', |
| 143 'vi': 'Vietnamese', |
| 144 'vo': 'Volapuk', |
| 145 'cy': 'Welsh', |
| 146 'wo': 'Wolof', |
| 147 'fy': 'Frisian', |
| 148 'xh': 'Xhosa', |
| 149 'yi': 'Yiddish', |
| 150 'yo': 'Yoruba', |
| 151 'zu': 'Zulu', |
| 152 } |
| 153 |
| 154 def iso2pad(iso_languages): |
| 155 pad_languages = [] |
| 156 has_other = False |
| 157 |
| 158 for iso in iso_languages: |
| 159 iso = iso.replace('_', '-').lower() |
| 160 |
| 161 pad = ISO2PAD.get(iso) |
| 162 if not pad: |
| 163 pad = ISO2PAD.get(iso.split('-')[0]) |
| 164 if not pad: |
| 165 has_other = True |
| 166 continue |
| 167 |
| 168 if pad not in pad_languages: |
| 169 pad_languages.append(pad) |
| 170 |
| 171 pad_languages.sort() |
| 172 if has_other: |
| 173 pad_languages.append('Other') |
| 174 |
| 175 return pad_languages |
OLD | NEW |