Add support for Pyeong, a Korean floorspace unit. (#444)

Fixes #382
Description of the changes:
Add Pyeong as an Area conversion unit.
Pyeong shows up only if the user's current region is Korea ( i.e. region is either KP or KR ).
Added Korean translation for Pyeong (평). For other locales, we default to English ( Pyeong ).
How changes were validated:
Manually tested the below

For non-Korean regions, Pyeong does not show up.

Korean region with Korean locale => Pyeong shows up and Pyeong is correctly translated.
pyeong_Korean

Korean region with English locale => Pyeong shows up and Pyeong is in English.
pyeong_English

Korean region with simplified Chinese locale => Pyeong shows up and Pyeong is in English.
pyeong_Chinese
This commit is contained in:
Seulgi Kim
2019-04-16 17:53:08 -07:00
committed by Daniel Belcher
parent c150cd4ece
commit 853704c1c2
4 changed files with 54 additions and 11 deletions

View File

@@ -404,12 +404,30 @@ void UnitConverter::RestoreUserPreferences(const wstring& userPreferences)
}
vector<wstring> outerTokens = StringToVector(userPreferences, L"|");
if (outerTokens.size() == 3)
if (outerTokens.size() != 3)
{
m_fromType = StringToUnit(outerTokens[0]);
m_toType = StringToUnit(outerTokens[1]);
m_currentCategory = StringToCategory(outerTokens[2]);
return;
}
auto fromType = StringToUnit(outerTokens[0]);
auto toType = StringToUnit(outerTokens[1]);
m_currentCategory = StringToCategory(outerTokens[2]);
// Only restore from the saved units if they are valid in the current available units.
auto itr = m_categoryToUnits.find(m_currentCategory);
if (itr != m_categoryToUnits.end())
{
const auto& curUnits = itr->second;
if (find(curUnits.begin(), curUnits.end(), fromType) != curUnits.end())
{
m_fromType = fromType;
}
if (find(curUnits.begin(), curUnits.end(), toType) != curUnits.end())
{
m_toType = toType;
}
}
}
/// <summary>