diff --git a/.gitignore b/.gitignore index eba2373..6197273 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .idea .vitepress/dist +.vitepress/.temp .vitepress/cache node_modules \ No newline at end of file diff --git a/.vitepress/components/TagChip.vue b/.vitepress/components/TagChip.vue new file mode 100644 index 0000000..fac86d8 --- /dev/null +++ b/.vitepress/components/TagChip.vue @@ -0,0 +1,25 @@ + + + \ No newline at end of file diff --git a/.vitepress/components/TagFilter.vue b/.vitepress/components/TagFilter.vue index e327db1..bfa175e 100644 --- a/.vitepress/components/TagFilter.vue +++ b/.vitepress/components/TagFilter.vue @@ -2,6 +2,7 @@ import {ref} from "vue"; import {computed} from "vue"; import {data} from "../software.data.js"; +import TagChip from "./TagChip.vue"; const props = defineProps({ modelValue: { @@ -39,14 +40,12 @@ const allTags = computed(() => { @update:modelValue="$emit('update:modelValue', $event)" multiple > - - {{ tag }} - + /> diff --git a/.vitepress/components/TagTile.vue b/.vitepress/components/TagTile.vue index cb3dda2..3549b86 100755 --- a/.vitepress/components/TagTile.vue +++ b/.vitepress/components/TagTile.vue @@ -34,12 +34,11 @@
- - {{ tag }} - + :tag="tag" + />
@@ -54,6 +53,7 @@ import {computed} from "vue"; import {data} from '../software.data.js' import {withBase} from "vitepress"; import SoftwareImageAvatar from "./SoftwareImageAvatar.vue"; +import TagChip from "./TagChip.vue"; const props = defineProps({ tagNames: { diff --git a/.vitepress/components/Translator.ts b/.vitepress/components/Translator.ts new file mode 100644 index 0000000..00d84fc --- /dev/null +++ b/.vitepress/components/Translator.ts @@ -0,0 +1,35 @@ +import {useData} from "vitepress"; +import {messages} from "../theme/enhancements/i18n/i18n"; + +export function useTranslator() { + + const FALLBACK_LANG = 'en'; + const TRANSLATION_KEY_JSON_PATH_SEPARATOR = '.'; + + const { lang } = useData(); + + function t(translationKey: String): String { + let langMap; + + if(Object.keys(messages).indexOf(lang.value) != -1) { + langMap = messages[lang.value]; + } else { + langMap = messages[FALLBACK_LANG]; + } + + let result = langMap; + + translationKey.split(TRANSLATION_KEY_JSON_PATH_SEPARATOR ).forEach(key => { + if(result.hasOwnProperty(key)) { + result = result[key]; + } else { + result = translationKey; + } + }); + + return result; + } + + // expose managed state as return value + return { t } +} \ No newline at end of file diff --git a/.vitepress/theme/enhancements/i18n/i18n.ts b/.vitepress/theme/enhancements/i18n/i18n.ts new file mode 100644 index 0000000..15b4c7d --- /dev/null +++ b/.vitepress/theme/enhancements/i18n/i18n.ts @@ -0,0 +1,9 @@ +import { deMessages } from "./lang/de"; +import { enMessages } from "./lang/en"; + +export const DEFAULT_LANG = "en"; + +export const messages = { + de: deMessages, + en: enMessages +} \ No newline at end of file diff --git a/.vitepress/theme/enhancements/i18n/lang/de.ts b/.vitepress/theme/enhancements/i18n/lang/de.ts new file mode 100644 index 0000000..b6e4267 --- /dev/null +++ b/.vitepress/theme/enhancements/i18n/lang/de.ts @@ -0,0 +1,24 @@ +import { localizedMessagesType } from "../utility/types"; + +export const deMessages: localizedMessagesType = { + tags: { + cicd: "CI/CD", + cms: "CMD", + client: "Client", + eigenentwicklung: 'Eigenentwicklung', + foss: "FOSS", + infrastruktur: "Infrastruktur", + keycloak: "Keycloak", + kooperation: "Kooperation", + monitoring: "Monitoring", + opencore: "Opencore", + opengovernment: "Open Government", + refarchinfrastruktur: "RefArch Infrastruktur", + server: "Server", + schnittstelle: "Schnittstelle", + sponsor: "Sponsor", + support: "Support", + todo: "todo", + webanwendung: "Webanwendung" + } +}; \ No newline at end of file diff --git a/.vitepress/theme/enhancements/i18n/lang/en.ts b/.vitepress/theme/enhancements/i18n/lang/en.ts new file mode 100644 index 0000000..0ab518d --- /dev/null +++ b/.vitepress/theme/enhancements/i18n/lang/en.ts @@ -0,0 +1,24 @@ +import { localizedMessagesType } from "../utility/types"; + +export const enMessages: localizedMessagesType = { + tags: { + cicd: "CI/CD", + cms: "CMS", + client: "Client", + eigenentwicklung: 'Inhouse', + foss: "FOSS", + infrastruktur: "Infrastructure", + keycloak: "Keycloak", + kooperation: "Cooperation", + monitoring: "Monitoring", + opencore: "Opencore", + opengovernment: "Open Government", + refarchinfrastruktur: "RefArch Infrastructure", + server: "Server", + schnittstelle: "Interface", + sponsor: "Sponsor", + support: "Support", + todo: "todo", + webanwendung: "Web-App" + } +}; \ No newline at end of file diff --git a/.vitepress/theme/enhancements/i18n/utility/tags.ts b/.vitepress/theme/enhancements/i18n/utility/tags.ts new file mode 100644 index 0000000..0d8dabc --- /dev/null +++ b/.vitepress/theme/enhancements/i18n/utility/tags.ts @@ -0,0 +1,24 @@ +export const TAG_PROP = "tags"; + +export interface Tags { + [TAG_PROP]: { + cicd: string, + cms: string, + client: string, + eigenentwicklung: string, + foss: string, + infrastruktur: string, + keycloak: string, + kooperation: string, + monitoring: string, + opencore: string, + opengovernment: string, + refarchinfrastruktur: string, + server: string, + schnittstelle: string, + sponsor: string, + support: string, + todo: string, + webanwendung: string, + } +} \ No newline at end of file diff --git a/.vitepress/theme/enhancements/i18n/utility/types.ts b/.vitepress/theme/enhancements/i18n/utility/types.ts new file mode 100644 index 0000000..e84bf62 --- /dev/null +++ b/.vitepress/theme/enhancements/i18n/utility/types.ts @@ -0,0 +1,4 @@ +import { DefaultLocaleMessageSchema } from "vue-i18n"; +import { Tags } from "./tags"; + +export type localizedMessagesType = DefaultLocaleMessageSchema & Tags; \ No newline at end of file