summaryrefslogtreecommitdiffstats
path: root/client/src/admin/hocs/WithTranslation.jsx
blob: b31b7c983739a111201f4deed11a68ecd266cbb7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
import React, {useContext} from 'react';
import Context from '../context';
import { translations, fallbackLanguage } from '../data/translations';

const WithTranslation = (key) => {
  const { lang } = useContext(Context);

  return translations[lang][key] || translations[fallbackLanguage][key];
};

export default WithTranslation;