Fixed small bug with parsing plurals

This commit is contained in:
2026-04-04 10:19:07 -05:00
parent b5b29d7061
commit 7b87347b77
2 changed files with 16 additions and 8 deletions

View File

@@ -219,7 +219,6 @@ errorret_t assetLocaleGetString(
sizeof(msgidPluralBuffer) sizeof(msgidPluralBuffer)
); );
msgidPluralFound = true; msgidPluralFound = true;
printf("Found plural ID: %s\n", msgidPluralBuffer);
continue; continue;
} }
@@ -252,8 +251,17 @@ errorret_t assetLocaleGetString(
int32_t index = atoi(ptr); int32_t index = atoi(ptr);
if(index != pluralIndex) { if(index != pluralIndex) {
// Not the plural form we want, skip // Not the plural form we want, skip to the next useable line
while(!reader.eof) {
errorChain(assetFileLineReaderNext(&reader)); errorChain(assetFileLineReaderNext(&reader));
errorChain(assetLocaleLineSkipBlanks(&reader, lineBuffer));
if(
lineBuffer[0] == '\"' ||
lineBuffer[0] == '\0' ||
lineBuffer[0] == '#'
) continue;
break;
}
continue; continue;
} }
@@ -273,6 +281,5 @@ errorret_t assetLocaleGetString(
errorThrow("Failed to find msgstr for message ID: %s", messageId); errorThrow("Failed to find msgstr for message ID: %s", messageId);
} }
printf("Found translation: %s\n", stringBuffer);
errorOk(); errorOk();
} }

View File

@@ -41,13 +41,14 @@ errorret_t engineInit(const int32_t argc, const char_t **argv) {
char_t buffer[256]; char_t buffer[256];
errorChain(localeManagerGetText( errorChain(localeManagerGetText(
"error.upload_failed.long", "user.invite_status",
buffer, buffer,
sizeof(buffer), sizeof(buffer),
0, 2,
"Test File Name" "Dominic",
2
)); ));
printf("Retrieved localized string: %s\n", buffer); assertUnreachable(buffer);
// Run the initial script. // Run the initial script.
scriptcontext_t ctx; scriptcontext_t ctx;