summaryrefslogtreecommitdiff
path: root/library/misc.cpp
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2014-04-18 16:53:07 +0200
committerDaniel Wilhelm <daniel@wili.li>2014-04-18 16:53:07 +0200
commit583d6a1fd6701e3d42c87285265b0b4f7657ab7c (patch)
tree78461dd1a74685252eef77b8e7d3b622d1be67ea /library/misc.cpp
parent1.9 (diff)
downloadFreeFileSync-583d6a1fd6701e3d42c87285265b0b4f7657ab7c.tar.gz
FreeFileSync-583d6a1fd6701e3d42c87285265b0b4f7657ab7c.tar.bz2
FreeFileSync-583d6a1fd6701e3d42c87285265b0b4f7657ab7c.zip
1.10
Diffstat (limited to 'library/misc.cpp')
-rw-r--r--library/misc.cpp54
1 files changed, 47 insertions, 7 deletions
diff --git a/library/misc.cpp b/library/misc.cpp
index 71bbe608..5fbeb655 100644
--- a/library/misc.cpp
+++ b/library/misc.cpp
@@ -4,15 +4,52 @@
#include "resources.h"
#include "globalFunctions.h"
+
const string CustomLocale::FfsLanguageDat = "language.dat";
+
void exchangeEscapeChars(wxString& data)
{
- data.Replace(wxT("\\\\"), wxT("\\"));
- data.Replace(wxT("\\n"), wxT("\n"));
- data.Replace(wxT("\\t"), wxT("\t"));
- data.Replace(wxT("\"\""), wxT(""""));
- data.Replace(wxT("\\\""), wxT("\""));
+ wxString output;
+
+ const wxChar* input = data.c_str();
+
+ wxChar value;
+ while ((value = *input) != wxChar(0))
+ {
+ //read backslash
+ if (value == wxChar('\\'))
+ {
+ //read next character
+ ++input;
+ value = *input;
+ if (value == wxChar(0))
+ break;
+
+ switch (value)
+ {
+ case wxChar('\\'):
+ output+= wxChar('\\');
+ break;
+ case wxChar('n'):
+ output+= wxChar('\n');
+ break;
+ case wxChar('t'):
+ output+= wxChar('\t');
+ break;
+ case wxChar('\"'):
+ output+= wxChar('\"');
+ break;
+ default:
+ output+= value;
+ }
+ }
+ else
+ output+= value;
+
+ ++input;
+ }
+ data = output;
}
@@ -69,8 +106,11 @@ void CustomLocale::loadLanguageFile(int language)
case wxLANGUAGE_FRENCH:
languageFile = "french.lng";
break;
+ case wxLANGUAGE_JAPANESE:
+ languageFile = "japanese.lng";
+ break;
default:
- languageFile = string();
+ languageFile.clear();
currentLanguage = wxLANGUAGE_ENGLISH;
}
@@ -91,7 +131,7 @@ void CustomLocale::loadLanguageFile(int language)
//Linux: 0xa \n
//Mac: 0xd \r
//Win: 0xd 0xa \r\n <- language files are in Windows format
- while (langFile.getline(temp, bufferSize, 0xd)) //specify delimiter explicitely
+ while (langFile.getline(temp, bufferSize, 0xd)) //specify delimiter explicitly
{
langFile.get(); //discard the 0xa character
bgstack15