import { computed } from 'vue';

import { createSharedComposable } from '@vueuse/core';

import { getMessages } from './messages';

export const useSimpleLocale = createSharedComposable(() => {
  const $t = computed(() => {
    const localeMessages = getMessages();
    return (key: string) => {
      return localeMessages[key] || key;
    };
  });
  return {
    $t,
  };
});
