mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-22 14:13:30 -07:00
Add Pyeong. a Korean floorspace unit.
This commit is contained in:
parent
af41a183a7
commit
cd715e9ee1
4 changed files with 35 additions and 3 deletions
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
namespace CalculatorApp
|
||||
|
@ -162,7 +162,8 @@ namespace CalculatorApp
|
|||
Data_Zebibytes = UnitStart + 162,
|
||||
Data_Zetabits = UnitStart + 163,
|
||||
Data_Zetabytes = UnitStart + 164,
|
||||
UnitEnd = Data_Zetabytes
|
||||
Area_Pyeong = UnitStart + 165,
|
||||
UnitEnd = Area_Pyeong
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -120,6 +120,12 @@ void UnitConverterDataLoader::LoadData()
|
|||
|
||||
for (auto itr = unitConversions.begin(); itr != unitConversions.end(); ++itr)
|
||||
{
|
||||
if (idToUnit.find(itr->first) == idToUnit.end())
|
||||
{
|
||||
// Optional units will not be in idToUnit but can be in unitConversions.
|
||||
// For optional units that did not make it to the current set of units, just continue.
|
||||
continue;
|
||||
}
|
||||
UCM::ConversionData parsedData = { 1.0, 0.0, false };
|
||||
assert(itr->second > 0); // divide by zero assert
|
||||
parsedData.ratio = unitFactor / itr->second;
|
||||
|
@ -175,6 +181,10 @@ void UnitConverterDataLoader::GetUnits(_In_ unordered_map<ViewMode, vector<Order
|
|||
|
||||
bool useWattInsteadOfKilowatt = m_currentRegionCode == "GB";
|
||||
|
||||
// Use Pyeong, a Korean floorspace unit.
|
||||
// https://en.wikipedia.org/wiki/Korean_units_of_measurement#Area
|
||||
bool usePyeong = m_currentRegionCode == L"KP" || m_currentRegionCode == L"KR";
|
||||
|
||||
vector<OrderedUnit> areaUnits;
|
||||
areaUnits.push_back(OrderedUnit{ UnitConverterUnits::Area_Acre, GetLocalizedStringName(L"UnitName_Acre"), GetLocalizedStringName(L"UnitAbbreviation_Acre"), 9 });
|
||||
areaUnits.push_back(OrderedUnit{ UnitConverterUnits::Area_Hectare, GetLocalizedStringName(L"UnitName_Hectare"), GetLocalizedStringName(L"UnitAbbreviation_Hectare"), 4 });
|
||||
|
@ -190,6 +200,10 @@ void UnitConverterDataLoader::GetUnits(_In_ unordered_map<ViewMode, vector<Order
|
|||
areaUnits.push_back(OrderedUnit{ UnitConverterUnits::Area_Paper, GetLocalizedStringName(L"UnitName_Paper"), GetLocalizedStringName(L"UnitAbbreviation_Paper"), 12, false, false, true });
|
||||
areaUnits.push_back(OrderedUnit{ UnitConverterUnits::Area_SoccerField, GetLocalizedStringName(L"UnitName_SoccerField"), GetLocalizedStringName(L"UnitAbbreviation_SoccerField"),13, false, false, true });
|
||||
areaUnits.push_back(OrderedUnit{ UnitConverterUnits::Area_Castle, GetLocalizedStringName(L"UnitName_Castle"), GetLocalizedStringName(L"UnitAbbreviation_Castle"), 14, false, false, true });
|
||||
if (usePyeong)
|
||||
{
|
||||
areaUnits.push_back(OrderedUnit{ UnitConverterUnits::Area_Pyeong, GetLocalizedStringName(L"UnitName_PYeong"), GetLocalizedStringName(L"UnitAbbreviation_Pyeong"), 15, false, false, false });
|
||||
}
|
||||
unitMap.emplace(ViewMode::Area, areaUnits);
|
||||
|
||||
vector<OrderedUnit> dataUnits;
|
||||
|
@ -384,6 +398,7 @@ void UnitConverterDataLoader::GetConversionData(_In_ unordered_map<ViewMode, uno
|
|||
{ ViewMode::Area, UnitConverterUnits::Area_Paper, 0.06032246 },
|
||||
{ ViewMode::Area, UnitConverterUnits::Area_SoccerField, 10869.66 },
|
||||
{ ViewMode::Area, UnitConverterUnits::Area_Castle, 100000 },
|
||||
{ ViewMode::Area, UnitConverterUnits::Area_Pyeong, 3.305785 }, // apprx of 400/121
|
||||
|
||||
{ ViewMode::Data, UnitConverterUnits::Data_Bit, 0.000000125 },
|
||||
{ ViewMode::Data, UnitConverterUnits::Data_Byte, 0.000001 },
|
||||
|
|
|
@ -3379,4 +3379,12 @@
|
|||
<value>Microsoft Services Agreement</value>
|
||||
<comment>Displayed on a link to the Microsoft Services Agreement in the about this app information</comment>
|
||||
</data>
|
||||
</root>
|
||||
<data name="UnitAbbreviation_Pyeong" xml:space="preserve">
|
||||
<value>Pyeong</value>
|
||||
<comment>An abbreviation for a measurement unit of area.</comment>
|
||||
</data>
|
||||
<data name="UnitName_Pyeong" xml:space="preserve">
|
||||
<value>Pyeong</value>
|
||||
<comment>A measurement unit for area.</comment>
|
||||
</data>
|
||||
</root>
|
|
@ -2907,4 +2907,12 @@
|
|||
<value>Microsoft 서비스 계약</value>
|
||||
<comment>Displayed on a link to the Microsoft Services Agreement in the about this app information</comment>
|
||||
</data>
|
||||
<data name="UnitAbbreviation_Pyeong" xml:space="preserve">
|
||||
<value>평</value>
|
||||
<comment>An abbreviation for a measurement unit of area.</comment>
|
||||
</data>
|
||||
<data name="UnitName_Pyeong" xml:space="preserve">
|
||||
<value>평</value>
|
||||
<comment>A measurement unit for area.</comment>
|
||||
</data>
|
||||
</root>
|
Loading…
Add table
Add a link
Reference in a new issue