Skip to content

Commit

Permalink
Localizing book names
Browse files Browse the repository at this point in the history
  • Loading branch information
josephmyers committed Nov 6, 2024
1 parent e2b8b5c commit 6599736
Showing 1 changed file with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,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 @@ -275,7 +275,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 @@ -292,15 +292,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 6599736

Please sign in to comment.