createI18nPlugin.ts 617 B

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