14 language_menu_strings = (
char**) malloc(
sizeof(
char*) * MAX_LANGUAGE_MENU_STRINGS);
15 RETURN_WHEN_NULL(language_menu_strings, 1,
"Language Menu",
"Failed to allocate memory for language menu strings.");
17 for (
int i = 0; i < MAX_LANGUAGE_MENU_STRINGS; i++) {
18 language_menu_strings[i] = NULL;
30 const char* menu_options[2];
32 menu_options[0] = language_menu_strings[LANGUAGE_ENGLISH];
33 menu_options[1] = language_menu_strings[LANGUAGE_GERMAN];
35 menu_result_t res = MENU_CHANGE_LANGUAGE;
37 int selected_index = 0;
38 bool selection_active =
true;
39 while (selection_active) {
40 const int menu_count = 2;
41 draw_menu(menu_options, menu_count, selected_index);
49 switch (input_event.type) {
51 selected_index = (selected_index - 1 + menu_count) % menu_count;
54 selected_index = (selected_index + 1) % menu_count;
57 if (selected_index == 0) {
60 }
else if (selected_index == 1) {
64 selection_active =
false;
69 selection_active =
false;
73 selection_active =
false;
85 if (language_menu_strings != NULL) {
86 for (
int i = 0; i < MAX_LANGUAGE_MENU_STRINGS; i++) {
87 if (language_menu_strings[i] != NULL) {
88 free(language_menu_strings[i]);
91 free(language_menu_strings);
Defines common macros, types, and global variables for color schemes and utilities.
int set_language(const local_lang_t lang)
Sets the current language for the local handler and updates all registered observers.
void observe_local(void(*update_func)(void))
Registers an observer function to be notified of updates from the local handler.
Exposes public functions for the localization handler.
Exposes functions for outputting to the console.