diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-03-23 21:40:41 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-03-23 21:40:41 +0200 |
commit | bb9a22212f83e55ebaf601a65251ccb3caf86fab (patch) | |
tree | 166aa0e7a0351b7a68d40e65b2a61afa0da51d37 /src/ui/labelwidget.c | |
parent | 35496f8a9c9cc0098210349d5c7fda3492ffd9c8 (diff) |
UI language preference; switching at runtime
IssueID #192
Diffstat (limited to 'src/ui/labelwidget.c')
-rw-r--r-- | src/ui/labelwidget.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/ui/labelwidget.c b/src/ui/labelwidget.c index 2a1eb06a..8089445b 100644 --- a/src/ui/labelwidget.c +++ b/src/ui/labelwidget.c | |||
@@ -85,6 +85,10 @@ static iBool processEvent_LabelWidget_(iLabelWidget *d, const SDL_Event *ev) { | |||
85 | if (isMetricsChange_UserEvent(ev)) { | 85 | if (isMetricsChange_UserEvent(ev)) { |
86 | updateSize_LabelWidget(d); | 86 | updateSize_LabelWidget(d); |
87 | } | 87 | } |
88 | else if (isCommand_UserEvent(ev, "lang.changed")) { | ||
89 | setText_LabelWidget(d, &d->srcLabel); | ||
90 | return iFalse; | ||
91 | } | ||
88 | else if (isCommand_UserEvent(ev, "bindings.changed")) { | 92 | else if (isCommand_UserEvent(ev, "bindings.changed")) { |
89 | /* Update the key used to trigger this label. */ | 93 | /* Update the key used to trigger this label. */ |
90 | updateKey_LabelWidget_(d); | 94 | updateKey_LabelWidget_(d); |
@@ -474,6 +478,11 @@ const iString *text_LabelWidget(const iLabelWidget *d) { | |||
474 | return &d->label; | 478 | return &d->label; |
475 | } | 479 | } |
476 | 480 | ||
481 | const iString *sourceText_LabelWidget(const iLabelWidget *d) { | ||
482 | if (!d) return collectNew_String(); | ||
483 | return &d->srcLabel; | ||
484 | } | ||
485 | |||
477 | const iString *command_LabelWidget(const iLabelWidget *d) { | 486 | const iString *command_LabelWidget(const iLabelWidget *d) { |
478 | return &d->command; | 487 | return &d->command; |
479 | } | 488 | } |