createI18nPlugin.ts 620 B

1234567891011121314151617181920
  1. // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. import { createI18nPlugin as formKitCreateI18nPlugin } from '@formkit/i18n'
  3. import { reactive } from 'vue'
  4. import loadLocales from '#shared/form/i18n/locales.ts'
  5. import { getValidationRuleMessages } from './createValidationPlugin.ts'
  6. import type { FormKitPlugin } from '@formkit/core'
  7. const createI18nPlugin = (): FormKitPlugin => {
  8. const staticLocale = reactive(loadLocales())
  9. Object.assign(staticLocale.validation, getValidationRuleMessages())
  10. return formKitCreateI18nPlugin({ staticLocale })
  11. }
  12. export default createI18nPlugin