summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2011-11-10 18:07:56 +0000
committeryexo <yexo@openttd.org>2011-11-10 18:07:56 +0000
commitd6bf0d10d0a1709fa34c86ab4d3d0df8431ceda8 (patch)
tree31ca5e1f030481a8f420714732143738c65662bd
parent7ec374e5f65ed1849998556143e7370932664fce (diff)
downloadopenttd-d6bf0d10d0a1709fa34c86ab4d3d0df8431ceda8.tar.xz
(svn r23182) -Feature: allow translatable readme files
-rw-r--r--src/newgrf_config.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/newgrf_config.cpp b/src/newgrf_config.cpp
index 46dda4abe..b25e669be 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;
}