forked from organicmaps/organicmaps
When the language of the user is equal to one of the languages of the MWM only single name scheme is used.
This commit is contained in:
parent
202412a7ae
commit
315897aa9c
2 changed files with 26 additions and 0 deletions
|
@ -231,6 +231,11 @@ void GetPreferredNames(RegionData const & regionData, StringUtf8Multilang const
|
|||
if (src.IsEmpty())
|
||||
return;
|
||||
|
||||
// When the language of the user is equal to one of the languages of the MWM
|
||||
// only single name scheme is used.
|
||||
if (regionData.HasLanguage(deviceLang))
|
||||
return GetReadableName(regionData, src, deviceLang, allowTranslit, primary);
|
||||
|
||||
vector<int8_t> const primaryCodes = {deviceLang,
|
||||
StrUtf8::kInternationalCode,
|
||||
StrUtf8::kEnglishCode};
|
||||
|
|
|
@ -169,6 +169,27 @@ UNIT_TEST(GetPrefferedNames)
|
|||
}
|
||||
}
|
||||
|
||||
UNIT_TEST(GetPrefferedNamesLocal)
|
||||
{
|
||||
feature::RegionData regionData;
|
||||
regionData.SetLanguages({"kk", "ru"});
|
||||
|
||||
int8_t deviceLang = StrUtf8::GetLangIndex("ru");
|
||||
string primary, secondary;
|
||||
bool const allowTranslit = true;
|
||||
|
||||
{
|
||||
StrUtf8 src;
|
||||
src.AddString("default", "default name");
|
||||
src.AddString("en", "en name");
|
||||
|
||||
feature::GetPreferredNames(regionData, src, deviceLang, allowTranslit, primary, secondary);
|
||||
|
||||
TEST_EQUAL(primary, "default name", ());
|
||||
TEST_EQUAL(secondary, "", ());
|
||||
}
|
||||
}
|
||||
|
||||
UNIT_TEST(GetReadableName)
|
||||
{
|
||||
feature::RegionData regionData;
|
||||
|
|
Loading…
Add table
Reference in a new issue