First pass of language

This commit is contained in:
2026-07-07 11:14:02 -05:00
parent 2dcf0d0f0d
commit d83a953e2d
11 changed files with 69 additions and 66 deletions
+12 -45
View File
@@ -10,51 +10,18 @@ msgid "ui.title"
msgstr "" msgstr ""
"Welcome" "Welcome"
#: ui/user.c:22 #: src/dusk/ui/frame/settings/uisettings.c
msgid "ui.greeting" msgid "ui.settings.tabs.gameplay"
msgstr "Hello, %s!" msgstr "Gameplay"
#: ui/files.c:40 #: src/dusk/ui/frame/settings/uisettings.c
msgid "ui.file_status" msgid "ui.settings.tabs.input"
msgstr "%s has %d files." msgstr "Input"
#: ui/cart.c:55 #: src/dusk/ui/frame/settings/uisettings.c
msgid "cart.item_count" msgid "ui.settings.tabs.display"
msgid_plural "cart.item_count" msgstr "Display"
msgstr[0] "%d item"
msgstr[1] "%d items (dual)"
msgstr[2] "%d items (few)"
msgstr[3] "%d items (many)"
#: ui/notifications.c:71 #: src/dusk/ui/frame/settings/uisettings.c
msgid "" msgid "ui.settings.tabs.audio"
"ui.multiline_help" msgstr "Audio"
msgstr ""
"Line one of the help text.\n"
"Line two continues here.\n"
"Line three ends here."
#: ui/errors.c:90
msgid ""
"error.upload_failed.long"
msgstr ""
"Upload failed for file \"%s\".\n"
"Please try again later or contact support."
#: ui/messages.c:110
msgid ""
"user.invite_status"
msgid_plural ""
"user.invite_status"
msgstr[0] ""
"%s invited %d user.\n"
"Please review the request."
msgstr[1] ""
"%s invited %d users (dual).\n"
"Please review the requests."
msgstr[2] ""
"%s invited %d users (few).\n"
"Please review the requests."
msgstr[3] ""
"%s invited %d users (many).\n"
"Please review the requests."
@@ -513,9 +513,10 @@ errorret_t assetLocaleGetString(
// Skip blanks, comments, etc and start looking for msgid's // Skip blanks, comments, etc and start looking for msgid's
errorChain(assetLocaleLineSkipBlanks(&reader, lineBuffer)); errorChain(assetLocaleLineSkipBlanks(&reader, lineBuffer));
while(!reader.eof) { while(true) {
// Is this msgid? // Is this msgid?
if(memoryCompare(lineBuffer, "msgid", 5) != 0) { if(memoryCompare(lineBuffer, "msgid", 5) != 0) {
if(reader.eof) break;
errorChain(assetFileLineReaderNext(&reader)); errorChain(assetFileLineReaderNext(&reader));
msgidBuffer[0] = '\0'; msgidBuffer[0] = '\0';
continue; continue;
@@ -539,7 +540,7 @@ errorret_t assetLocaleGetString(
} }
// We are either going to see a msgstr or a msgid_plural // We are either going to see a msgstr or a msgid_plural
while(!reader.eof) { while(true) {
errorChain(assetLocaleLineSkipBlanks(&reader, lineBuffer)); errorChain(assetLocaleLineSkipBlanks(&reader, lineBuffer));
// Is msgid_plural? // Is msgid_plural?
+1 -1
View File
@@ -33,7 +33,7 @@ errorret_t uiGameMenuInit(void) {
uiMenuInit(menu, uiGameMenuSelected, NULL, NULL); uiMenuInit(menu, uiGameMenuSelected, NULL, NULL);
menu->items = UI_GAME_MENU.items; menu->items = UI_GAME_MENU.items;
MENU_BEGIN MENU_BEGIN();
MENU_BUTTON("Characters"); MENU_BUTTON("Characters");
MENU_BUTTON("Settings"); MENU_BUTTON("Settings");
+36 -5
View File
@@ -16,6 +16,8 @@
#include "display/text/text.h" #include "display/text/text.h"
#include "display/screen/screen.h" #include "display/screen/screen.h"
#include "assert/assert.h" #include "assert/assert.h"
#include "locale/localemanager.h"
#include "asset/loader/locale/assetlocaleloader.h"
uisettings_t UI_SETTINGS; uisettings_t UI_SETTINGS;
@@ -49,15 +51,44 @@ void uiSettingsTabSelected(
errorret_t uiSettingsInit(void) { errorret_t uiSettingsInit(void) {
memoryZero(&UI_SETTINGS, sizeof(uisettings_t)); memoryZero(&UI_SETTINGS, sizeof(uisettings_t));
errorChain(assetLocaleGetString(
&LOCALE.entry->data.locale,
"ui.settings.tabs.gameplay",
0,
UI_SETTINGS.tabLabels[UI_SETTINGS_TAB_GAMEPLAY],
UI_SETTINGS_TAB_LABEL_MAX
));
errorChain(assetLocaleGetString(
&LOCALE.entry->data.locale,
"ui.settings.tabs.input",
0,
UI_SETTINGS.tabLabels[UI_SETTINGS_TAB_INPUT],
UI_SETTINGS_TAB_LABEL_MAX
));
errorChain(assetLocaleGetString(
&LOCALE.entry->data.locale,
"ui.settings.tabs.display",
0,
UI_SETTINGS.tabLabels[UI_SETTINGS_TAB_DISPLAY],
UI_SETTINGS_TAB_LABEL_MAX
));
errorChain(assetLocaleGetString(
&LOCALE.entry->data.locale,
"ui.settings.tabs.audio",
0,
UI_SETTINGS.tabLabels[UI_SETTINGS_TAB_AUDIO],
UI_SETTINGS_TAB_LABEL_MAX
));
uimenu_t *menu = &UI_SETTINGS.tabsMenu; uimenu_t *menu = &UI_SETTINGS.tabsMenu;
uiMenuInit(menu, uiSettingsTabSelected, NULL, NULL); uiMenuInit(menu, uiSettingsTabSelected, NULL, NULL);
menu->items = UI_SETTINGS.tabs; menu->items = UI_SETTINGS.tabs;
MENU_BEGIN MENU_BEGIN();
MENU_TAB("Gameplay"); MENU_TAB(UI_SETTINGS.tabLabels[UI_SETTINGS_TAB_GAMEPLAY]);
MENU_TAB("Input"); MENU_TAB(UI_SETTINGS.tabLabels[UI_SETTINGS_TAB_INPUT]);
MENU_TAB("Display"); MENU_TAB(UI_SETTINGS.tabLabels[UI_SETTINGS_TAB_DISPLAY]);
MENU_TAB("Audio"); MENU_TAB(UI_SETTINGS.tabLabels[UI_SETTINGS_TAB_AUDIO]);
assertTrue( assertTrue(
menuIndex <= UI_SETTINGS_TAB_COUNT, menuIndex <= UI_SETTINGS_TAB_COUNT,
+2
View File
@@ -14,10 +14,12 @@
#define UI_SETTINGS_TAB_DISPLAY 2 #define UI_SETTINGS_TAB_DISPLAY 2
#define UI_SETTINGS_TAB_AUDIO 3 #define UI_SETTINGS_TAB_AUDIO 3
#define UI_SETTINGS_TAB_COUNT 4 #define UI_SETTINGS_TAB_COUNT 4
#define UI_SETTINGS_TAB_LABEL_MAX 32
typedef struct { typedef struct {
uimenu_t tabsMenu; uimenu_t tabsMenu;
uimenuitem_t tabs[UI_SETTINGS_TAB_COUNT]; uimenuitem_t tabs[UI_SETTINGS_TAB_COUNT];
char_t tabLabels[UI_SETTINGS_TAB_COUNT][UI_SETTINGS_TAB_LABEL_MAX];
} uisettings_t; } uisettings_t;
extern uisettings_t UI_SETTINGS; extern uisettings_t UI_SETTINGS;
+1 -1
View File
@@ -17,7 +17,7 @@ errorret_t uiSettingsAudioInit(void) {
uiMenuInit(menu, NULL, NULL, NULL); uiMenuInit(menu, NULL, NULL, NULL);
menu->items = UI_SETTINGS_AUDIO.items; menu->items = UI_SETTINGS_AUDIO.items;
MENU_BEGIN MENU_BEGIN();
MENU_LABEL("No audio settings yet"); MENU_LABEL("No audio settings yet");
uiMenuSetItems(menu, UI_SETTINGS_AUDIO.items, menuIndex, 1); uiMenuSetItems(menu, UI_SETTINGS_AUDIO.items, menuIndex, 1);
@@ -17,7 +17,7 @@ errorret_t uiSettingsDisplayInit(void) {
uiMenuInit(menu, NULL, NULL, NULL); uiMenuInit(menu, NULL, NULL, NULL);
menu->items = UI_SETTINGS_DISPLAY.items; menu->items = UI_SETTINGS_DISPLAY.items;
MENU_BEGIN MENU_BEGIN();
MENU_LABEL("No display settings yet"); MENU_LABEL("No display settings yet");
uiMenuSetItems(menu, UI_SETTINGS_DISPLAY.items, menuIndex, 1); uiMenuSetItems(menu, UI_SETTINGS_DISPLAY.items, menuIndex, 1);
@@ -35,7 +35,7 @@ errorret_t uiSettingsGameplayInit(void) {
uiMenuInit(menu, uiSettingsGameplaySelected, NULL, NULL); uiMenuInit(menu, uiSettingsGameplaySelected, NULL, NULL);
menu->items = UI_SETTINGS_GAMEPLAY.items; menu->items = UI_SETTINGS_GAMEPLAY.items;
MENU_BEGIN MENU_BEGIN();
MENU_BUTTON("Do thing"); MENU_BUTTON("Do thing");
MENU_BUTTON("Do other thing"); MENU_BUTTON("Do other thing");
MENU_CHECKBOX("Enable thing?"); MENU_CHECKBOX("Enable thing?");
+1 -1
View File
@@ -17,7 +17,7 @@ errorret_t uiSettingsInputInit(void) {
uiMenuInit(menu, NULL, NULL, NULL); uiMenuInit(menu, NULL, NULL, NULL);
menu->items = UI_SETTINGS_INPUT.items; menu->items = UI_SETTINGS_INPUT.items;
MENU_BEGIN MENU_BEGIN();
MENU_LABEL("No input settings yet"); MENU_LABEL("No input settings yet");
uiMenuSetItems(menu, UI_SETTINGS_INPUT.items, menuIndex, 1); uiMenuSetItems(menu, UI_SETTINGS_INPUT.items, menuIndex, 1);
+1 -1
View File
@@ -44,7 +44,7 @@ errorret_t uiConfirmInit(void) {
uiMenuInit(menu, uiConfirmSelected, uiConfirmClosed, NULL); uiMenuInit(menu, uiConfirmSelected, uiConfirmClosed, NULL);
menu->items = UI_CONFIRM.items; menu->items = UI_CONFIRM.items;
MENU_BEGIN MENU_BEGIN();
MENU_BUTTON("Confirm"); MENU_BUTTON("Confirm");
MENU_BUTTON("Cancel"); MENU_BUTTON("Cancel");
+10 -8
View File
@@ -212,42 +212,44 @@ bool_t uiMenuFocusDirection(
); );
// Helper macros // Helper macros
#define MENU_BEGIN uint8_t menuIndex = 0; #define MENU_BEGIN() uint8_t menuIndex = 0
#define MENU_LABEL(text) \ #define MENU_LABEL(text) \
menu->items[menuIndex].type = UI_MENU_WIDGET_TYPE_LABEL; \ menu->items[menuIndex].type = UI_MENU_WIDGET_TYPE_LABEL; \
menu->items[menuIndex].label = text; \ menu->items[menuIndex].label = text; \
++menuIndex; ++menuIndex
#define MENU_SPACER() \ #define MENU_SPACER() \
menu->items[menuIndex].type = UI_MENU_WIDGET_TYPE_SPACER; \ menu->items[menuIndex].type = UI_MENU_WIDGET_TYPE_SPACER; \
++menuIndex; ++menuIndex
#define MENU_CHECKBOX(label) \ #define MENU_CHECKBOX(label) \
menu->items[menuIndex].type = UI_MENU_WIDGET_TYPE_CHECKBOX; \ menu->items[menuIndex].type = UI_MENU_WIDGET_TYPE_CHECKBOX; \
uiCheckboxInit(&menu->items[menuIndex].checkbox, label); \ uiCheckboxInit(&menu->items[menuIndex].checkbox, label); \
++menuIndex; ++menuIndex
#define MENU_BUTTON(label) \ #define MENU_BUTTON(label) \
menu->items[menuIndex].type = UI_MENU_WIDGET_TYPE_BUTTON; \ menu->items[menuIndex].type = UI_MENU_WIDGET_TYPE_BUTTON; \
uiButtonInit(&menu->items[menuIndex].button, label); \ uiButtonInit(&menu->items[menuIndex].button, label); \
++menuIndex; ++menuIndex
#define MENU_TAB(label) \ #define MENU_TAB(label) \
menu->items[menuIndex].type = UI_MENU_WIDGET_TYPE_TAB; \ menu->items[menuIndex].type = UI_MENU_WIDGET_TYPE_TAB; \
uiTabInit(&menu->items[menuIndex].tab, label); \ uiTabInit(&menu->items[menuIndex].tab, label); \
++menuIndex; ++menuIndex
#define MENU_SLIDER_FLOAT(label, value, min, max, step) \ #define MENU_SLIDER_FLOAT(label, value, min, max, step) \
menu->items[menuIndex].type = UI_MENU_WIDGET_TYPE_SLIDER; \ menu->items[menuIndex].type = UI_MENU_WIDGET_TYPE_SLIDER; \
uiSliderInitFloat( \ uiSliderInitFloat( \
&menu->items[menuIndex].slider, label, value, min, max, step \ &menu->items[menuIndex].slider, label, value, min, max, step \
); \ ); \
++menuIndex; ++menuIndex
#define MENU_SLIDER_INT(label, value, min, max, step) \ #define MENU_SLIDER_INT(label, value, min, max, step) \
menu->items[menuIndex].type = UI_MENU_WIDGET_TYPE_SLIDER; \ menu->items[menuIndex].type = UI_MENU_WIDGET_TYPE_SLIDER; \
uiSliderInitInt( \ uiSliderInitInt( \
&menu->items[menuIndex].slider, label, value, min, max, step \ &menu->items[menuIndex].slider, label, value, min, max, step \
); \ ); \
++menuIndex; ++menuIndex
//EOF