(subset: string)
| 1 | // A map of subset values which doesn't work with titlecase and is also options for the search bar |
| 2 | export 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 | }; |
no outgoing calls
no test coverage detected