1/*! 2 * jQuery-Browser-Language jQuery plugin v0.0.1 3 * 4 * Copyright 2010 by Dan Singerman <[email protected]> 5 * 6 * This program is free software; you can redistribute it and/or modify it 7 * under the terms of the GNU General Public License as published by the Free 8 * Software Foundation; either version 2 of the License, or (at your option) 9 * any later version. 10 * 11 * This program is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 14 * more details. 15 * 16 * You should have received a copy of the GNU General Public License along with 17 * this program; if not, write to the Free Software Foundation, Inc., 51 18 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 */ 20 21(function($){ 22 23 $.browserLanguage = function(callback){ 24 var language; 25 $.ajax({ 26 url: "http://ajaxhttpheaders.appspot.com", 27 dataType: 'jsonp', 28 success: function(headers) { 29 language = headers['Accept-Language'].substring(0,2); 30 callback(languageLookup[language], headers['Accept-Language']); 31 } 32 }); 33 } 34 35 /* 36 Language list from http://en.wikipedia.org/wiki/ISO_639-1_language_matrix 37 */ 38 39 var languageLookup = { 40 "ab": "Abkhazian", 41 "af": "Afrikaans", 42 "an": "Aragonese", 43 "ar": "Arabic", 44 "as": "Assamese", 45 "az": "Azerbaijani", 46 "be": "Belarusian", 47 "bg": "Bulgarian", 48 "bn": "Bengali", 49 "bo": "Tibetan", 50 "br": "Breton", 51 "bs": "Bosnian", 52 "ca": "Catalan / Valencian", 53 "ce": "Chechen", 54 "co": "Corsican", 55 "cs": "Czech", 56 "cu": "Church Slavic", 57 "cy": "Welsh", 58 "da": "Danish", 59 "de": "German", 60 "el": "Greek", 61 "en": "English", 62 "eo": "Esperanto", 63 "es": "Spanish / Castilian", 64 "et": "Estonian", 65 "eu": "Basque", 66 "fa": "Persian", 67 "fi": "Finnish", 68 "fj": "Fijian", 69 "fo": "Faroese", 70 "fr": "French", 71 "fy": "Western Frisian", 72 "ga": "Irish", 73 "gd": "Gaelic / Scottish Gaelic", 74 "gl": "Galician", 75 "gv": "Manx", 76 "he": "Hebrew", 77 "hi": "Hindi", 78 "hr": "Croatian", 79 "ht": "Haitian; Haitian Creole", 80 "hu": "Hungarian", 81 "hy": "Armenian", 82 "id": "Indonesian", 83 "is": "Icelandic", 84 "it": "Italian", 85 "ja": "Japanese", 86 "jv": "Javanese", 87 "ka": "Georgian", 88 "kg": "Kongo", 89 "ko": "Korean", 90 "ku": "Kurdish", 91 "kw": "Cornish", 92 "ky": "Kirghiz", 93 "la": "Latin", 94 "lb": "Luxembourgish Letzeburgesch", 95 "li": "Limburgan Limburger Limburgish", 96 "ln": "Lingala", 97 "lt": "Lithuanian", 98 "lv": "Latvian", 99 "mg": "Malagasy", 100 "mk": "Macedonian", 101 "mn": "Mongolian", 102 "mo": "Moldavian", 103 "ms": "Malay", 104 "mt": "Maltese", 105 "my": "Burmese", 106 "nb": "Norwegian (Bokmål)", 107 "ne": "Nepali", 108 "nl": "Dutch", 109 "nn": "Norwegian (Nynorsk)", 110 "no": "Norwegian", 111 "oc": "Occitan (post 1500); Provençal", 112 "pl": "Polish", 113 "pt": "Portuguese", 114 "rm": "Raeto-Romance", 115 "ro": "Romanian", 116 "ru": "Russian", 117 "sc": "Sardinian", 118 "se": "Northern Sami", 119 "sk": "Slovak", 120 "sl": "Slovenian", 121 "so": "Somali", 122 "sq": "Albanian", 123 "sr": "Serbian", 124 "sv": "Swedish", 125 "sw": "Swahili", 126 "tk": "Turkmen", 127 "tr": "Turkish", 128 "ty": "Tahitian", 129 "uk": "Ukrainian", 130 "ur": "Urdu", 131 "uz": "Uzbek", 132 "vi": "Vietnamese", 133 "vo": "Volapuk", 134 "yi": "Yiddish", 135 "zh": "Chinese" 136 } 137 138})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.