📄 mlocale.c
字号:
/*** Modular Logfile Analyzer** Copyright 2000 Jan Kneschke <jan@kneschke.de>**** Homepage: http://www.kneschke.de/projekte/modlogan** 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, and provided that the above copyright and permission notice is included with all distributed copies of this or derived software. 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA**** $Id: mlocale.c,v 1.21 2000/11/11 23:02:42 jk Exp $*/#include <stdlib.h>#include <stdio.h>#include <string.h>#include <ctype.h>#include "mlocale.h"int init_locale (mconfig *conf) {#ifdef HAVE_GETTEXT if (conf != NULL && conf->language != NULL) { setlocale(LC_ALL, conf->language); } else { setlocale(LC_ALL, ""); } bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE);#endif return 0;}char *mhttpcodes(int status) { switch (status) { case 100: return _("Continue"); case 101: return _("Switching Protocols"); case 200: return _("OK"); case 201: return _("Created"); case 202: return _("Accepted"); case 203: return _("Non-Authoritative Information"); case 204: return _("No Content"); case 205: return _("Reset Content"); case 206: return _("Partial Content"); case 300: return _("Multiple Choices"); case 301: return _("Moved Permanently"); case 302: return _("Found"); case 303: return _("See Other"); case 304: return _("Not Modified"); case 305: return _("Use Proxy"); case 307: return _("Moved Temporarily"); case 400: return _("Bad Request"); case 401: return _("Unauthorized"); case 402: return _("Payment Required"); case 403: return _("Forbidden"); case 404: return _("Not Found"); case 405: return _("Method Not Allowed"); case 406: return _("Not Acceptable"); case 407: return _("Proxy Authentication Required"); case 408: return _("Request Timeout"); case 409: return _("Conflict"); case 410: return _("Gone"); case 411: return _("Length Required"); case 412: return _("Precondition Failed"); case 413: return _("Request Entity Too Large"); case 414: return _("Request-URI Too Long"); case 415: return _("Unsupported Media Type"); case 416: return _("Requested Range Not Satisfiable"); case 417: return _("Expectation Failed"); case 500: return _("Internal Server Error"); case 501: return _("Not Implemented"); case 502: return _("Bad Gateway"); case 503: return _("Service Unavailable"); case 504: return _("Gateway Timeout"); case 505: return _("HTTP Version Not Supported"); default: return _("Unknown status code"); }}int isondx(char *str) { int i = 0; int j = 3; if (!str || strlen(str) > 4) return M_RESOLV_UNKNOWN_ERROR; if (!isalpha(*str)) return M_RESOLV_UNRESOLVED; while (*str) { i |= tolower(*str) << (8*j); str++; j--; } return i;}#define NDX2(x,y) x << 24 | y << 16#define NDX3(x,y,z) x << 24 | y << 16 | z << 8 #define NDX4(x,y,z,a) x << 24 | y << 16 | z << 8 | achar *misoname(char *str) { switch(isondx(str)) {/* .ac */ case NDX2('a','c'): return _("Ascension Island");/* .ad */ case NDX2('a','d'): return _("Andorra"); /* .ae */ case NDX2('a','e'): return _("United Arab Emirates");/* .af */ case NDX2('a','f'): return _("Afghanistan");/* .ag */ case NDX2('a','g'): return _("Antigua and Barbuda");/* .ai */ case NDX2('a','i'): return _("Anguilla");/* .al */ case NDX2('a','l'): return _("Albania");/* .am */ case NDX2('a','m'): return _("Armenia");/* .an */ case NDX2('a','n'): return _("Netherlands Antilles");/* .ao */ case NDX2('a','o'): return _("Angola");/* .aq */ case NDX2('a','q'): return _("Antarctica");/* .ar */ case NDX2('a','r'): return _("Argentina");/* .arpa */ case NDX4('a','r','p','a'): return _("Old style Arpanet (arpa)");/* .as */ case NDX2('a','s'): return _("American Samoa");/* .at */ case NDX2('a','t'): return _("Austria");/* .au */ case NDX2('a','u'): return _("Australia");/* .aw */ case NDX2('a','w'): return _("Aruba");/* .az */ case NDX2('a','z'): return _("Azerbaijan");/* .ba */ case NDX2('b','a'): return _("Bosnia and Herzegovina");/* .bb */ case NDX2('b','b'): return _("Barbados");/* .bd */ case NDX2('b','d'): return _("Bangladesh");/* .be */ case NDX2('b','e'): return _("Belgium");/* .bf */ case NDX2('b','f'): return _("Burkina Faso");/* .bg */ case NDX2('b','g'): return _("Bulgaria");/* .bh */ case NDX2('b','h'): return _("Bahrain");/* .bi */ case NDX2('b','i'): return _("Burundi");/* .bj */ case NDX2('b','j'): return _("Benin");/* .bm */ case NDX2('b','m'): return _("Bermuda");/* .bn */ case NDX2('b','n'): return _("Brunei Darussalam");/* .bo */ case NDX2('b','o'): return _("Bolivia");/* .br */ case NDX2('b','r'): return _("Brasil");/* .bs */ case NDX2('b','s'): return _("Bahamas");/* .bt */ case NDX2('b','t'): return _("Bhutan");/* .bv */ case NDX2('b','v'): return _("Bouvet Island");/* .bw */ case NDX2('b','w'): return _("Botswana");/* .by */ case NDX2('b','y'): return _("Belarus");/* .bz */ case NDX2('b','z'): return _("Belize");/* .ca */ case NDX2('c','a'): return _("Canada");/* .cc */ case NDX2('c','c'): return _("Cocos (Keeling) Islands");/* .cf */ case NDX2('c','f'): return _("Central African Republic");/* .cg */ case NDX2('c','g'): return _("Congo");/* .ch */ case NDX2('c','h'): return _("Switzerland");/* .ci */ case NDX2('c','i'): return _("Ivory Coast");/* .ck */ case NDX2('c','k'): return _("Cook Islands");/* .cl */ case NDX2('c','l'): return _("Chile");/* .cm */ case NDX2('c','m'): return _("Cameroon");/* .cn */ case NDX2('c','n'): return _("China");/* .co */ case NDX2('c','o'): return _("Colombia");/* .com */ case NDX3('c','o','m'): return _("US Commerial");/* .cr */ case NDX2('c','r'): return _("Costa Rica");/* .cs */ case NDX2('c','s'): return _("Czechoslovakia (former)");/* .cu */ case NDX2('c','u'): return _("Cuba");/* .cv */ case NDX2('c','v'): return _("Cape Verde");/* .cx */ case NDX2('c','x'): return _("Christmas Island");/* .cy */ case NDX2('c','y'): return _("Cyprus");/* .cz */ case NDX2('c','z'): return _("Czech Republic");/* .edu */ case NDX3('e','d','u'): return _("US Educational");/* .de */ case NDX2('d','e'): return _("Germany");/* .dj */ case NDX2('d','j'): return _("Djibouti");/* .dk */ case NDX2('d','k'): return _("Denmark");/* .dm */ case NDX2('d','m'): return _("Dominica");/* .do */ case NDX2('d','o'): return _("Dominican Republic");/* .dz */ case NDX2('d','z'): return _("Algeria");/* .ec */ case NDX2('e','c'): return _("Ecuador");/* .ee */ case NDX2('e','e'): return _("Estonia");/* .eg */ case NDX2('e','g'): return _("Egypt");/* .eh */ case NDX2('e','h'): return _("Western Sahara");/* .er */ case NDX2('e','r'): return _("Eritrea");/* .es */ case NDX2('e','s'): return _("Spain");/* .et */ case NDX2('e','t'): return _("Ethiopia");/* .fi */ case NDX2('f','i'): return _("Finland");/* .fj */ case NDX2('f','j'): return _("Fiji");/* .fk */ case NDX2('f','k'): return _("Falkland Islands (Malvinas)");/* .fm */ case NDX2('f','m'): return _("Micronesia");/* .fo */ case NDX2('f','o'): return _("Faroe Islands");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -