Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swiss German #15

Merged
merged 2 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@
<option value="tr-TR" data-text="tr-TR">Turkish</option>
<option value="zh-CN" data-text="zh-CN">Simplified Chinese</option>
<option value="zh-TW" data-text="zh-TW">Traditional Chinese</option>
<option value="de-CH" data-text="de-CH">Swiss German</option>
</select>
</span>
<span>
Expand Down
2 changes: 2 additions & 0 deletions src/modules/grid/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import caES from './locales/ca-ES';
import ruRU from './locales/ru-RU';
import zhCN from './locales/zh-CN';
import zhTW from './locales/zh-TW';
import deCH from './locales/de-CH';

const TEST_CASES: Record<Locale, Record<string, string>> = {
'en-US': enUS.examples,
Expand All @@ -38,6 +39,7 @@ const TEST_CASES: Record<Locale, Record<string, string>> = {
'ru-RU': ruRU.examples,
'zh-CN': zhCN.examples,
'zh-TW': zhTW.examples,
'de-CH': deCH.examples,
};

describe('getWordsKeys', () =>
Expand Down
99 changes: 99 additions & 0 deletions src/modules/grid/locales/de-CH.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
import { CommonWords, LocaleGridConfig, WordKeys } from '../../../types';

const grid = [
'ESKISCHAFÜF', // 0-10: ES, ISCH, FÜF
'VIERTUBFZÄÄ', // 11-21: VIERTU, ZWÄNZG
'ZWÄNZGSIVOR', // 22-32: ZWÄNZG, SI, VOR
'ABOHAUBIEPM', // 33-43: AB, HAUBI, PM
'EISZWÖISDRÜ', // 44-54: EIS, ZWÖI, DRÜ
'VIERIFÜFIQT', // 55-65: VIERI, FÜFI
'SÄCHSISIBNI', // 66-76: SÄCHSI, SIBNI
'ACHTINÜNIEL', // 77-87: ACHTI, NÜNI
'ZÄNIERBEUFI', // 88-98: ZÄNI, BEUFI
'ZWÖUFIAMUHR', // 99-109: ZWÖUFI, UHR
];

const commonWords: CommonWords = {
ONE: [44, 45, 46], // EIS
TWO: [47, 48, 49, 50], // ZWÖI
THREE: [52, 53, 54], // DRÜ
FOUR: [55, 56, 57, 58], // VIERI
FIVE: [60, 61, 62], // FÜF
SIX: [66, 67, 68, 69, 70, 71], // SÄCHSI
SEVEN: [72, 73, 74, 75, 76], // SIBNI
EIGHT: [77, 78, 79, 80, 81], // ACHTI
NINE: [82, 83, 84, 85], // NÜNI
TEN: [88, 89, 90, 91], // ZÄNI
ELEVEN: [92, 93, 94], // ELF
TWELVE: [99, 100, 101, 102, 103, 104], // ZWÖUFI
FIVE_MIN: [8, 9, 10], // FÜF
TEN_MIN: [19, 20, 21], // ZÄÄ
QUARTER_MIN: [11, 12, 13, 14, 15, 16], // VIERTU
TWENTY_MIN: [22, 23, 24, 25, 26, 27], // ZWÄNZG
TWENTYFIVE_MIN: [
[8, 9, 10], // FÜF
[22, 23, 24, 25, 26], // ZWÄNZG
],
HALF: [36, 37, 38, 39, 40], // HAUBI
};

const localeWords = {
ES: [0, 1], // ES
ISCH: [3, 4, 5, 6], // ISCH
VOR: [30, 31, 32], // VOR
AB: [33, 34], // AB (AFTER)
HAUBI: [33, 34, 35, 36], // HAUBI (HALF)
UHR: [107, 108, 109], // UHR (O'CLOCK)
};

function getLocaleWordKeys(_hours: number, minutes: number) {
const wordKeys: WordKeys<typeof localeWords>[] = [];

// "ES" and "ISCH" are always included in the phrase
wordKeys.push('ES', 'ISCH');

if (minutes >= 35) {
wordKeys.push('VOR');
} else if (minutes >= 5 && minutes < 30) {
wordKeys.push('AB');
}

// if (minutes >= 25 && minutes < 35) wordKeys.push('HAUBI'); // Half-past logic
if (minutes < 5) wordKeys.push('UHR'); // Exact hour

return wordKeys;
}

export default {
grid,
getLocaleWordKeys,
clockWords: {
...commonWords,
...localeWords,
},
secondaryChars: [0, 1, 3, 4, 5, 6],
fuzzyDictionary: {
uhr: 'Uhr',
},
examples: {
'01:00': 'ES ISCH EIS UHR', // Exact hour
'01:05': 'ES ISCH FÜF AB EIS', // 5 past 1
'01:10': 'ES ISCH ZÄÄ AB EIS', // 10 past 1
'01:15': 'ES ISCH VIERTU AB EIS', // Quarter past 1
'01:20': 'ES ISCH ZWÄNZG AB EIS', // 20 past 1
'01:25': 'ES ISCH FÜF ZWÄNZ AB EIS', // 25 past 1
'01:30': 'ES ISCH HAUBI EIS', // Half-past 1
'01:35': 'ES ISCH FÜF ZWÄNZ VOR ZWÖI', // 5 past half 2
'01:40': 'ES ISCH ZWÄNZG VOR ZWÖI', // 20 to 2
'01:45': 'ES ISCH VIERTU VOR ZWÖI', // Quarter to 2
'01:50': 'ES ISCH ZÄÄ VOR ZWÖI', // 10 to 2
'01:55': 'ES ISCH FÜF VOR ZWÖI', // 5 to 2
'02:00': 'ES ISCH ZWÖI UHR', // Exact hour
'07:30': 'ES ISCH HAUBI SIBNI', // Half-past 7
'10:00': 'ES ISCH ZÄNI UHR', // Exact hour
'12:00': 'ES ISCH ZWÖUFI UHR', // Noon
'12:30': 'ES ISCH HAUBI ZWÖUFI', // Half-past 12
'17:05': 'ES ISCH FÜF AB FÜF', // 5 past 5
'20:26': 'ES ISCH FÜF ZWÄNZ AB ACHTI', // 5 before half-past 8
},
} satisfies LocaleGridConfig;
2 changes: 2 additions & 0 deletions src/modules/grid/locales/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import caES from './ca-ES';
import ruRU from './ru-RU';
import zhCN from './zh-CN';
import zhTW from './zh-TW';
import deCH from './de-CH';

const LOCALE_CONFIG: Record<Locale, LocaleGridConfig> = {
'en-US': enUS,
Expand All @@ -35,6 +36,7 @@ const LOCALE_CONFIG: Record<Locale, LocaleGridConfig> = {
'ru-RU': ruRU,
'zh-CN': zhCN,
'zh-TW': zhTW,
'de-CH': deCH,
};

export function getLocaleConfig(locale: Locale) {
Expand Down
100 changes: 100 additions & 0 deletions src/strings/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"crossword": "Crossword",
"cs-CZ": "Čeština (cs-CZ)",
"dark": "Dark",
"de-CH": "Schweizerdeutsch (de-CH)",
"de-DE": "Deutsch (de-DE)",
"default_font": "Default",
"document_title": "Word O’Clock",
Expand Down Expand Up @@ -97,6 +98,7 @@
"crossword": "Crucigrama",
"cs-CZ": "Čeština (cs-CZ)",
"dark": "Oscuro",
"de-CH": "Schweizerdeutsch (de-CH)",
"de-DE": "Deutsch (de-DE)",
"default_font": "Por defecto",
"document_title": "Word O’Clock",
Expand Down Expand Up @@ -179,6 +181,7 @@
"crossword": "Palavras cruzadas",
"cs-CZ": "Čeština (cs-CZ)",
"dark": "Escuro",
"de-CH": "Schweizerdeutsch (de-CH)",
"de-DE": "Deutsch (de-DE)",
"default_font": "Default",
"document_title": "Word O’Clock",
Expand Down Expand Up @@ -261,6 +264,7 @@
"crossword": "Mots croisés",
"cs-CZ": "Čeština (cs-CZ)",
"dark": "Sombre",
"de-CH": "Schweizerdeutsch (de-CH)",
"de-DE": "Deutsch (de-DE)",
"default_font": "Défaut",
"document_title": "Word O’Clock",
Expand Down Expand Up @@ -343,6 +347,7 @@
"crossword": "Cruciverba",
"cs-CZ": "Čeština (cs-CZ)",
"dark": "Scuro",
"de-CH": "Schweizerdeutsch (de-CH)",
"de-DE": "Deutsch (de-DE)",
"default_font": "Predefinito",
"document_title": "Word O’Clock",
Expand Down Expand Up @@ -425,6 +430,7 @@
"crossword": "Σταυρόλεξο",
"cs-CZ": "Čeština (cs-CZ)",
"dark": "Σκοτάδι",
"de-CH": "Schweizerdeutsch (de-CH)",
"de-DE": "Deutsch (de-DE)",
"default_font": "Αθέτηση",
"document_title": "Word O’Clock",
Expand Down Expand Up @@ -507,6 +513,7 @@
"crossword": "Kreuzworträtsel",
"cs-CZ": "Čeština (cs-CZ)",
"dark": "Dunkel",
"de-CH": "Schweizerdeutsch (de-CH)",
"de-DE": "Deutsch (de-DE)",
"default_font": "Standard",
"document_title": "Literaturuhr",
Expand Down Expand Up @@ -589,6 +596,7 @@
"crossword": "Kruiswoordraadsel",
"cs-CZ": "Čeština (cs-CZ)",
"dark": "Donker",
"de-CH": "Schweizerdeutsch (de-CH)",
"de-DE": "Deutsch (de-DE)",
"default_font": "Standaard",
"document_title": "Word O’Clock",
Expand Down Expand Up @@ -671,6 +679,7 @@
"crossword": "Korsord",
"cs-CZ": "Čeština (cs-CZ)",
"dark": "Mörk",
"de-CH": "Schweizerdeutsch (de-CH)",
"de-DE": "Deutsch (de-DE)",
"default_font": "Standard",
"document_title": "Word O’Clock",
Expand Down Expand Up @@ -753,6 +762,7 @@
"crossword": "Kryssord",
"cs-CZ": "Čeština (cs-CZ)",
"dark": "Mørk",
"de-CH": "Schweizerdeutsch (de-CH)",
"de-DE": "Deutsch (de-DE)",
"default_font": "Misligholde",
"document_title": "Word O’Clock",
Expand Down Expand Up @@ -835,6 +845,7 @@
"crossword": "Křížovka",
"cs-CZ": "Čeština (cs-CZ)",
"dark": "Tma",
"de-CH": "Schweizerdeutsch (de-CH)",
"de-DE": "Deutsch (de-DE)",
"default_font": "Výchozí",
"document_title": "Word O’Clock",
Expand Down Expand Up @@ -917,6 +928,7 @@
"crossword": "Bulmaca",
"cs-CZ": "Čeština (cs-CZ)",
"dark": "Karanlık",
"de-CH": "Schweizerdeutsch (de-CH)",
"de-DE": "Deutsch (de-DE)",
"default_font": "Varsayılan",
"document_title": "Word O’Clock",
Expand Down Expand Up @@ -999,6 +1011,7 @@
"crossword": "Cuvinte încrucişate",
"cs-CZ": "Čeština (cs-CZ)",
"dark": "Întuneric",
"de-CH": "Schweizerdeutsch (de-CH)",
"de-DE": "Deutsch (de-DE)",
"default_font": "Implicit",
"document_title": "Word O’Clock",
Expand Down Expand Up @@ -1081,6 +1094,7 @@
"crossword": "Malsons",
"cs-CZ": "Čeština (cs-CZ)",
"dark": "Fosc",
"de-CH": "Schweizerdeutsch (de-CH)",
"de-DE": "Deutsch (de-DE)",
"default_font": "Per defecte",
"document_title": "Word O’Clock",
Expand Down Expand Up @@ -1163,6 +1177,7 @@
"crossword": "Кроссворд",
"cs-CZ": "Čeština (cs-CZ)",
"dark": "Темный",
"de-CH": "Schweizerdeutsch (de-CH)",
"de-DE": "Deutsch (de-DE)",
"default_font": "По умолчанию",
"document_title": "Word O’Clock",
Expand Down Expand Up @@ -1245,6 +1260,7 @@
"crossword": "填字游戏",
"cs-CZ": "Čeština (cs-CZ)",
"dark": "黑暗的",
"de-CH": "Schweizerdeutsch (de-CH)",
"de-DE": "Deutsch (de-DE)",
"default_font": "默认",
"document_title": "Word O’Clock",
Expand Down Expand Up @@ -1327,6 +1343,7 @@
"crossword": "填字遊戲",
"cs-CZ": "Čeština (cs-CZ)",
"dark": "黑暗的",
"de-CH": "Schweizerdeutsch (de-CH)",
"de-DE": "Deutsch (de-DE)",
"default_font": "預設",
"document_title": "Word O’Clock",
Expand Down Expand Up @@ -1392,5 +1409,88 @@
"zen_mode_title": "刪除分散您注意力的一切",
"zh-CN": "简体中文 (zh-CN)",
"zh-TW": "傳統中文 (zh-TW)"
},
"de-CH": {
"add_quote": "Zitat hinzufügen",
"anaglyph": "Anaglyph",
"author": "Autor",
"base": "Basis",
"blue": "Blau",
"bohemian": "Böhmisch",
"ca-ES": "Calalan (ca-ES)",
"color": "Zufällige Farben",
"colors": "Farben",
"copy_mode": "Kopieren",
"copy_mode_copied": "Zitat kopiert!",
"copy_title": "In die Zwischenablage kopieren",
"crossword": "Kreuzworträtsel",
"cs-CZ": "Čeština (cs-CZ)",
"dark": "Dunkel",
"de-CH": "Schweizerdeutsch (de-CH)",
"de-DE": "Deutsch (de-DE)",
"default_font": "Standard",
"document_title": "Literaturuhr",
"dots": "Punkte",
"download": "Herunterladen",
"dynamic": "Dynamisch",
"el-GR": "Ελληνικά (el-GR)",
"elegant": "Elegant",
"en-US": "English (en-US)",
"es-ES": "Español (es-ES)",
"exit_zen_title": "Zen-Modus beenden",
"fade_mode": "Einblenden",
"festive": "Festlich",
"focus_mode": "Fokus",
"font": "Schriftart",
"fr-FR": "Français (fr-FR)",
"frame": "Rahmen",
"fullscreen_mode": "Vollbildmodus",
"fuzzy_mode": "Fuzzy",
"gray": "Gray",
"green": "Grün",
"handwriting": "Handschrift",
"it-IT": "Italiano (it-IT)",
"kindle": "Kindle",
"language": "Sprache",
"light": "Licht",
"made_by": "Hergestellt von",
"mini": "Kleines Netz",
"nl-NL": "Nederlands (nl-NL)",
"no-NO": "Norsk (no-NO)",
"numbers": "Zahlen",
"orange": "Orange",
"photo": "Foto",
"pink": "Rosa",
"poster": "Poster",
"progressbar_mode": "Fortschrittsbalken anzeigen/ausblenden",
"project": "Projekt",
"pt-PT": "Português (pt-PT)",
"purple": "Lila",
"rainbow": "Regenbogen",
"random": "Zufällige Sprache",
"report_error": "Fehler melden",
"retro": "Retro",
"ro-RO": "România (ro-RO)",
"ru-RU": "Русский (ru-RU)",
"screensaver_mode": "Bildschirmschoner",
"share": "Teilen",
"solid": "Solide",
"subtle": "Subtil",
"sv-SE": "Svensk (sv-SE)",
"system": "System",
"terminal": "Terminal",
"theme": "Thema",
"themes": "Themen",
"time_mode": "Zeit anzeigen",
"title": "Titel",
"tr-TR": "Türkçe (tr-TR)",
"whatsapp": "Whatsapp",
"work_mode": "Arbeit",
"work_mode_title": "Nur sichere Zitate für die Arbeit anzeigen",
"x": "X",
"zen_mode": "Zen",
"zen_mode_title": "Entferne alles, was dich ablenkt",
"zh-CN": "简体中文 (zh-CN)",
"zh-TW": "傳統中文 (zh-TW)"
}
}
1 change: 1 addition & 0 deletions src/strings/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export type Translations = {
crossword: string;
'cs-CZ': string;
dark: string;
'de-CH': string;
'de-DE': string;
default_font: string;
document_title: string;
Expand Down