// src/composables/useLocale.ts
import { useI18n } from "vue-i18n";
import { computed } from "vue";

/**
 * useLocale composable:
 * - Provides the current locale from vue-i18n.
 * - Returns a computed `path` that prefixes URLs with /en for English locale.
 * - Helps route components generate localized links.
 */

// Return localized path and current locale reference
export function useLocale() {
  const { locale } = useI18n();
  const path = computed(() => (locale.value === "en" ? "/en/" : "/"));
  return { path };
}
