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 ""
"Welcome"
#: ui/user.c:22
msgid "ui.greeting"
msgstr "Hello, %s!"
#: src/dusk/ui/frame/settings/uisettings.c
msgid "ui.settings.tabs.gameplay"
msgstr "Gameplay"
#: ui/files.c:40
msgid "ui.file_status"
msgstr "%s has %d files."
#: src/dusk/ui/frame/settings/uisettings.c
msgid "ui.settings.tabs.input"
msgstr "Input"
#: ui/cart.c:55
msgid "cart.item_count"
msgid_plural "cart.item_count"
msgstr[0] "%d item"
msgstr[1] "%d items (dual)"
msgstr[2] "%d items (few)"
msgstr[3] "%d items (many)"
#: src/dusk/ui/frame/settings/uisettings.c
msgid "ui.settings.tabs.display"
msgstr "Display"
#: ui/notifications.c:71
msgid ""
"ui.multiline_help"
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."
#: src/dusk/ui/frame/settings/uisettings.c
msgid "ui.settings.tabs.audio"
msgstr "Audio"
@@ -513,9 +513,10 @@ errorret_t assetLocaleGetString(
// Skip blanks, comments, etc and start looking for msgid's
errorChain(assetLocaleLineSkipBlanks(&reader, lineBuffer));
while(!reader.eof) {
while(true) {
// Is this msgid?
if(memoryCompare(lineBuffer, "msgid", 5) != 0) {
if(reader.eof) break;
errorChain(assetFileLineReaderNext(&reader));
msgidBuffer[0] = '\0';
continue;
@@ -539,7 +540,7 @@ errorret_t assetLocaleGetString(
}
// We are either going to see a msgstr or a msgid_plural
while(!reader.eof) {
while(true) {
errorChain(assetLocaleLineSkipBlanks(&reader, lineBuffer));
// Is msgid_plural?
+1 -1
View File
@@ -33,7 +33,7 @@ errorret_t uiGameMenuInit(void) {
uiMenuInit(menu, uiGameMenuSelected, NULL, NULL);
menu->items = UI_GAME_MENU.items;
MENU_BEGIN
MENU_BEGIN();
MENU_BUTTON("Characters");
MENU_BUTTON("Settings");
+36 -5
View File
@@ -16,6 +16,8 @@
#include "display/text/text.h"
#include "display/screen/screen.h"
#include "assert/assert.h"
#include "locale/localemanager.h"
#include "asset/loader/locale/assetlocaleloader.h"
uisettings_t UI_SETTINGS;
@@ -49,15 +51,44 @@ void uiSettingsTabSelected(
errorret_t uiSettingsInit(void) {
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;
uiMenuInit(menu, uiSettingsTabSelected, NULL, NULL);
menu->items = UI_SETTINGS.tabs;
MENU_BEGIN
MENU_TAB("Gameplay");
MENU_TAB("Input");
MENU_TAB("Display");
MENU_TAB("Audio");
MENU_BEGIN();
MENU_TAB(UI_SETTINGS.tabLabels[UI_SETTINGS_TAB_GAMEPLAY]);
MENU_TAB(UI_SETTINGS.tabLabels[UI_SETTINGS_TAB_INPUT]);
MENU_TAB(UI_SETTINGS.tabLabels[UI_SETTINGS_TAB_DISPLAY]);
MENU_TAB(UI_SETTINGS.tabLabels[UI_SETTINGS_TAB_AUDIO]);
assertTrue(
menuIndex <= UI_SETTINGS_TAB_COUNT,
+2
View File
@@ -14,10 +14,12 @@
#define UI_SETTINGS_TAB_DISPLAY 2
#define UI_SETTINGS_TAB_AUDIO 3
#define UI_SETTINGS_TAB_COUNT 4
#define UI_SETTINGS_TAB_LABEL_MAX 32
typedef struct {
uimenu_t tabsMenu;
uimenuitem_t tabs[UI_SETTINGS_TAB_COUNT];
char_t tabLabels[UI_SETTINGS_TAB_COUNT][UI_SETTINGS_TAB_LABEL_MAX];
} uisettings_t;
extern uisettings_t UI_SETTINGS;
+1 -1
View File
@@ -17,7 +17,7 @@ errorret_t uiSettingsAudioInit(void) {
uiMenuInit(menu, NULL, NULL, NULL);
menu->items = UI_SETTINGS_AUDIO.items;
MENU_BEGIN
MENU_BEGIN();
MENU_LABEL("No audio settings yet");
uiMenuSetItems(menu, UI_SETTINGS_AUDIO.items, menuIndex, 1);
@@ -17,7 +17,7 @@ errorret_t uiSettingsDisplayInit(void) {
uiMenuInit(menu, NULL, NULL, NULL);
menu->items = UI_SETTINGS_DISPLAY.items;
MENU_BEGIN
MENU_BEGIN();
MENU_LABEL("No display settings yet");
uiMenuSetItems(menu, UI_SETTINGS_DISPLAY.items, menuIndex, 1);
@@ -35,7 +35,7 @@ errorret_t uiSettingsGameplayInit(void) {
uiMenuInit(menu, uiSettingsGameplaySelected, NULL, NULL);
menu->items = UI_SETTINGS_GAMEPLAY.items;
MENU_BEGIN
MENU_BEGIN();
MENU_BUTTON("Do thing");
MENU_BUTTON("Do other thing");
MENU_CHECKBOX("Enable thing?");
+1 -1
View File
@@ -17,7 +17,7 @@ errorret_t uiSettingsInputInit(void) {
uiMenuInit(menu, NULL, NULL, NULL);
menu->items = UI_SETTINGS_INPUT.items;
MENU_BEGIN
MENU_BEGIN();
MENU_LABEL("No input settings yet");
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);
menu->items = UI_CONFIRM.items;
MENU_BEGIN
MENU_BEGIN();
MENU_BUTTON("Confirm");
MENU_BUTTON("Cancel");
+10 -8
View File
@@ -212,42 +212,44 @@ bool_t uiMenuFocusDirection(
);
// Helper macros
#define MENU_BEGIN uint8_t menuIndex = 0;
#define MENU_BEGIN() uint8_t menuIndex = 0
#define MENU_LABEL(text) \
menu->items[menuIndex].type = UI_MENU_WIDGET_TYPE_LABEL; \
menu->items[menuIndex].label = text; \
++menuIndex;
++menuIndex
#define MENU_SPACER() \
menu->items[menuIndex].type = UI_MENU_WIDGET_TYPE_SPACER; \
++menuIndex;
++menuIndex
#define MENU_CHECKBOX(label) \
menu->items[menuIndex].type = UI_MENU_WIDGET_TYPE_CHECKBOX; \
uiCheckboxInit(&menu->items[menuIndex].checkbox, label); \
++menuIndex;
++menuIndex
#define MENU_BUTTON(label) \
menu->items[menuIndex].type = UI_MENU_WIDGET_TYPE_BUTTON; \
uiButtonInit(&menu->items[menuIndex].button, label); \
++menuIndex;
++menuIndex
#define MENU_TAB(label) \
menu->items[menuIndex].type = UI_MENU_WIDGET_TYPE_TAB; \
uiTabInit(&menu->items[menuIndex].tab, label); \
++menuIndex;
++menuIndex
#define MENU_SLIDER_FLOAT(label, value, min, max, step) \
menu->items[menuIndex].type = UI_MENU_WIDGET_TYPE_SLIDER; \
uiSliderInitFloat( \
&menu->items[menuIndex].slider, label, value, min, max, step \
); \
++menuIndex;
++menuIndex
#define MENU_SLIDER_INT(label, value, min, max, step) \
menu->items[menuIndex].type = UI_MENU_WIDGET_TYPE_SLIDER; \
uiSliderInitInt( \
&menu->items[menuIndex].slider, label, value, min, max, step \
); \
++menuIndex;
++menuIndex
//EOF