<template>
  <pn-page-template>
    <template #title>
      {{ $t(title) }}
    </template>

    <markdown-viewver
      class="q-px-md"
      :locale
      :documentName
    />
  </pn-page-template>
</template>

<script setup lang="ts">
  import { ref, onMounted } from 'vue'
  import { useSettingsStore } from 'stores/settings'
  import MarkdownViewver from 'components/MarkdownViewver.vue'

  defineProps<{
    title: string
    documentName: string
  }>()

  const settingsStore = useSettingsStore()
  const DEFAULT_LOCALE = 'ru'
  const locale = ref('ru')
 
  const parseLocale = (locale: string) => locale.split(/[-_]/)[0] || DEFAULT_LOCALE

  onMounted(() => {
    locale.value = parseLocale(settingsStore.settings.locale)
  })
</script>

<style>
</style>
