From 49c3fc064a759b0a71fe1a65f24db2c2149c9261 Mon Sep 17 00:00:00 2001 From: James Turner Date: Sat, 13 Oct 2018 21:22:18 +0100 Subject: [PATCH] XLIFF: Fix loading of indexed strings --- src/Main/XLIFFParser.cxx | 4 +++- src/Main/locale.cxx | 3 +-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Main/XLIFFParser.cxx b/src/Main/XLIFFParser.cxx index c16d409fa..a11902346 100644 --- a/src/Main/XLIFFParser.cxx +++ b/src/Main/XLIFFParser.cxx @@ -21,6 +21,7 @@ #include "XLIFFParser.hxx" #include +#include // simgear #include @@ -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) diff --git a/src/Main/locale.cxx b/src/Main/locale.cxx index e25ac9193..2b2edbb3f 100644 --- a/src/Main/locale.cxx +++ b/src/Main/locale.cxx @@ -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); }