We only need to use strtok here.
This commit is contained in:
parent
7633322d1e
commit
5b6dfecebb
|
@ -41,7 +41,6 @@ extern long lookup(const char *name);
|
|||
extern float mod(float n, float x);
|
||||
extern void playSound(int snd, int ch);
|
||||
extern char *readFile(const char *filename);
|
||||
extern void saveScreenshot(char *name);
|
||||
extern void textSize(char *text, int size, int *w, int *h);
|
||||
extern char *timeToDate(long millis);
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ void setLanguage(char *applicationName, char *languageCode)
|
|||
{
|
||||
char language[MAX_LINE_LENGTH], c[MAX_LINE_LENGTH];
|
||||
char *lang, **key, **value;
|
||||
int i, swap, length;
|
||||
int i, swap;
|
||||
FILE *fp;
|
||||
MOHeader header;
|
||||
MOEntry *original, *translation;
|
||||
|
@ -74,17 +74,8 @@ void setLanguage(char *applicationName, char *languageCode)
|
|||
{
|
||||
STRNCPY(language, languageCode, MAX_LINE_LENGTH);
|
||||
}
|
||||
|
||||
length = strlen(language);
|
||||
|
||||
for (i=0 ; i < length ; i++)
|
||||
{
|
||||
if (language[i] == '.')
|
||||
{
|
||||
language[i] = '\0';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
strtok(language, ".");
|
||||
|
||||
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, "Locale is %s", language);
|
||||
|
||||
|
@ -106,18 +97,10 @@ void setLanguage(char *applicationName, char *languageCode)
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
length = strlen(language);
|
||||
|
||||
for (i=0;i<length;i++)
|
||||
{
|
||||
if (language[i] == '_')
|
||||
{
|
||||
language[i] = '\0';
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
strtok(language, "_");
|
||||
|
||||
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, "Language is %s", language);
|
||||
|
||||
sprintf(c, "%s/%s/LC_MESSAGES/%s.mo", LOCALE_DIR, language, applicationName);
|
||||
|
||||
|
|
Loading…
Reference in New Issue