Bug fix for allowing language to be specified.

This commit is contained in:
Steve 2018-05-06 12:27:37 +01:00
parent 856311dd53
commit 4f498fba98
4 changed files with 10 additions and 3 deletions

View File

@ -28,5 +28,6 @@ extern int isMissionAvailable(Mission *mission, Mission *prev);
extern char **getFileList(char *dir, int *count);
extern Mission *loadMissionMeta(char *filename);
extern int getJSONValue(cJSON *node, char *name, int defValue);
extern char *getTranslatedString(char *string);
extern Game game;

View File

@ -240,9 +240,9 @@ static void handleMissionArgs(int argc, char *argv[])
for (i = 1 ; i < argc ; i++)
{
/* assume this is filename for testing */
if (argv[i][0] != '-')
if (strcmp(argv[i], "-mission") == 0)
{
loadTestMission(argv[i]);
loadTestMission(argv[++i]);
testingMission = 1;
}

View File

@ -75,8 +75,13 @@ void setLanguage(char *applicationName, char *languageCode)
strtok(language, ".");
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, "Locale is %s", language);
sprintf(c, "locale/%s.mo", language);
sprintf(c, "%s/%s/LC_MESSAGES/%s.mo", LOCALE_DIR, language, applicationName);
if (!fileExists(c))
{
sprintf(c, "%s/%s/LC_MESSAGES/%s.mo", LOCALE_DIR, language, applicationName);
}
#if DEV == 1
printf("Opening %s\n", c);

View File

@ -28,3 +28,4 @@ Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
char *getTranslatedString(char *);
void setLanguage(char *, char *);
void cleanupLanguage(void);
extern int fileExists(char *filename);