diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Main/LanguageStrings.cpp | 2 | ||||
-rw-r--r-- | src/Main/StringFormatter.cpp | 13 |
2 files changed, 12 insertions, 3 deletions
diff --git a/src/Main/LanguageStrings.cpp b/src/Main/LanguageStrings.cpp index 3591255b..33aaf6a9 100644 --- a/src/Main/LanguageStrings.cpp +++ b/src/Main/LanguageStrings.cpp @@ -50,17 +50,15 @@ namespace VeraCrypt foreach (XmlNode node, XmlParser (def).GetNodes (L"entry")) { wxString text = node.InnerText; text.Replace (L"\\n", L"\n"); - text.Replace (L"%s", L"{0}"); Map[StringConverter::ToSingle (wstring (node.Attributes[L"key"]))] = text; } #endif foreach (XmlNode node, XmlParser (Resources::GetLanguageXml()).GetNodes (L"entry")) { wxString text = node.InnerText; text.Replace (L"\\n", L"\n"); - text.Replace (L"%s", L"{0}"); Map[StringConverter::ToSingle (wstring (node.Attributes[L"key"]))] = text; } } diff --git a/src/Main/StringFormatter.cpp b/src/Main/StringFormatter.cpp index 4f8c2cc6..e64f85c3 100644 --- a/src/Main/StringFormatter.cpp +++ b/src/Main/StringFormatter.cpp @@ -19,9 +19,20 @@ namespace VeraCrypt StringFormatter::StringFormatter (const wxString &format, StringFormatterArg arg0, StringFormatterArg arg1, StringFormatterArg arg2, StringFormatterArg arg3, StringFormatterArg arg4, StringFormatterArg arg5, StringFormatterArg arg6, StringFormatterArg arg7, StringFormatterArg arg8, StringFormatterArg arg9) { bool numberExpected = false; bool endTagExpected = false; - foreach (wchar_t c, wstring (format)) + + //TODO replace this workaround for %s, %d, %c for printf + wxString text(format); + text.Replace (L"%s", L"{}",true); + text.Replace (L"%d", L"{}",true); + text.Replace (L"%c", L"{}",true); + int i=0; + while (text.find(L"{}") != (size_t) wxNOT_FOUND){ + text.Replace(L"{}",L"{"+wxString::Format(wxT("%i"),i++)+L"}",false); + } + + foreach (wchar_t c, wstring (text)) { if (numberExpected) { endTagExpected = true; |