chore: Adding i18n support
This commit is contained in:
parent
fd9a752677
commit
629b26d30f
9 changed files with 121 additions and 58 deletions
14
package-lock.json
generated
14
package-lock.json
generated
|
|
@ -2625,6 +2625,20 @@
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18"
|
"node": ">=18"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"node_modules/yaml": {
|
||||||
|
"version": "2.8.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.0.tgz",
|
||||||
|
"integrity": "sha512-4lLa/EcQCB0cJkyts+FpIRx5G/llPxfP6VQU5KByHEhLxY3IJCH0f0Hy1MHI8sClTvsIb8qwRJ6R/ZdlDJ/leQ==",
|
||||||
|
"license": "ISC",
|
||||||
|
"optional": true,
|
||||||
|
"peer": true,
|
||||||
|
"bin": {
|
||||||
|
"yaml": "bin.mjs"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 14.6"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
46
src/App.vue
46
src/App.vue
|
|
@ -2,33 +2,37 @@
|
||||||
<div class="min-h-screen flex flex-col" style="gap: 4rem;"><!-- Main application wrapper -->
|
<div class="min-h-screen flex flex-col" style="gap: 4rem;"><!-- Main application wrapper -->
|
||||||
<!-- <SideBar /> -->
|
<!-- <SideBar /> -->
|
||||||
|
|
||||||
<h1 class="title has-text-black p-6">BRÅTULA VIOSSA.NET MÅDE</h1>
|
<section class="section">
|
||||||
|
<h1 class="title has-text-black p-6">BRÅTULA VIOSSA.NET MÅDE</h1>
|
||||||
|
</section>
|
||||||
|
|
||||||
<PaddingWrapper v-for="(sectionName, index) in sectionList" :key="index">
|
<section class="section">
|
||||||
<component :is="sectionName" />
|
<HomeSectionWrapper
|
||||||
</PaddingWrapper>
|
v-for="(section, index) in sectionList"
|
||||||
|
:key="index"
|
||||||
|
:title="section.title"
|
||||||
|
:text="section.text"
|
||||||
|
:image="section.image"
|
||||||
|
:alt="section.alt"
|
||||||
|
:reverse="index % 2 !== 0"
|
||||||
|
/>
|
||||||
|
</section>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script setup lang="ts">
|
||||||
// import SideBar from './components/organisms/SideBar.vue'
|
// import SideBar from './components/organisms/SideBar.vue'
|
||||||
import PaddingWrapper from './components/molecules/PaddingWrapper.vue'
|
import HomeSectionWrapper from './components/molecules/HomeSectionWrapper.vue'
|
||||||
import IntroSection from './components/organisms/IntroSection.vue'
|
|
||||||
import HistorySection from './components/organisms/HistorySection.vue'
|
|
||||||
import './assets/style.scss'
|
import './assets/style.scss'
|
||||||
import 'bulma/css/bulma.css'
|
import 'bulma/css/bulma.css'
|
||||||
|
import { useI18n } from 'vue-i18n'
|
||||||
|
import type { MessageSchema } from './i18n/types'
|
||||||
|
import { computed } from 'vue'
|
||||||
|
|
||||||
export default {
|
const { tm } = useI18n()
|
||||||
name: 'app',
|
const sectionList = computed<MessageSchema['sections']>(() => tm('sections'))
|
||||||
components: {
|
|
||||||
PaddingWrapper,
|
console.log(sectionList.value)
|
||||||
IntroSection,
|
|
||||||
HistorySection
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
sectionList: ['IntroSection', 'HistorySection']
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
48
src/components/molecules/HomeSectionWrapper.vue
Normal file
48
src/components/molecules/HomeSectionWrapper.vue
Normal file
|
|
@ -0,0 +1,48 @@
|
||||||
|
<template>
|
||||||
|
<div class="box my-6 px-4 py-5">
|
||||||
|
|
||||||
|
<div v-if="image" class="columns is-vcentered">
|
||||||
|
|
||||||
|
<template v-if="reverse">
|
||||||
|
<div class="column">
|
||||||
|
<h2 class="title is-4">{{ title }}</h2>
|
||||||
|
<p class="has-text-white">{{ text }}</p>
|
||||||
|
</div>
|
||||||
|
<div class="column is-one-quarter">
|
||||||
|
<figure class="image">
|
||||||
|
<img :src="image" :alt="alt" />
|
||||||
|
</figure>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template v-else>
|
||||||
|
<div class="column is-one-quarter">
|
||||||
|
<figure class="image">
|
||||||
|
<img :src="image" :alt="alt" />
|
||||||
|
</figure>
|
||||||
|
</div>
|
||||||
|
<div class="column">
|
||||||
|
<h2 class="title is-4">{{ title }}</h2>
|
||||||
|
<p class="has-text-white">{{ text }}</p>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-else class="is-vcentered">
|
||||||
|
<h2 class="title is-4">{{ title }}</h2>
|
||||||
|
<p class="has-text-white">{{ text }}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
defineProps({
|
||||||
|
title: String,
|
||||||
|
text: String,
|
||||||
|
image: String,
|
||||||
|
alt: String,
|
||||||
|
reverse: Boolean,
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
<template>
|
|
||||||
<div class="columns is-vcentered">
|
|
||||||
|
|
||||||
<!-- Text Column (left 3/4) -->
|
|
||||||
<div class="column">
|
|
||||||
<h2 class="title is-4">Viossa's History</h2>
|
|
||||||
<p class="has-text-white">Knock over christmas tree... If it fits i sits, jump five feet high and sideways when a shadow moves, rub face on owner and sometimes switches in french and say "miaou" just because well why not. Good morning sunshine, pet a cat, rub its belly, endure blood and agony, quietly weep, keep rubbing belly. Chase ball of string stares at human while pushing stuff off a table ooooh feather moving feather! jump up to edge of bath, fall in then scramble in a mad panic to get out slap kitten brother with paw for chase mice. Have a lot of grump in yourself because you can't forget to be grumpy and not be like king grumpy cat mmmmmmmmmeeeeeeeeooooooooowwwwwwww but cough furball into food bowl then scratch owner for a new one. Scream at teh bath open the door, let me out, let me out, let me-out, let me-aow, let meaow, meaow!</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Image Column (right 1/4) -->
|
|
||||||
<div class="column is-one-quarter">
|
|
||||||
<figure class="image">
|
|
||||||
<img src="/src/assets/flakka.png" alt="Flag of the Viossa Language">
|
|
||||||
</figure>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
<template>
|
|
||||||
<div class="columns is-vcentered">
|
|
||||||
|
|
||||||
<!-- Image Column (left 1/4) -->
|
|
||||||
<div class="column is-one-quarter">
|
|
||||||
<figure class="image">
|
|
||||||
<img src="/src/assets/flakka.png" alt="Flag of the Viossa Language">
|
|
||||||
</figure>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Text Column (right 3/4) -->
|
|
||||||
<div class="column">
|
|
||||||
<h2 class="title is-4">What is Viossa?</h2>
|
|
||||||
<p class="has-text-white">Cat ipsum dolor sit amet, be superior eats owners hair then claws head gimme attention gimme attention gimme attention gimme attention gimme attention gimme attention just kidding i don't want it anymore meow bye. Avoid the new toy and just play with the box it came in floof tum, tickle bum, jellybean footies curly toes curl up and sleep on the freshly laundered towels hiss and stare at nothing then run suddenly away. Need to check on human, have not seen in an hour might be dead oh look, human is alive, hiss at human, feed me attack the dog then pretend like nothing happened jump on human and sleep on her all night long be long in the bed, purr in the morning and then give a bite to every human around for not waking up request food, purr loud scratch the walls, the floor, the windows, the humans eat prawns daintily with a claw then lick paws clean wash down prawns with a lap of carnation milk then retire to the warmest spot on the couch to claw at the fabric before taking a catnap steal raw zucchini off kitchen counter...</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
14
src/i18n/index.ts
Normal file
14
src/i18n/index.ts
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
import { createI18n } from 'vue-i18n'
|
||||||
|
import en_US from '../locales/en_US'
|
||||||
|
import type { MessageSchema } from './types'
|
||||||
|
|
||||||
|
const i18n = createI18n<[MessageSchema], 'en_US'>({
|
||||||
|
legacy: false,
|
||||||
|
locale: 'en_US',
|
||||||
|
fallbackLocale: 'en_US',
|
||||||
|
messages: {
|
||||||
|
en_US: en_US
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
export default i18n
|
||||||
2
src/i18n/types.ts
Normal file
2
src/i18n/types.ts
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
import en_US from '../locales/en_US'
|
||||||
|
export type MessageSchema = typeof en_US
|
||||||
16
src/locales/en_US.ts
Normal file
16
src/locales/en_US.ts
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
export default {
|
||||||
|
"sections": [
|
||||||
|
{
|
||||||
|
"title": "What is Viossa?",
|
||||||
|
"text": "Cat ipsum dolor sit amet, be superior eats owners hair then claws head gimme attention gimme attention gimme attention gimme attention gimme attention gimme attention just kidding i don't want it anymore meow bye. Avoid the new toy and just play with the box it came in floof tum, tickle bum, jellybean footies curly toes curl up and sleep on the freshly laundered towels hiss and stare at nothing then run suddenly away. Need to check on human, have not seen in an hour might be dead oh look, human is alive, hiss at human, feed me attack the dog then pretend like nothing happened jump on human and sleep on her all night long be long in the bed, purr in the morning and then give a bite to every human around for not waking up request food, purr loud scratch the walls, the floor, the windows, the humans eat prawns daintily with a claw then lick paws clean wash down prawns with a lap of carnation milk then retire to the warmest spot on the couch to claw at the fabric before taking a catnap steal raw zucchini off kitchen counter...",
|
||||||
|
"image": "/src/assets/flakka.png",
|
||||||
|
"alt": "Flag of the Viossa Language"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "History of Viossa",
|
||||||
|
"text": "Knock over christmas tree... If it fits i sits, jump five feet high and sideways when a shadow moves, rub face on owner and sometimes switches in french and say \"miaou\" just because well why not. Good morning sunshine, pet a cat, rub its belly, endure blood and agony, quietly weep, keep rubbing belly. Chase ball of string stares at human while pushing stuff off a table ooooh feather moving feather! jump up to edge of bath, fall in then scramble in a mad panic to get out slap kitten brother with paw for chase mice. Have a lot of grump in yourself because you can't forget to be grumpy and not be like king grumpy cat mmmmmmmmmeeeeeeeeooooooooowwwwwwww but cough furball into food bowl then scratch owner for a new one. Scream at teh bath open the door, let me out, let me out, let me-out, let me-aow, let meaow, meaow!",
|
||||||
|
"image": "/src/assets/flakka.png",
|
||||||
|
"alt": "Flag of the Viossa Language"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import { createApp } from 'vue'
|
import { createApp } from 'vue'
|
||||||
import './style.css'
|
import './style.css'
|
||||||
import App from './App.vue'
|
import App from './App.vue'
|
||||||
|
import i18n from './i18n'
|
||||||
|
|
||||||
createApp(App).mount('#app')
|
createApp(App).use(i18n).mount('#app')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue