+
+
+
+
diff --git a/src/components/Button.svelte b/src/components/Button.vue
similarity index 63%
rename from src/components/Button.svelte
rename to src/components/Button.vue
index 429c6c6..621b8e5 100644
--- a/src/components/Button.svelte
+++ b/src/components/Button.vue
@@ -1,18 +1,18 @@
-
+
+
diff --git a/src/components/Slideshow.vue b/src/components/Slideshow.vue
new file mode 100644
index 0000000..4957fc3
--- /dev/null
+++ b/src/components/Slideshow.vue
@@ -0,0 +1,156 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/components/Svg.svelte b/src/components/Svg.vue
similarity index 65%
rename from src/components/Svg.svelte
rename to src/components/Svg.vue
index 21d407c..5648b8e 100644
--- a/src/components/Svg.svelte
+++ b/src/components/Svg.vue
@@ -1,4 +1,4 @@
-
-
+
-{#if type === "connector"}
-
diff --git a/src/components/index.js b/src/components/index.js
index 642ee71..0f35e89 100644
--- a/src/components/index.js
+++ b/src/components/index.js
@@ -1,14 +1,14 @@
// layout components
-export { default as Container } from './layout/Container.svelte'
-export { default as Card } from './layout/Card.svelte'
-export { default as Stack } from './layout/Stack.svelte'
-export { default as Grid } from './layout/Grid.svelte'
-export { default as Center } from './layout/Center.svelte'
-export { default as Section } from './layout/Section.svelte'
+export { default as Container } from './layout/Container.vue'
+export { default as Card } from './layout/Card.vue'
+export { default as Stack } from './layout/Stack.vue'
+export { default as Grid } from './layout/Grid.vue'
+export { default as Center } from './layout/Center.vue'
+export { default as Section } from './layout/Section.vue'
// components
-export { default as Button } from './Button.svelte'
-export { default as Dropdown } from './Dropdown.svelte'
-export { default as Slideshow } from './Slideshow.svelte'
-export { default as Svg } from './Svg.svelte'
-export { default as Image } from './Image.svelte'
+export { default as Button } from './Button.vue'
+export { default as Dropdown } from './Dropdown.vue'
+export { default as Slideshow } from './Slideshow.vue'
+export { default as Svg } from './Svg.vue'
+export { default as Image } from './Image.vue'
diff --git a/src/components/layout/Card.svelte b/src/components/layout/Card.vue
similarity index 82%
rename from src/components/layout/Card.svelte
rename to src/components/layout/Card.vue
index 469ac29..610c1ad 100644
--- a/src/components/layout/Card.svelte
+++ b/src/components/layout/Card.vue
@@ -1,10 +1,9 @@
-
-{#if href}
-
- {@render children?.()}
+
+
+
+
-{:else}
-
+
+
+
+
diff --git a/src/lib/i18n.js b/src/lib/i18n.js
index 387ee9e..5a91d73 100644
--- a/src/lib/i18n.js
+++ b/src/lib/i18n.js
@@ -1,103 +1,65 @@
-import { writable } from 'svelte/store';
+import { onScopeDispose, ref, watch } from 'vue';
import { getLanguageFromRoute } from '../routes';
const localeModules = import.meta.glob('./locales/*/*.json');
-// Get initial language from URL or localStorage
function getInitialLanguage() {
if (typeof window === 'undefined') return 'est';
-
- const path = window.location.pathname;
- const langFromRoute = getLanguageFromRoute(path);
-
- // If we detected a language from route, use it and save it
+
+ const langFromRoute = getLanguageFromRoute(window.location.pathname);
if (langFromRoute) {
localStorage.setItem('language', langFromRoute);
return langFromRoute;
}
-
- // Otherwise use saved language or default to 'est'
+
return localStorage.getItem('language') || 'est';
}
-const initialLang = getInitialLanguage();
-
-export const currentLang = writable(initialLang);
-
-// Store for translations
-export const text = writable({});
+export const currentLang = ref(getInitialLanguage());
+export const text = ref({});
async function loadTranslations(lang) {
try {
const translations = {};
-
- // Dynamically import all translation files for the specific language
- // Vite will code-split these and only bundle the ones actually used
- for (const path in localeModules) {
- if (path.includes(`/locales/${lang}/`) || path.includes(`\\locales\\${lang}\\`)) {
- const module = await localeModules[path]();
- Object.assign(translations, module.default || module);
- }
- }
-
- text.set(translations);
+ const matchingModules = Object.entries(localeModules).filter(([path]) =>
+ path.includes(`/locales/${lang}/`),
+ );
+ const modules = await Promise.all(matchingModules.map(([, loader]) => loader()));
+ modules.forEach((module) => Object.assign(translations, module.default || module));
+ text.value = translations;
} catch (error) {
console.error(`Failed to load translations for ${lang}:`, error);
+ text.value = {};
}
}
-loadTranslations(initialLang);
+watch(currentLang, loadTranslations, { immediate: true });
-/**
- * Create a translation store that only loads one page file per language.
- * Example: createPageTextStore('Home') -> ./locales/est/Home.json or ./locales/en/Home.json
- */
-export function createPageTextStore(pageName) {
- const pageText = writable({});
-
- async function loadPageTranslations(lang) {
+export function usePageText(pageName) {
+ const pageText = ref({});
+ const stop = watch(currentLang, async (lang) => {
try {
- const filePath = `./locales/${lang}/${pageName}.json`;
- const loader = localeModules[filePath];
-
- if (!loader) {
- pageText.set({});
- return;
- }
-
- const module = await loader();
- pageText.set(module.default || module);
+ const loader = localeModules[`./locales/${lang}/${pageName}.json`];
+ const module = loader ? await loader() : null;
+ pageText.value = module?.default || module || {};
} catch (error) {
console.error(`Failed to load ${pageName} translations for ${lang}:`, error);
- pageText.set({});
+ pageText.value = {};
}
- }
+ }, { immediate: true });
- const unsubscribe = currentLang.subscribe((lang) => {
- loadPageTranslations(lang);
- });
-
- return {
- subscribe: pageText.subscribe,
- destroy: unsubscribe,
- };
+ onScopeDispose(stop);
+ return pageText;
}
export function switchLang(lang) {
- currentLang.set(lang);
- loadTranslations(lang);
- if (typeof window !== 'undefined') {
- localStorage.setItem('language', lang);
- }
+ currentLang.value = lang;
+ if (typeof window !== 'undefined') localStorage.setItem('language', lang);
}
-// Update language when route changes
if (typeof window !== 'undefined') {
window.addEventListener('popstate', () => {
- const path = window.location.pathname;
- const lang = getLanguageFromRoute(path);
- if (lang) {
- switchLang(lang);
- }
+ const lang = getLanguageFromRoute(window.location.pathname);
+ if (lang) switchLang(lang);
});
-}
\ No newline at end of file
+}
diff --git a/src/lib/index.js b/src/lib/index.js
index 46cfaea..bb08385 100644
--- a/src/lib/index.js
+++ b/src/lib/index.js
@@ -1,5 +1,5 @@
export { navigate, goBack, reload, getPath, getQuery, switchLanguageRoute } from './router/router.js';
-export { default as Router } from './router/Router.svelte';
+export { default as Router } from './router/Router.vue';
-export { currentLang, text, switchLang, createPageTextStore } from './i18n.js';
-export { getLangText } from './langHelpers.js';
\ No newline at end of file
+export { currentLang, text, switchLang, usePageText } from './i18n.js';
+export { getLangText } from './langHelpers.js';
diff --git a/src/lib/router/Router.svelte b/src/lib/router/Router.svelte
deleted file mode 100644
index 51ceebe..0000000
--- a/src/lib/router/Router.svelte
+++ /dev/null
@@ -1,73 +0,0 @@
-
-
-
-
-
-{#if CurrentComponent}
-
-{/if}
diff --git a/src/lib/router/Router.vue b/src/lib/router/Router.vue
new file mode 100644
index 0000000..966f3e7
--- /dev/null
+++ b/src/lib/router/Router.vue
@@ -0,0 +1,53 @@
+
+
+
+
+
diff --git a/src/main.js b/src/main.js
index 458c7a8..bb90c33 100644
--- a/src/main.js
+++ b/src/main.js
@@ -1,9 +1,8 @@
-import { mount } from 'svelte'
+import { createApp } from 'vue'
import './app.css'
-import App from './App.svelte'
+import App from './App.vue'
-const app = mount(App, {
- target: document.getElementById('app'),
-})
+const app = createApp(App)
+app.mount('#app')
export default app
diff --git a/src/routes/AboutUs.svelte b/src/routes/AboutUs.svelte
deleted file mode 100644
index 7782af6..0000000
--- a/src/routes/AboutUs.svelte
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
-
In development...
-
Põhikiri siia?
-
-
\ No newline at end of file
diff --git a/src/routes/AboutUs.vue b/src/routes/AboutUs.vue
new file mode 100644
index 0000000..c248efd
--- /dev/null
+++ b/src/routes/AboutUs.vue
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
diff --git a/src/routes/Home.svelte b/src/routes/Home.vue
similarity index 67%
rename from src/routes/Home.svelte
rename to src/routes/Home.vue
index 54fb80a..115e5bc 100644
--- a/src/routes/Home.svelte
+++ b/src/routes/Home.vue
@@ -1,26 +1,22 @@
-
+
- {$text["hero"]?.description || "MTÜ Lapikud on Tallinna Tehnikaülikooli Tarkvaraarendusklubi, mis ühendab endisi ja praegusi IT huvilisi tudengeid."}
+ {{ text.hero?.description || "MTÜ Lapikud on Tallinna Tehnikaülikooli Tarkvaraarendusklubi, mis ühendab endisi ja praegusi IT huvilisi tudengeid." }}
{$text["services"]?.helpdesk?.description || "HELPDESK on MTÜ Lapikute poolt pakutav arvutiabiteenus. Teenus on suunatud tudengitele, õppejõududele ning kõikidele huvilistele."}
{{ text.services?.helpdesk?.description || "HELPDESK on MTÜ Lapikute poolt pakutav arvutiabiteenus. Teenus on suunatud tudengitele, õppejõududele ning kõikidele huvilistele." }}
- {$text["intro"]?.subtitle || "Valik projekte, mida meie liikmed on teostanud, veebilehtedest mobiilirakendusteni."}
+ {{ text.intro?.subtitle || "Valik projekte, mida meie liikmed on teostanud, veebilehtedest mobiilirakendusteni." }}
- {$text["cta"]?.description || "Võta ühendust ja arutame, kuidas saame sinu ideed ellu viia!"}
+ {{ text.cta?.description || "Võta ühendust ja arutame, kuidas saame sinu ideed ellu viia!" }}
@@ -107,92 +104,93 @@
-
{$text["portfolio"]?.label || "Tehtud tööd"}
-
{$text["portfolio"]?.title || "Projektid, mis räägivad enda eest."}
+
{{ text.portfolio?.label || "Tehtud tööd" }}
+
{{ text.portfolio?.title || "Projektid, mis räägivad enda eest." }}
- {$text["portfolio"]?.subtitle || "Igal projektil on oma lugu. Siin on valik töödest, mida meie liikmed on aastate jooksul ellu viinud."}
+ {{ text.portfolio?.subtitle || "Igal projektil on oma lugu. Siin on valik töödest, mida meie liikmed on aastate jooksul ellu viinud." }}