fix: handle apostrophes for names ending in x (#4343)
* fix: handle apostrophes for names ending in x * review --------- Co-authored-by: Alexandr <qwerty541zxc@gmail.com>
This commit is contained in:
1 parent
b0b14091e7
commit
ea6ef1124d
2 files changed
+2
-4
No files matched your search
+1
-3
@@ -254,9 +254,7 @@ const renderStatsCard = (stats, options = {}) => {
|
|||||||
theme,
|
theme,
|
||||||
});
|
});
|
||||||
|
|
||||||
const apostrophe = ["x", "s"].includes(name.slice(-1).toLocaleLowerCase())
|
const apostrophe = /s$/i.test(name.trim()) ? "" : "s";
|
||||||
? ""
|
|
||||||
: "s";
|
|
||||||
const i18n = new I18n({
|
const i18n = new I18n({
|
||||||
locale,
|
locale,
|
||||||
translations: statCardLocales({ name, apostrophe }),
|
translations: statCardLocales({ name, apostrophe }),
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ describe("Test renderStatsCard", () => {
|
|||||||
document.body.innerHTML = renderStatsCard({ ...stats, name: "Felix" });
|
document.body.innerHTML = renderStatsCard({ ...stats, name: "Felix" });
|
||||||
|
|
||||||
expect(document.getElementsByClassName("header")[0].textContent).toBe(
|
expect(document.getElementsByClassName("header")[0].textContent).toBe(
|
||||||
"Felix' GitHub Stats",
|
"Felix's GitHub Stats",
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user