From: Ricardo Cruz Date: Fri, 16 Jul 2004 19:15:00 +0000 (+0000) Subject: Read the first 5 chars, not the all string of LANG. X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=33aa334f96aaf0da41edab72ef8d20fa788220cf;p=supertux.git Read the first 5 chars, not the all string of LANG. SVN-Revision: 1580 --- diff --git a/src/lispreader.cpp b/src/lispreader.cpp index 58913e540..99e7925d9 100644 --- a/src/lispreader.cpp +++ b/src/lispreader.cpp @@ -1221,9 +1221,18 @@ LispReader::read_string (const char* name, std::string& str, bool translatable) char* lang = getenv("LANG"); char str_[1024]; // check, for instance, for (title-fr_FR "Bonjour") - sprintf(str_, "%s-%s", name, lang); - obj = search_for (str_); + if(lang != NULL && strlen(lang) >= 5) + { + char lang_[6]; + strncpy(lang_, lang, 5); + lang_[5] = '\0'; + sprintf(str_, "%s-%s", name, lang_); + + obj = search_for (str_); + } + else + obj = 0; if(!obj) // check, for instance, for (title-fr "Bonjour") {