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 17, 2024
1 parent a5a41aa commit fa410bb
Showing 1 changed file with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,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 @@ -276,7 +276,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 @@ -293,15 +293,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 fa410bb

Please sign in to comment.