<template>
  <pn-page-card>
    <template #title>
      {{ $t(title) }}
    </template>
    <pn-scroll-list>
      <markdown-viewver
        class="q-pa-md"
        :locale
        :documentName
      />
    </pn-scroll-list>
  </pn-page-card>
</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>
