MCPcopy Create free account
hub / github.com/fontsource/fontsource / subsetToLanguage

Function subsetToLanguage

website/app/utils/language/subsets.ts:2–30  ·  view source on GitHub ↗
(subset: string)

Source from the content-addressed store, hash-verified

1// A map of subset values which doesn't work with titlecase and is also options for the search bar
2export const subsetToLanguage = (subset: string) => {
3 switch (subset) {
4 case 'chinese-hongkong': {
5 return 'Chinese (Hong Kong)';
6 }
7 case 'chinese-simplified': {
8 return 'Chinese (Simplified)';
9 }
10 case 'chinese-traditional': {
11 return 'Chinese (Traditional)';
12 }
13 case 'cyrillic-ext': {
14 return 'Cyrillic Extended';
15 }
16 case 'greek-ext': {
17 return 'Greek Extended';
18 }
19 case 'latin-ext': {
20 return 'Latin Extended';
21 }
22 default: {
23 // Convert to titlecase and replace all dashes with spaces
24 return subset
25 .split('-')
26 .map((word) => word[0].toUpperCase() + word.slice(1))
27 .join(' ');
28 }
29 }
30};

Callers 2

transformSubsetsFunction · 0.90
Language.tsxFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected