Add ParseLanguage

This commit is contained in:
Jesse Talavera-Greenberg 2023-08-24 21:53:01 -04:00
parent 690f22f977
commit 1c366f7efb
2 changed files with 15 additions and 0 deletions

View File

@ -78,3 +78,16 @@ optional<melonds::HybridSideScreenDisplay> melonds::config::ParseHybridSideScree
return nullopt;
}
std::optional<melonds::FirmwareLanguage> melonds::config::ParseLanguage(std::string_view value) noexcept {
if (value == values::AUTO) return melonds::FirmwareLanguage::Auto;
if (value == values::DEFAULT) return melonds::FirmwareLanguage::Default;
if (value == values::JAPANESE) return melonds::FirmwareLanguage::Japanese;
if (value == values::ENGLISH) return melonds::FirmwareLanguage::English;
if (value == values::FRENCH) return melonds::FirmwareLanguage::French;
if (value == values::GERMAN) return melonds::FirmwareLanguage::German;
if (value == values::ITALIAN) return melonds::FirmwareLanguage::Italian;
if (value == values::SPANISH) return melonds::FirmwareLanguage::Spanish;
return nullopt;
}

View File

@ -235,6 +235,8 @@ namespace melonds::config {
std::optional<melonds::HybridSideScreenDisplay> ParseHybridSideScreenDisplay(const char *value) noexcept;
std::optional<melonds::FirmwareLanguage> ParseLanguage(std::string_view value) noexcept;
}