mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-01 10:32:40 +00:00
plural test
This commit is contained in:
parent
ea4fc6d957
commit
8120b17c2d
18 changed files with 14731 additions and 14523 deletions
1817
po/furnace.pot
1817
po/furnace.pot
File diff suppressed because it is too large
Load diff
1820
po/pt_BR.po
1820
po/pt_BR.po
File diff suppressed because it is too large
Load diff
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue