utils.ts 402 B

123456789101112131415
  1. // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. import type { ObjectManagerFrontendAttribute } from '#shared/graphql/types.ts'
  3. import { i18n } from '#shared/i18n.ts'
  4. export const translateOption = (
  5. attribute: ObjectManagerFrontendAttribute,
  6. str?: string,
  7. ) => {
  8. if (!str) return ''
  9. if (attribute.dataOption.translate) {
  10. return i18n.t(str)
  11. }
  12. return str
  13. }