Actually I just fixed that yesterday… Here’s my code, in case it helps:
[code]static const String unescapeString (const String& s)
{
return s.replace (T("\""), T("""))
.replace (T("\’"), T("’"))
.replace (T("\t"), T("\t"))
.replace (T("\r"), T("\r"))
.replace (T("\n"), T("\n"));
}
void LocalisedStrings::loadFromText (const String& fileContents)
{
StringArray lines;
lines.addLines (fileContents);
for (int i = 0; i < lines.size(); ++i)
{
String line (lines[i].trim());
if (line.startsWithChar (T('"')))
{
int closeQuote = findCloseQuote (line, 1);
const String originalText (unescapeString (line.substring (1, closeQuote)));
if (originalText.isNotEmpty())
{
const int openingQuote = findCloseQuote (line, closeQuote + 1);
closeQuote = findCloseQuote (line, openingQuote + 1);
const String newText (unescapeString (line.substring (openingQuote + 1, closeQuote)));
if (newText.isNotEmpty())
translations.set (originalText, newText);
}
}
else if (line.startsWithIgnoreCase (T("language:")))
{
languageName = line.substring (9).trim();
}
else if (line.startsWithIgnoreCase (T("countries:")))
{
countryCodes.addTokens (line.substring (10).trim(), true);
countryCodes.trim();
countryCodes.removeEmptyStrings();
}
}
}
[/code]