digitalfabrik/integreat-app

View on GitHub
translations/src/loadTranslations.ts

Summary

Maintainability
A
0 mins
Test Coverage
import { deepmerge } from 'deepmerge-ts'

import defaultTranslations from '../translations.json'
import transformTranslations from './transformTranslations'
import { TranslationsType, TransformedTranslationsType } from './types'

const loadTranslations = (translationsOverride?: TranslationsType): TransformedTranslationsType => {
  const translations = translationsOverride
    ? deepmerge(defaultTranslations as TranslationsType, translationsOverride)
    : defaultTranslations
  return transformTranslations(translations)
}

export default loadTranslations