From c12216f8b52eef01b2ab78468214bdcf95e8ff1b Mon Sep 17 00:00:00 2001 From: Gcat101 Date: Tue, 16 Apr 2024 23:09:21 +0300 Subject: [PATCH] add gen alpha meme lang (I am sorry) --- src/lang/_genalpha.json | 68 ++++++++++++++++++++++++++++++++++++++++ src/lib/HeaderBar.svelte | 27 +++++++++------- src/lib/stores.ts | 2 +- src/lib/utils.ts | 7 +++-- 4 files changed, 89 insertions(+), 15 deletions(-) create mode 100644 src/lang/_genalpha.json diff --git a/src/lang/_genalpha.json b/src/lang/_genalpha.json new file mode 100644 index 0000000..eb7e64e --- /dev/null +++ b/src/lang/_genalpha.json @@ -0,0 +1,68 @@ +{ + "name": "Gen Alpha Slang", + + "errors.something_went_wrong": "Something went sus", + "errors.package_not_found": "Here, have a grimace shake, if that makes you feel any more skibidi: 🥤", + "errors.package_not_found.details": "Zesty fact: You can use '@author:name' to view packages made by a sigma. What 'bout using '@details' to get yap on each package?", + "errors.no_packages_published": "Looks like you don't have any sus packages published to KJSPKG. Ratio!", + "errors.automatin_down": "Our statistics database is not giving skibidi vibes", + "errors.automatin_down.details": "Rizz and fanum tax counts might be missing. Please yap this out to", + "errors.automatin_down.server": "our Ohio server", + + "menu.language": "Yap", + "menu.theme": "Mewing", + + "list.by": "by sigma", + "list.detailed.on_branch": "on branch", + "list.detailed.at_path": "at path", + "list.detailed.in_repo": "in repo", + "list.download_singluar": "rizz", + "list.download_plural": "rizz", + "list.view_singular": "fanum tax", + "list.view_plural": "fanum tax", + + "author.owns": "has level", + "author.package_singular": "gyat", + "author.package_plural": "gyat", + "author.you": "drank grimace shake!", + "author.organizations": "Ohionizations", + + "author.auth_required": "To access this mid page, you have to first ratio yourself through GitHub.", + "author.auth_required.login": "Touch grass", + + "search.placeholder": "Glow-up some packages", + "search.package_singular": "gyat", + "search.package_plural": "gyat", + "search.found_singular": "Level %d", + "search.found_plural": "Level %d", + "search.matching": "giving", + "search.made_by": "made by sigma", + "search.detailed": "yapped out", + + "search.show_details": "Show more yap", + "search.clear_filters": "Gatekeep filters", + "search.use_view.list": "Use yap view", + "search.use_view.compact": "Use skibidi view", + + "search.sorted_by": "Looksmaxxing by", + "search.sort_type.name": "Ick (a-z)", + "search.sort_type.author": "Sigma name (a-z)", + "search.sort_type.downloads": "Rizz count", + "search.sort_type.views": "Fanum tax", + "search.sorted_by.name": "ick", + "search.sorted_by.author": "sigma name", + "search.sorted_by.downloads": "rizz", + "search.sorted_by.views": "fanum tax", + + "package.created_by": "Created by sigma", + "package.available_for": "Hits different for", + "package.manage_package": "Rizz up the package (click to copy)", + "package.readme_file": "Yapping file", + "package.package_preview": "Kai senat preview", + + "package.depends_on": "Simps for", + "package.incompatible_with": "Vibe checks", + "package.dependency.kjs_package": "Skibidi package", + "package.dependency.external_mod": "sus mod", + "package.dependency.mod_open_in": "See yap in" +} \ No newline at end of file diff --git a/src/lib/HeaderBar.svelte b/src/lib/HeaderBar.svelte index ab347a0..61ccf35 100644 --- a/src/lib/HeaderBar.svelte +++ b/src/lib/HeaderBar.svelte @@ -8,7 +8,7 @@ import consts from './consts'; import { contextMenu, type ContextMenuItem } from './overlays/contextMenu'; import { currentScrollPosition, currentSearchStore, langKeyStore, userPreferencesStore } from './stores'; - import { getLangKeys, getLangs, parseInputString } from './utils'; + import { getLangKeys, getLangs, memeLangCount, parseInputString } from './utils'; import { fly } from 'svelte/transition'; import IconLogin from './IconLogin.svelte'; @@ -19,6 +19,19 @@ let searched = getQuery(); let langs = getLangs(); + let langElements : ContextMenuItem[]; + $: langElements = Object.keys(langs).map(lang => { + return { + type: 'ITEM', + label: langs[lang], + icon: $userPreferencesStore.locale == lang ? IconCheck : IconBlank, + action: () => { + $userPreferencesStore.locale = lang; + $langKeyStore = getLangKeys(); + } + }; + }); + let inputElement: HTMLInputElement; afterNavigate(() => (searched = getQuery())); @@ -28,17 +41,7 @@ items: [ { type: 'SEPARATOR', header: $langKeyStore['menu.language'] }, - ...Object.keys(langs).map(lang => { - return { - type: 'ITEM' as const, - label: langs[lang], - icon: $userPreferencesStore.locale == lang ? IconCheck : IconBlank, - action: () => { - $userPreferencesStore.locale = lang; - $langKeyStore = getLangKeys(); - } - }; - }) + ...[...[...langElements.slice(0, 1), { type: 'SEPARATOR' }, ...langElements.slice(1, (memeLangCount ? -memeLangCount : undefined))], ...(memeLangCount ? [{ type: 'SEPARATOR' }, ...langElements.slice(-memeLangCount)] : [])] ] as ContextMenuItem[] }; $: themeContextMenu = { diff --git a/src/lib/stores.ts b/src/lib/stores.ts index b4b8df3..0094653 100644 --- a/src/lib/stores.ts +++ b/src/lib/stores.ts @@ -39,4 +39,4 @@ export const userPreferencesStore = localStorageStore<{ alreadyVisited: true }); -export const langKeyStore = writable<{ [key: string]: string }>(getLangKeys()) \ No newline at end of file +export const langKeyStore = writable<{ [key: string]: string }>(getLangKeys()); \ No newline at end of file diff --git a/src/lib/utils.ts b/src/lib/utils.ts index 98ee9cd..efebfa2 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -7,7 +7,7 @@ import { packageListStore, packageStatStore, packageStatusStore, userPreferences // @ts-expect-error full exists, thanks crappy types import { full as emoji } from 'markdown-it-emoji'; -const langs = import.meta.glob("../lang/*.json", { eager: true, import: 'default' }) +const langs = import.meta.glob('../lang/*.json', { eager: true, import: 'default' }) const md = markdownit({ html: false, xhtmlOut: false, @@ -21,9 +21,12 @@ const md = markdownit({ } }).use(emoji); +export let memeLangCount = 0; +Object.keys(langs).forEach(l => {if (l.startsWith("../lang/_")) memeLangCount++}); + export function getLangs(): { [key: string]: string } { let langsWithNames : { [key: string]: string } = {}; - for(let l of Object.keys(langs)) + for(let l of Object.keys(langs).sort((a, b) => a=='../lang/en-US.json' ? -1 : (b.startsWith('../lang/_') ? -1 : 0))) langsWithNames[l.split('/').at(-1)?.replace('.json', '') ?? ''] = (langs[l] as { [key: string]: string })['name']; return langsWithNames; }