mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-01-27 08:12:33 +00:00
ChoiceWithValueDisplay: Allow translation of the value
This commit is contained in:
parent
9d8d64b321
commit
4195da289c
@ -37,6 +37,9 @@ class I18NCategory {
|
||||
public:
|
||||
I18NCategory(const char *name) : name_(name) {}
|
||||
const char *T(const char *key, const char *def = 0);
|
||||
const char *T(const std::string &key) {
|
||||
return T(key.c_str(), nullptr);
|
||||
}
|
||||
|
||||
const std::map<std::string, std::string> &Missed() const {
|
||||
return missedKeyLog_;
|
||||
|
@ -458,7 +458,10 @@ void ChoiceWithValueDisplay::Draw(UIContext &dc) {
|
||||
dc.SetFontStyle(dc.theme->uiFont);
|
||||
|
||||
if (sValue_ != nullptr) {
|
||||
valueText << *sValue_;
|
||||
if (category_)
|
||||
valueText << category_->T(*sValue_);
|
||||
else
|
||||
valueText << *sValue_;
|
||||
} else if (iValue_ != nullptr) {
|
||||
valueText << *iValue_;
|
||||
}
|
||||
|
@ -271,16 +271,17 @@ private:
|
||||
class ChoiceWithValueDisplay : public UI::Choice {
|
||||
public:
|
||||
ChoiceWithValueDisplay(int *value, const std::string &text, LayoutParams *layoutParams = 0)
|
||||
: Choice(text, layoutParams), iValue_(value) { sValue_ = nullptr; }
|
||||
: Choice(text, layoutParams), iValue_(value), category_(nullptr) { sValue_ = nullptr; }
|
||||
|
||||
ChoiceWithValueDisplay(std::string *value, const std::string &text, LayoutParams *layoutParams = 0)
|
||||
: Choice(text, layoutParams), sValue_(value) { iValue_ = nullptr; }
|
||||
ChoiceWithValueDisplay(std::string *value, const std::string &text, I18NCategory *category, LayoutParams *layoutParams = 0)
|
||||
: Choice(text, layoutParams), sValue_(value), category_(category) { iValue_ = nullptr; }
|
||||
|
||||
void Draw(UIContext &dc);
|
||||
|
||||
private:
|
||||
int *iValue_;
|
||||
std::string *sValue_;
|
||||
I18NCategory *category_;
|
||||
};
|
||||
|
||||
} // namespace UI
|
||||
|
Loading…
x
Reference in New Issue
Block a user