Skip to content

Commit

Permalink
Fixes nextstrain#993 by creating separate translations for compound s…
Browse files Browse the repository at this point in the history
…entences
  • Loading branch information
crwilcox committed Mar 24, 2020
1 parent cd37494 commit 50dcef8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
24 changes: 16 additions & 8 deletions src/components/info/info.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,30 +69,38 @@ export const createSummary = (mainTreeNumTips, nodes, filters, visibility, visib
const sampledDateRange = getVisibleDateRange(nodes, visibility);

/* Number of genomes & their date range */
let summary = t(
"Showing {{nSelectedSamples}} of {{mainTreeNumTips}} genomes",
{nSelectedSamples: nSelectedSamples, mainTreeNumTips: mainTreeNumTips}
);
if (branchLengthsToDisplay !== "divOnly") {
summary += " " + t(
"sampled between {{from}} and {{to}}",
{from: styliseDateRange(sampledDateRange[0]), to: styliseDateRange(sampledDateRange[1])}
let summary = t(
"Showing {{nSelectedSamples}} of {{mainTreeNumTips}} genomes sampled between {{from}} and {{to}}.",
{
nSelectedSamples: nSelectedSamples, mainTreeNumTips: mainTreeNumTips,
from: styliseDateRange(sampledDateRange[0]), to: styliseDateRange(sampledDateRange[1])
}
);
} else {
let summary = t(
"Showing {{nSelectedSamples}} of {{mainTreeNumTips}} genomes.",
{
nSelectedSamples: nSelectedSamples, mainTreeNumTips: mainTreeNumTips,
}
);
}

/* parse filters */
const filterTextArr = [];
Object.keys(filters).forEach((filterName) => {
const n = Object.keys(visibleStateCounts[filterName]).length;
if (!n) return;
filterTextArr.push(`${n} ${pluralise(filterName, n)}`);
});
const prefix = branchLengthsToDisplay !== "divOnly" ? t("and comprising") : t("comprising");
const prefix = t("Comprising");
const filterText = arrayToSentence(filterTextArr, {prefix: prefix, capatalise: false});
if (filterText.length) {
summary += ` ${filterText}`;
} else {
summary += ". ";
}

return summary;
};

Expand Down
7 changes: 3 additions & 4 deletions src/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@
"Data updated": "Data updated",

"__info.js__": "########################################",
"Showing {{nSelectedSamples}} of {{mainTreeNumTips}} genomes": "Showing {{nSelectedSamples}} of {{mainTreeNumTips}} genomes",
"sampled between {{from}} and {{to}}": "sampled between {{from}} and {{to}}",
"and comprising": "and comprising",
"comprising": "comprising",
"Showing {{nSelectedSamples}} of {{mainTreeNumTips}} genomes.": "Showing {{nSelectedSamples}} of {{mainTreeNumTips}} genomes",
"Showing {{nSelectedSamples}} of {{mainTreeNumTips}} genomes sampled between {{from}} and {{to}}.": "Showing {{nSelectedSamples}} of {{mainTreeNumTips}} genomes sampled between {{from}} and {{to}}",
"Comprising": "Comprising",
"Animation in progress.": "Animation in progress.",
"Filtered to": "Filtered to",

Expand Down

0 comments on commit 50dcef8

Please sign in to comment.