diff --git a/.vscode/extensions.json b/.vscode/extensions.json index a64db6a7..21dcc84c 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,6 +1,7 @@ { "recommendations": [ "svelte.svelte-vscode", - "bradlc.vscode-tailwindcss" + "bradlc.vscode-tailwindcss", + "inlang.vs-code-extension" ] } diff --git a/frontend/messages/dk.json b/frontend/messages/dk.json new file mode 100644 index 00000000..9887783a --- /dev/null +++ b/frontend/messages/dk.json @@ -0,0 +1,6 @@ +{ + "$schema": "https://inlang.com/schema/inlang-message-format", + "fontpageCustomize": "Tilpas din søgning med en", + "noOptic": "Ingen Optic", + "search": "Søg" +} diff --git a/frontend/messages/en.json b/frontend/messages/en.json new file mode 100644 index 00000000..4ea746df --- /dev/null +++ b/frontend/messages/en.json @@ -0,0 +1,6 @@ +{ + "$schema": "https://inlang.com/schema/inlang-message-format", + "fontpageCustomize": "Customise your search with an", + "noOptic": "No Optic", + "search": "Search" +} diff --git a/frontend/package.json b/frontend/package.json index 40eff060..c923dd3d 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -4,7 +4,7 @@ "private": true, "scripts": { "dev": "vite dev --port 8000", - "build": "vite build", + "build": "paraglide-js compile --project ./project.inlang && vite build", "preview": "vite preview", "test": "npm run test:integration && npm run test:unit", "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", @@ -13,12 +13,15 @@ "format": "prettier --plugin prettier-plugin-svelte --plugin prettier-plugin-tailwindcss --write .", "openapi": "abeye generate http://localhost:3000/beta/api/docs/openapi.json -t ts --api-prefix /beta/api -o src/lib/api/index.ts && prettier --write src/lib/api/index.ts", "test:integration": "playwright test", - "test:unit": "vitest" + "test:unit": "vitest", + "postinstall": "paraglide-js compile --project ./project.inlang" }, "devDependencies": { "@iconify-json/heroicons": "^1.1.16", "@iconify-json/simple-icons": "^1.1.84", "@iconify/svelte": "^3.1.6", + "@inlang/paraglide-js": "1.2.5", + "@inlang/paraglide-js-adapter-sveltekit": "^0.4.1", "@playwright/test": "^1.40.1", "@sveltejs/adapter-auto": "^3.0.0", "@sveltejs/adapter-node": "^2.0.0", @@ -60,4 +63,4 @@ "tailwind-merge": "^2.1.0", "ts-pattern": "^5.0.6" } -} \ No newline at end of file +} diff --git a/frontend/project.inlang/project_id b/frontend/project.inlang/project_id new file mode 100644 index 00000000..1677f072 --- /dev/null +++ b/frontend/project.inlang/project_id @@ -0,0 +1 @@ +b2415630c9f3bb80ed1eaf01298e0999c1f1feff7457a1490d51bed5b6fd4b91 \ No newline at end of file diff --git a/frontend/project.inlang/settings.json b/frontend/project.inlang/settings.json new file mode 100644 index 00000000..f2b85f31 --- /dev/null +++ b/frontend/project.inlang/settings.json @@ -0,0 +1,20 @@ +{ + "$schema": "https://inlang.com/schema/project-settings", + "sourceLanguageTag": "en", + "languageTags": [ + "en", + "dk" + ], + "modules": [ + "https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-empty-pattern@latest/dist/index.js", + "https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-identical-pattern@latest/dist/index.js", + "https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-missing-translation@latest/dist/index.js", + "https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-without-source@latest/dist/index.js", + "https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-valid-js-identifier@latest/dist/index.js", + "https://cdn.jsdelivr.net/npm/@inlang/plugin-message-format@latest/dist/index.js", + "https://cdn.jsdelivr.net/npm/@inlang/plugin-m-function-matcher@latest/dist/index.js" + ], + "plugin.inlang.messageFormat": { + "pathPattern": "./messages/{languageTag}.json" + } +} diff --git a/frontend/src/lib/components/OpticSelector.svelte b/frontend/src/lib/components/OpticSelector.svelte index 9ebf0e39..a8f816fb 100644 --- a/frontend/src/lib/components/OpticSelector.svelte +++ b/frontend/src/lib/components/OpticSelector.svelte @@ -3,6 +3,7 @@ import { opticsStore, opticsShowStore } from '$lib/stores'; import Select from './Select.svelte'; import { derived } from 'svelte/store'; + import * as m from '$paraglide/messages'; export let searchOnChange: boolean; export let selected = ''; @@ -19,7 +20,7 @@ const optics = derived(opticsStore, ($optics) => [...$optics, ...DEFAULT_OPTICS]); $: options = [ - { value: '', label: 'No Optic' }, + { value: '', label: m.noOptic() }, ...$optics .filter((optic) => $opticsShowStore[opticKey(optic)]) .map((optic) => ({ value: optic.url, label: optic.name })), @@ -31,7 +32,7 @@ form="searchbar-form" id="optics-selector" name="optic" - class="m-0 text-neutral-focus text-xs cursor-pointer" + class="m-0 cursor-pointer text-xs text-neutral-focus" submitOnChange={searchOnChange} bind:value={selected} {options} diff --git a/frontend/src/lib/components/Searchbar.svelte b/frontend/src/lib/components/Searchbar.svelte index 31e77abd..94305da9 100644 --- a/frontend/src/lib/components/Searchbar.svelte +++ b/frontend/src/lib/components/Searchbar.svelte @@ -8,6 +8,7 @@ import { compressRanked, rankingsToRanked } from '$lib/rankings'; import { twJoin } from 'tailwind-merge'; import { P, match } from 'ts-pattern'; + import * as m from '$paraglide/messages'; export let autofocus = false; @@ -93,12 +94,12 @@