1
0
Fork 0

XLIFF: Fix loading of indexed strings

This commit is contained in:
James Turner 2018-10-13 21:22:18 +01:00
parent 2313f482a3
commit 49c3fc064a
2 changed files with 4 additions and 3 deletions

View file

@ -21,6 +21,7 @@
#include "XLIFFParser.hxx"
#include <cstring>
#include <string>
// simgear
#include <simgear/debug/logstream.hxx>
@ -121,7 +122,8 @@ void XLIFFParser::finishTransUnit()
}
const auto id = _unitId.substr(slashPos + 1, indexPos - (slashPos + 1));
_resourceNode->setStringValue(id, _target);
const int index = std::stoi(_unitId.substr(indexPos+1));
_resourceNode->getNode(id, index, true)->setStringValue(_target);
}
void XLIFFParser::data (const char * s, int len)

View file

@ -320,8 +320,7 @@ FGLocale::loadResource(const char* resource)
bool Ok = loadResource(_defaultLocale, resource);
// also load language specific resource, unless identical
if ((_currentLocale!=0)&&
(_defaultLocale != _currentLocale))
if ((_currentLocale != nullptr) && (_defaultLocale != _currentLocale))
{
Ok &= loadResource(_currentLocale, resource);
}