Don't map language code "und"

The library uses empty strings if there's no value
and the ISO language code mapping should not make and
exception.
This commit is contained in:
Martchus 2021-01-20 22:19:43 +01:00
parent abd4fbb868
commit 2d67ddeeea
1 changed files with 4 additions and 1 deletions

View File

@ -30,10 +30,13 @@ inline static bool isLanguageDefined_ISO_639_2(const std::string &languageSpecif
*/
static const std::string &languageName_ISO_639_2(const std::string &isoCode)
{
static const std::string empty;
if (!isLanguageDefined_ISO_639_2(isoCode)) {
return empty;
}
const auto &mapping = languageNames_ISO_639_2_b();
const auto i = mapping.find(isoCode);
if (i == mapping.cend()) {
static const std::string empty;
return empty;
}
return i->second;