Skip to content

Commit

Permalink
Localizing book names
Browse files Browse the repository at this point in the history
  • Loading branch information
josephmyers committed Oct 21, 2024
1 parent f537905 commit ef00bad
Showing 1 changed file with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ export class DraftGenerationStepsComponent extends SubscriptionDisposable implem
book.number === currentGroup[currentGroup.length - 1]?.number + 1;
if (currentGroup.length > 0 && !isBookConsecutiveAndMatching) {
//process and reset current group
addGroup(currentGroup);
addGroup(currentGroup, this.i18n);
currentGroup.length = 0;
}
//add book to current group
Expand All @@ -272,7 +272,7 @@ export class DraftGenerationStepsComponent extends SubscriptionDisposable implem

//add last group
if (currentGroup.length > 0) {
addGroup(currentGroup);
addGroup(currentGroup, this.i18n);
}

const groupsCollapsed: TrainingGroup[] = [];
Expand All @@ -289,15 +289,12 @@ export class DraftGenerationStepsComponent extends SubscriptionDisposable implem

return groupsCollapsed;

function addGroup(group: TrainingBook[]): void {
function addGroup(group: TrainingBook[], i18n: I18nService): void {
let range;
if (group.length === 1) {
range = Canon.bookNumberToEnglishName(group[0].number);
range = i18n.localizeBook(group[0].number);
} else {
range =
Canon.bookNumberToEnglishName(group[0].number) +
' - ' +
Canon.bookNumberToEnglishName(group[group.length - 1].number);
range = i18n.localizeBook(group[0].number) + ' - ' + i18n.localizeBook(group[group.length - 1].number);
}
continguousGroups.push({ ranges: [range], source: group[0].source, target: group[0].target });
}
Expand Down

0 comments on commit ef00bad

Please sign in to comment.