plural test

This commit is contained in:
tildearrow 2024-06-04 18:09:18 -05:00
parent ea4fc6d957
commit 8120b17c2d
18 changed files with 14731 additions and 14523 deletions

1817
po/de.po

File diff suppressed because it is too large Load diff

1817
po/es.po

File diff suppressed because it is too large Load diff

1817
po/fi.po

File diff suppressed because it is too large Load diff

1817
po/fr.po

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

1817
po/hy.po

File diff suppressed because it is too large Load diff

1816
po/ko.po

File diff suppressed because it is too large Load diff

1817
po/nl.po

File diff suppressed because it is too large Load diff

1821
po/pl.po

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

1821
po/ru.po

File diff suppressed because it is too large Load diff

1818
po/sk.po

File diff suppressed because it is too large Load diff

1964
po/sv.po

File diff suppressed because it is too large Load diff

1817
po/th.po

File diff suppressed because it is too large Load diff

1817
po/tr.po

File diff suppressed because it is too large Load diff

1818
po/uk.po

File diff suppressed because it is too large Load diff

View file

@ -35,6 +35,7 @@ static float oscDebugMin=-1.0;
static float oscDebugMax=1.0;
static float oscDebugPower=1.0;
static int oscDebugRepeat=1;
static int numApples=1;
static void _drawOsc(const ImDrawList* drawList, const ImDrawCmd* cmd) {
if (cmd!=NULL) {
@ -713,6 +714,13 @@ void FurnaceGUI::drawDebug() {
}
ImGui::TreePop();
}
#ifdef HAVE_LOCALE
if (ImGui::TreeNode("Plural Form Test")) {
ImGui::InputInt("Number",&numApples);
ImGui::Text(ngettext("%d apple","%d apples",numApples),numApples);
ImGui::TreePop();
}
#endif
if (ImGui::TreeNode("User Interface")) {
if (ImGui::Button("Inspect")) {
inspectorOpen=!inspectorOpen;

View file

@ -851,5 +851,18 @@ const char* momo_ngettext(const char* str1, const char* str2, unsigned long amou
// TODO: implement
// gettext("") and take plural form metadata...
// then I don't know how are plural strings stored
return str1;
unsigned int plural=runStackMachine(curDomain->pluralProgram,256,amount);
// TODO: optimize
for (size_t i=curDomain->firstString[(unsigned char)(str[0])]; i<curDomain->stringCount; i++) {
if (strcmp(curDomain->stringPtr[i],str1)==0) {
const char* ret=curDomain->transPtr[i];
for (unsigned int j=0; j<plural; j++) {
ret+=strlen(ret)+1;
}
return ret;
}
}
if (amount==1) return str1;
return str2;
}