Skip to content

Commit

Permalink
Moved localizaton to getRepeatText
Browse files Browse the repository at this point in the history
  • Loading branch information
shubham1g5 committed Aug 21, 2024
1 parent 272bd77 commit 2a8ed9f
Showing 1 changed file with 1 addition and 20 deletions.
21 changes: 1 addition & 20 deletions src/main/java/org/commcare/formplayer/api/json/PromptToJson.java
Original file line number Diff line number Diff line change
Expand Up @@ -133,26 +133,7 @@ public static JSONObject parseQuestionType(FormEntryModel model, JSONObject obj)

private static String getRepeatAddText(FormEntryCaption prompt) {
boolean hasRepetitions = prompt.getNumRepetitions() > 0;
String addText = prompt.getRepeatText(hasRepetitions ? "add" : "add-empty");

if (!StringUtils.isEmpty(addText)) {
return addText;
}

String promptText = prompt.getLongText();
if (hasRepetitions) {
try {
return Localization.get("repeat.dialog.add.another", promptText);
} catch (NoLocalizedTextException e) {
return "Add another " + promptText;
}
} else {
try {
return Localization.get("repeat.dialog.add.new", promptText);
} catch (NoLocalizedTextException e) {
return "Add a new " + promptText;
}
}
return prompt.getRepeatText(hasRepetitions ? "add" : "add-empty");
}

private static void parseRepeatJuncture(FormEntryModel model, JSONObject obj, FormIndex ix) {
Expand Down

0 comments on commit 2a8ed9f

Please sign in to comment.