diff options
| author | scarab <scarab@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e> | 2008-08-18 23:58:32 +0000 |
|---|---|---|
| committer | scarab <scarab@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e> | 2008-08-18 23:58:32 +0000 |
| commit | 3cfa5354f2a6b164f0e46ebde60af3b0d697fbcd (patch) | |
| tree | 74fdc662aa084bf64ecd73c650df6250e8ed284b /src | |
| parent | 9c71274e5c4cde5dd99a0eb927243f6c481df1f2 (diff) | |
- dokonceni gettext zakladni podpory
- je treba mozna jeste nekde uklidit zbytky po language
- testujte a sezente lidi co nam to prelozi, kdzytak projedete .pot soubor
a pokud najdete neco co by se melo jmenovat stejne nebo tak nejak tak opravit...
git-svn-id: http://opensvn.csie.org/tuxanci_ng@223 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e
Diffstat (limited to 'src')
| -rw-r--r-- | src/CMakeLists.txt | 3 | ||||
| -rw-r--r-- | src/base/path.h.in | 7 | ||||
| -rw-r--r-- | src/base/proto.c | 1 | ||||
| -rw-r--r-- | src/client/client.c | 1 | ||||
| -rw-r--r-- | src/client/game.c | 11 | ||||
| -rw-r--r-- | src/client/language.c | 210 | ||||
| -rw-r--r-- | src/client/language.h | 12 | ||||
| -rwxr-xr-x | src/modules/modMove.c | 3 | ||||
| -rwxr-xr-x | src/net/tcp.c | 1 | ||||
| -rw-r--r-- | src/screen/screen_browser.c | 1 | ||||
| -rw-r--r-- | src/screen/screen_choiceArena.c | 1 | ||||
| -rw-r--r-- | src/screen/screen_credits.c | 1 | ||||
| -rw-r--r-- | src/screen/screen_gameType.c | 1 | ||||
| -rw-r--r-- | src/screen/screen_mainMenu.c | 1 | ||||
| -rw-r--r-- | src/screen/screen_setting.c | 1 | ||||
| -rw-r--r-- | src/screen/screen_settingKeys.c | 1 | ||||
| -rw-r--r-- | src/screen/screen_table.c | 1 |
17 files changed, 5 insertions, 252 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a15fb35..c6f7e3f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -48,12 +48,11 @@ SET ( SRC_client ${WORKDIR}/client/layer ${WORKDIR}/client/term ${WORKDIR}/client/screen ${WORKDIR}/client/interface ${WORKDIR}/client/client ${WORKDIR}/client/chat - ${WORKDIR}/client/configFile ${WORKDIR}/client/language + ${WORKDIR}/client/configFile ${WORKDIR}/client/saveLoad ${WORKDIR}/client/font ${WORKDIR}/client/game ${WORKDIR}/client/radar ${WORKDIR}/client/panel ${WORKDIR}/client/image ${WORKDIR}/client/keyboardBuffer ${WORKDIR}/client/pauza ${WORKDIR}/client/saveDialog - ${WORKDIR}/client/saveLoad ${WORKDIR}/screen/screen_choiceArena ${WORKDIR}/screen/screen_settingKeys ${WORKDIR}/screen/screen_table diff --git a/src/base/path.h.in b/src/base/path.h.in index 5333ae8..cf4e47d 100644 --- a/src/base/path.h.in +++ b/src/base/path.h.in @@ -22,9 +22,8 @@ #define PATH_ARENA PATH_DIR "arena/" #define PATH_SOUND PATH_DIR "sound/" #define PATH_MUSIC PATH_DIR "music/" - #define PATH_CONFIG PATH_DIR "conf/" - #define PATH_LANG PATH_DIR "lang/" - #define PATH_DOC "@CMAKE_DOC_PATH@" "doc/" APPNAME "-" "@TUXANCI_VERSION@" "/" - #define PATH_LOCALE PREFIX "share/locale/" + #define PATH_LOCALE "@CMAKE_LOCALE_PATH@" "/" + #define PATH_DOC "@CMAKE_DOC_PATH@" "/" APPNAME "-" "@TUXANCI_VERSION@" "/" + #define GETTEXT_PACKAGE "@GETTEXT_PACKAGE@" #include "main.h" #endif diff --git a/src/base/proto.c b/src/base/proto.c index 646b550..e833225 100644 --- a/src/base/proto.c +++ b/src/base/proto.c @@ -21,7 +21,6 @@ #include "serverSendMsg.h" #ifndef PUBLIC_SERVER -#include "language.h" #include "screen_world.h" #include "screen_setting.h" #include "screen_choiceArena.h" diff --git a/src/client/client.c b/src/client/client.c index edffc54..4637d01 100644 --- a/src/client/client.c +++ b/src/client/client.c @@ -22,7 +22,6 @@ #include "proto.h" #include "client.h" -#include "language.h" #include "screen_analyze.h" #include "screen_world.h" diff --git a/src/client/game.c b/src/client/game.c index 1c2688f..66e179c 100644 --- a/src/client/game.c +++ b/src/client/game.c @@ -21,7 +21,6 @@ #include "screen.h" #include "font.h" #include "screen_settingKeys.h" -#include "language.h" #include "panel.h" #include "radar.h" @@ -46,18 +45,9 @@ static void initGame() { createHomeDirector(); - if( initLanguage() == -1 ) - { -#ifdef DEBUG - printf(_("I was unable to initialize old nls system (if you see this something wierd is happening)!\n")); -#endif - exit(-1); - } - initSDL(); initLayer(); - initFont(getLanguageFont(), getLanguageSize()); initImageData(); #ifndef NO_SOUND initAudio(); @@ -99,7 +89,6 @@ void quitGame() quitLayer(); quitFont(); - quitLanguage(); quitScreen(); quitArenaFile(); quitItem(); diff --git a/src/client/language.c b/src/client/language.c deleted file mode 100644 index eb915ed..0000000 --- a/src/client/language.c +++ /dev/null @@ -1,210 +0,0 @@ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <assert.h> -#include <sys/stat.h> - -#include "main.h" -#include "list.h" -#include "homeDirector.h" -#include "textFile.h" - -#include "configFile.h" -#include "language.h" -#include "director.h" - -static textFile_t *languageFile; -static char fontFile[STR_FILE_NAME_SIZE]; -static int fontSize; - -static char* getHead(textFile_t *ts) -{ - int i; - - for( i = 0 ; i < ts->text->count ; i++ ) - { - char *line; - line = (char *) (ts->text->list[i]); - - if( strncmp(line, "HEAD", 4) == 0 ) - { - return line; - } - } - - return NULL; -} - -static char* getSupportLanguage() -{ - director_t *director; - char *envLang; - char lang[STR_SIZE]; - int i; - - printf("I search language..\n"); - - envLang = getenv("LANG"); - - if( envLang == NULL ) - { - printf("Environment LANG not defined, I use default value \"en\"\n"); - return strdup("en"); - } - - memset(lang, 0, STR_SIZE); - strncpy(lang, envLang, 2); - - director = loadDirector(PATH_LANG); - - if( director == NULL ) - { - fprintf(stderr, "Do not open director %s\n", PATH_LANG); - return strdup("en"); - } - - for( i = 0 ; i < director->list->count ; i++ ) - { - char *line; - - line = (char *)director->list->list[i]; - - if( strncmp(lang, line, 2) == 0 ) - { - printf("I choice lang %s in file %s\n", lang, line); - return strdup(lang); - } - } - - destroyDirector(director); - - printf("Lang %s not support, I use default language english\n", lang); - - return strdup("en"); -} - -int initLanguage() -{ - textFile_t *languageTypeFile; - char path[STR_PATH_SIZE]; - char *lang; - char *head; - - sprintf(path, "%s/lang.conf", getHomeDirector()); - printf("open %s\n", path); - languageTypeFile = loadTextFile(path); - - if( languageTypeFile == NULL ) - { - char *defaultLang; - - fprintf(stderr, "Don't load %s\n", path); - fprintf(stderr, "I create %s\n", path); - - languageTypeFile = newTextFile(path); - defaultLang = getSupportLanguage(); - addList(languageTypeFile->text, strdup(defaultLang) ); - saveTextFile(languageTypeFile); - free(defaultLang); - } - - if( languageTypeFile == NULL ) - { - fprintf(stderr, "Don't create %s\n", path); - return -1; - } - - if( languageTypeFile->text->count == 0 ) - { - fprintf(stderr, "File %s empty\n", path); - return -1; - } - - lang = ((char *)languageTypeFile->text->list[0]); - printf("select lang %s\n", lang); - - sprintf(path, PATH_LANG "%s.lang", lang); - - destroyTextFile(languageTypeFile); - - accessExistFile(path); - languageFile = loadTextFile(path); - - if( languageFile == NULL ) - { - fprintf(stderr, "Don't load %s\n", path); - return -1; - } - - head = getHead(languageFile); - - if( head != NULL ) - { - char val[STR_SIZE]; - - if( getValue(head, "fontfile", val, STR_SIZE) == 0 ) - { - strcpy(fontFile, val); - } - else - { - fprintf(stderr, "fontfile in lang file %s not found\n", path); - return -1; - } - - if( getValue(head, "fontsize", val, STR_SIZE) == 0 ) - { - fontSize = atoi(val); - } - else - { - fprintf(stderr, "fontsize in lang file %s not found\n", path); - return -1; - } - } - else - { - fprintf(stderr, "head in lang file %s not found\n", path); - return -1; - } - - return 0; -} - -char* getMyText(char *key) -{ - int i; - int len; - - len = strlen(key); - - for( i = 0 ; i < languageFile->text->count ; i++ ) - { - char *line; - line = (char *) (languageFile->text->list[i]); - - if( strncmp(key, line, len) == 0 ) - { - return line+strlen(key)+1; - } - } - - return NULL; -} - -char* getLanguageFont() -{ - return fontFile; -} - -int getLanguageSize() -{ - return fontSize; -} - -void quitLanguage() -{ - destroyTextFile(languageFile); -} - diff --git a/src/client/language.h b/src/client/language.h deleted file mode 100644 index 23fc1a4..0000000 --- a/src/client/language.h +++ /dev/null @@ -1,12 +0,0 @@ - -#ifndef LANGUAGE_H - -#define LANGUAGE_H - -extern int initLanguage(); -extern char* getMyText(char *key); -extern char* getLanguageFont(); -extern int getLanguageSize(); -extern void quitLanguage(); - -#endif diff --git a/src/modules/modMove.c b/src/modules/modMove.c index d1c626c..69af165 100755 --- a/src/modules/modMove.c +++ b/src/modules/modMove.c @@ -22,7 +22,6 @@ #include "publicServer.h" #endif - static export_fce_t *export_fce; static void move_tux(tux_t *tux, int x, int y, int w, int h) @@ -59,7 +58,7 @@ static void move_tux(tux_t *tux, int x, int y, int w, int h) break; default : - assert( ! _("Variable p->control has a really wierd value!") ); + assert( ! "Variable p->control has a really wierd value!" ); break; } diff --git a/src/net/tcp.c b/src/net/tcp.c index d623d86..0d5d03c 100755 --- a/src/net/tcp.c +++ b/src/net/tcp.c @@ -19,7 +19,6 @@ #include <netinet/tcp.h> #include <fcntl.h> -#include "main.h" #include "tcp.h" sock_tcp_t* newSockTcp(int proto) diff --git a/src/screen/screen_browser.c b/src/screen/screen_browser.c index fe23d09..9d82ffe 100644 --- a/src/screen/screen_browser.c +++ b/src/screen/screen_browser.c @@ -9,7 +9,6 @@ #include "homeDirector.h" #include "net_multiplayer.h" -#include "language.h" #include "interface.h" #include "screen.h" #include "image.h" diff --git a/src/screen/screen_choiceArena.c b/src/screen/screen_choiceArena.c index 1adb04d..6d10649 100644 --- a/src/screen/screen_choiceArena.c +++ b/src/screen/screen_choiceArena.c @@ -6,7 +6,6 @@ #include "list.h" #include "arenaFile.h" -#include "language.h" #include "interface.h" #include "screen.h" #include "image.h" diff --git a/src/screen/screen_credits.c b/src/screen/screen_credits.c index 27ba838..d2fcee2 100644 --- a/src/screen/screen_credits.c +++ b/src/screen/screen_credits.c @@ -6,7 +6,6 @@ #include "list.h" #include "textFile.h" -#include "language.h" #include "interface.h" #include "screen.h" #include "image.h" diff --git a/src/screen/screen_gameType.c b/src/screen/screen_gameType.c index 71420d8..ae2e350 100644 --- a/src/screen/screen_gameType.c +++ b/src/screen/screen_gameType.c @@ -10,7 +10,6 @@ #include "net_multiplayer.h" #include "tux.h" -#include "language.h" #include "interface.h" #include "screen.h" #include "image.h" diff --git a/src/screen/screen_mainMenu.c b/src/screen/screen_mainMenu.c index e5cae8f..46cfb5e 100644 --- a/src/screen/screen_mainMenu.c +++ b/src/screen/screen_mainMenu.c @@ -6,7 +6,6 @@ #include "game.h" #include "interface.h" -#include "language.h" #include "screen.h" #include "image.h" diff --git a/src/screen/screen_setting.c b/src/screen/screen_setting.c index 46ea84a..452164d 100644 --- a/src/screen/screen_setting.c +++ b/src/screen/screen_setting.c @@ -12,7 +12,6 @@ #include "arenaFile.h" #include "configFile.h" -#include "language.h" #include "interface.h" #include "screen.h" #include "image.h" diff --git a/src/screen/screen_settingKeys.c b/src/screen/screen_settingKeys.c index 970c38d..d40db6d 100644 --- a/src/screen/screen_settingKeys.c +++ b/src/screen/screen_settingKeys.c @@ -10,7 +10,6 @@ #include "director.h"
#include "homeDirector.h"
#include "configFile.h"
-#include "language.h"
#include "interface.h"
#include "screen.h"
#include "image.h"
diff --git a/src/screen/screen_table.c b/src/screen/screen_table.c index fa8e738..f4c981c 100644 --- a/src/screen/screen_table.c +++ b/src/screen/screen_table.c @@ -8,7 +8,6 @@ #include "textFile.h" #include "homeDirector.h" -#include "language.h" #include "interface.h" #include "screen.h" #include "image.h" |