From d6bf0d10d0a1709fa34c86ab4d3d0df8431ceda8 Mon Sep 17 00:00:00 2001 From: yexo Date: Thu, 10 Nov 2011 18:07:56 +0000 Subject: [PATCH] (svn r23182) -Feature: allow translatable readme files --- src/newgrf_config.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/newgrf_config.cpp b/src/newgrf_config.cpp index 46dda4abeb..b25e669be3 100644 --- a/src/newgrf_config.cpp +++ b/src/newgrf_config.cpp @@ -19,6 +19,7 @@ #include "window_func.h" #include "progress.h" #include "video/video_driver.hpp" +#include "strings_func.h" #include "fileio_func.h" #include "fios.h" @@ -846,6 +847,12 @@ const char *GRFConfig::GetReadme() const char *slash = strrchr(readme_path, PATHSEPCHAR); if (slash == NULL) return NULL; + seprintf(slash + 1, lastof(readme_path), "readme_%s.txt", GetCurrentLanguageIsoCode()); + if (FioCheckFileExists(readme_path, NEWGRF_DIR)) return readme_path; + + seprintf(slash + 1, lastof(readme_path), "readme_%.2s.txt", GetCurrentLanguageIsoCode()); + if (FioCheckFileExists(readme_path, NEWGRF_DIR)) return readme_path; + strecpy(slash + 1, "readme.txt", lastof(readme_path)); return FioCheckFileExists(readme_path, NEWGRF_DIR) ? readme_path : NULL; }