summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorglx22 <glx@openttd.org>2021-02-02 18:26:24 +0100
committerLoïc Guilloux <glx22@users.noreply.github.com>2021-02-15 00:08:37 +0100
commit45e8b7a5bd6f2bbfbda8688911ae20d4186298f4 (patch)
treeff929f483715bd9bf4102f97a9ef1b74d9fc9308 /src
parentce06b03faca3aca77efb28c799f2c575cb96211a (diff)
downloadopenttd-45e8b7a5bd6f2bbfbda8688911ae20d4186298f4.tar.xz
Add: Allow translation of "(Directory)" and "(Parent directory)"
Diffstat (limited to 'src')
-rw-r--r--src/fios.cpp8
-rw-r--r--src/lang/english.txt2
2 files changed, 8 insertions, 2 deletions
diff --git a/src/fios.cpp b/src/fios.cpp
index 4586f86b3..b48bc2108 100644
--- a/src/fios.cpp
+++ b/src/fios.cpp
@@ -17,6 +17,7 @@
#include "network/network_content.h"
#include "screenshot.h"
#include "string_func.h"
+#include "strings_func.h"
#include "tar_type.h"
#include <sys/stat.h>
#include <functional>
@@ -376,7 +377,8 @@ static void FiosGetFileList(SaveLoadOperation fop, fios_getlist_callback_proc *c
fios->type = FIOS_TYPE_PARENT;
fios->mtime = 0;
strecpy(fios->name, "..", lastof(fios->name));
- strecpy(fios->title, ".. (Parent directory)", lastof(fios->title));
+ SetDParamStr(0, "..");
+ GetString(fios->title, STR_SAVELOAD_PARENT_DIRECTORY, lastof(fios->title));
}
/* Show subdirectories */
@@ -392,7 +394,9 @@ static void FiosGetFileList(SaveLoadOperation fop, fios_getlist_callback_proc *c
fios->type = FIOS_TYPE_DIR;
fios->mtime = 0;
strecpy(fios->name, d_name, lastof(fios->name));
- seprintf(fios->title, lastof(fios->title), "%s" PATHSEP " (Directory)", d_name);
+ std::string dirname = std::string(d_name) + PATHSEP;
+ SetDParamStr(0, dirname.c_str());
+ GetString(fios->title, STR_SAVELOAD_DIRECTORY, lastof(fios->title));
str_validate(fios->title, lastof(fios->title));
}
}
diff --git a/src/lang/english.txt b/src/lang/english.txt
index bf188651c..b6a368830 100644
--- a/src/lang/english.txt
+++ b/src/lang/english.txt
@@ -2847,6 +2847,8 @@ STR_SAVELOAD_DETAIL_GRFSTATUS :{SILVER}NewGRF:
STR_SAVELOAD_FILTER_TITLE :{BLACK}Filter string:
STR_SAVELOAD_OVERWRITE_TITLE :{WHITE}Overwrite File
STR_SAVELOAD_OVERWRITE_WARNING :{YELLOW}Are you sure you want to overwrite the existing file?
+STR_SAVELOAD_DIRECTORY :{RAW_STRING} (Directory)
+STR_SAVELOAD_PARENT_DIRECTORY :{RAW_STRING} (Parent directory)
STR_SAVELOAD_OSKTITLE :{BLACK}Enter a name for the savegame