mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-03-21 18:04:39 -05:00
Add Wales/Scotland/Northern Ireland/England to country selection Closes #1484
This commit is contained in:
parent
9edc6b363f
commit
64cea2abee
|
|
@ -110,6 +110,10 @@ export const COUNTRY_CODES = [
|
|||
"FR",
|
||||
"GA",
|
||||
"GB",
|
||||
"GB-ENG",
|
||||
"GB-NIR",
|
||||
"GB-SCT",
|
||||
"GB-WLS",
|
||||
"GD",
|
||||
"GE",
|
||||
"GF",
|
||||
|
|
|
|||
|
|
@ -994,3 +994,15 @@
|
|||
.twf-gb-wls {
|
||||
background-image: url("https://cdn.jsdelivr.net/gh/twitter/twemoji@14.0.2/assets/svg/1f3f4-e0067-e0062-e0077-e006c-e0073-e007f.svg");
|
||||
}
|
||||
|
||||
.twf-gb-eng {
|
||||
background-image: url("https://cdn.jsdelivr.net/gh/twitter/twemoji@14.0.2/assets/svg/1f3f4-e0067-e0062-e0065-e006e-e0067-e007f.svg");
|
||||
}
|
||||
|
||||
.twf-gb-sct {
|
||||
background-image: url("https://cdn.jsdelivr.net/gh/twitter/twemoji@14.0.2/assets/svg/1f3f4-e0067-e0062-e0073-e0063-e0074-e007f.svg");
|
||||
}
|
||||
|
||||
.twf-gb-nir {
|
||||
background-image: url("https://cdn.jsdelivr.net/gh/twitter/twemoji@14.0.2/assets/svg/1f1ec-1f1e7.svg");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,12 +10,12 @@ describe("countryCodeToTranslatedName()", () => {
|
|||
expect(result).toBe("Suomi");
|
||||
});
|
||||
|
||||
it("returns the country code if it contains a dash (Intl.DisplayNames throws)", () => {
|
||||
it("returns the country name in english if the code contains a dash", () => {
|
||||
const result = countryCodeToTranslatedName({
|
||||
countryCode: "GB-WLS",
|
||||
language: "en",
|
||||
language: "fi",
|
||||
});
|
||||
expect(result).toBe("GB-WLS");
|
||||
expect(result).toBe("Wales");
|
||||
});
|
||||
|
||||
it("returns the country code as is for unknown country", () => {
|
||||
|
|
|
|||
|
|
@ -21,10 +21,10 @@ export function countryCodeToTranslatedName({
|
|||
countryCode: string;
|
||||
language: string;
|
||||
}) {
|
||||
// known limitation, function cannot handle e.g. GB-WLS (Wales)
|
||||
if (countryCode.includes("-")) {
|
||||
return countryCode;
|
||||
}
|
||||
if (countryCode === "GB-WLS") return "Wales";
|
||||
if (countryCode === "GB-SCT") return "Scotland";
|
||||
if (countryCode === "GB-NIR") return "Northern Ireland";
|
||||
if (countryCode === "GB-ENG") return "England";
|
||||
|
||||
try {
|
||||
return (
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user