From 1870f3fdf43707a15fda0f609a021f516f45eb63 Mon Sep 17 00:00:00 2001
From: Piotr Russ <mail@pruss.it>
Date: Wed, 18 Nov 2020 23:15:38 +0100
Subject: finish auth routes, create cookie token, fix folder structure, add
 context to FE

---
 client/src/admin/hocs/WithTranslation.jsx | 11 +++++++++++
 1 file changed, 11 insertions(+)
 create mode 100644 client/src/admin/hocs/WithTranslation.jsx

(limited to 'client/src/admin/hocs/WithTranslation.jsx')

diff --git a/client/src/admin/hocs/WithTranslation.jsx b/client/src/admin/hocs/WithTranslation.jsx
new file mode 100644
index 0000000..b31b7c9
--- /dev/null
+++ b/client/src/admin/hocs/WithTranslation.jsx
@@ -0,0 +1,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;
-- 
cgit v1.2.3

