# HG changeset patch # User mikael # Date 1114711018 0 # Node ID ef898db62b798f048b169243cda09803c9f878f1 # Parent e19ad58c3cadd06bfebfc8527cf476ba222ad164 [/trunk] Changeset 148 by mikael * Get rid of lang. Maybe we'll use gettext later... (?) diff -r e19ad58c3cad -r ef898db62b79 mcabber/src/Makefile.am --- a/mcabber/src/Makefile.am Thu Apr 28 17:39:57 2005 +0000 +++ b/mcabber/src/Makefile.am Thu Apr 28 17:56:58 2005 +0000 @@ -4,7 +4,7 @@ hbuf.c hbuf.h screen.c screen.h \ parsecfg.c parsecfg.h utf8.c utf8.h \ hooks.c hooks.h histolog.c histolog.h \ - utils.c utils.h lang.c lang.h list.h harddefines.h + utils.c utils.h list.h harddefines.h LDADD = -lglib-2.0 -lncurses -lpanel -lssl \ ../libjabber/liblibjabber.a ../connwrap/libconnwrap.a diff -r e19ad58c3cad -r ef898db62b79 mcabber/src/lang.c --- a/mcabber/src/lang.c Thu Apr 28 17:39:57 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +0,0 @@ -#include -#include -#include -#include -#include - -#include "utils.h" - -char Lang[100]; - -void lng_InitLanguage(void) -{ - FILE *fp; - memset(Lang, 0, 100); - sprintf(Lang, "./lang/%s.txt", getenv("LANG")); -/* strcpy(Lang, "./lang/"); - strcat(Lang, getenv("LANG")); - strcat(Lang, ".txt"); -*/ - if ((fp = fopen(Lang, "r")) == NULL) { - /* reverting to default */ - ut_WriteLog("Reverting language to default: POSIX\n"); - strcpy(Lang, "./lang/POSIX.txt"); - } else { - fclose(fp); - ut_WriteLog("Setting language to %s\n", getenv("LANG")); - } -} - -char *i18n(char *text) -{ - /* hack */ - char *buf = (char *) malloc(1024); - static char result[1024]; - FILE *fp; - char *line; - char *value; - int found = 0; - - memset(result, 0, 1024); - - if ((fp = fopen(Lang, "r")) != NULL) { - while ((fgets(buf, 1024, fp) != NULL) && (!found)) { - line = buf; - - while (isspace((int) *line)) - line++; - - while ((strlen(line) > 0) - && isspace((int) line[strlen(line) - 1])) - line[strlen(line) - 1] = '\0'; - - if ((*line == '\n') || (*line == '\0') || (*line == '#')) - continue; - - if ((strchr(line, '=') != NULL)) { - value = strchr(line, '='); - *value = '\0'; - value++; - - while (isspace((int) *value)) - value++; - - while ((strlen(line) > 0) - && isspace((int) line[strlen(line) - 1])) - line[strlen(line) - 1] = '\0'; - - if (!strcasecmp(line, text)) { - strcpy(result, value); - found = 1; - } - continue; - } - /* fprintf(stderr, "CFG: orphaned line \"%s\"\n", line); */ - } - fclose(fp); - } - - if (!found) { - strcpy(result, text); - } - - free(buf); - return result; -} diff -r e19ad58c3cad -r ef898db62b79 mcabber/src/lang.h --- a/mcabber/src/lang.h Thu Apr 28 17:39:57 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ -#ifndef __LANG_H__ -#define __LANG_H__ 1 - -void lng_InitLanguage(void); -char *i18n(char *text); - -#endif diff -r e19ad58c3cad -r ef898db62b79 mcabber/src/lang/POSIX.txt --- a/mcabber/src/lang/POSIX.txt Thu Apr 28 17:39:57 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -######################### -# text for help message # -######################### -#note the same lenght of lines, sorry! - -add contact = Add contact............ -delete contact = Delete contact......... -view buddy window = Show buddy Window...... -send message = Send Message........... -######################### - -exit = Exit -help = Help -Press any key = Press any key... -roster = Contacts -status window = Status Window -write your message here = Write your message here -write jid here = Write jid here - -conected = connected -disconnected = disconnected diff -r e19ad58c3cad -r ef898db62b79 mcabber/src/lang/es_ES.txt --- a/mcabber/src/lang/es_ES.txt Thu Apr 28 17:39:57 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -######################### -# text for help message # -######################### -#note the same lenght of lines, sorry! - -add contact = Añadir contacto........ -delete contact = Borrar contacto........ -view buddy window = Ver ventana contacto... -send message = Enviar mensaje......... -######################### - -exit = Salir -help = Ayuda -Press any key = Pulsa una tecla -roster = Contactos -status window = Ventana de estado -write your message here = Escriba aquí su mensaje! -write jid here = Escriba aquí el jid que desea añadir? - -connected = conectado -disconnected = desconectado diff -r e19ad58c3cad -r ef898db62b79 mcabber/src/main.c --- a/mcabber/src/main.c Thu Apr 28 17:39:57 2005 +0000 +++ b/mcabber/src/main.c Thu Apr 28 17:56:58 2005 +0000 @@ -12,7 +12,6 @@ #include "roster.h" #include "commands.h" #include "histolog.h" -#include "lang.h" #include "utils.h" #include "harddefines.h" @@ -87,8 +86,6 @@ /* SET THIS >0 TO ENABLE LOG */ ut_InitDebug(1); - lng_InitLanguage(); - ut_WriteLog("Setting signals handlers...\n"); signal(SIGTERM, sig_handler); signal(SIGALRM, sig_handler); diff -r e19ad58c3cad -r ef898db62b79 mcabber/src/screen.c --- a/mcabber/src/screen.c Thu Apr 28 17:39:57 2005 +0000 +++ b/mcabber/src/screen.c Thu Apr 28 17:56:58 2005 +0000 @@ -13,7 +13,6 @@ #include "compl.h" #include "roster.h" #include "parsecfg.h" -#include "lang.h" #include "utils.h" #include "list.h"