createI18nPlugin.ts 611 B

1234567891011121314151617
  1. // Copyright (C) 2012-2023 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'
  6. import { getValidationRuleMessages } from './createValidationPlugin'
  7. const createI18nPlugin = (): FormKitPlugin => {
  8. const staticLocale = reactive(loadLocales())
  9. Object.assign(staticLocale.validation, getValidationRuleMessages())
  10. return formKitCreateI18nPlugin({ staticLocale })
  11. }
  12. export default createI18nPlugin