Skip to content

Instantly share code, notes, and snippets.

View psideris89's full-sized avatar
πŸ“
πŸ‡¬πŸ‡§ πŸ‡¬πŸ‡·

Panos Sideris psideris89

πŸ“
πŸ‡¬πŸ‡§ πŸ‡¬πŸ‡·
View GitHub Profile
@psideris89
psideris89 / i18n.js
Created March 1, 2020 14:26
i18n.js from react-i18n-demo
import i18n from 'i18next';
import Backend from 'i18next-xhr-backend';
import LanguageDetector from 'i18next-browser-languagedetector';
import { initReactI18next } from 'react-i18next';
i18n
.use(Backend)
.use(LanguageDetector)
.use(initReactI18next)
.init({
@psideris89
psideris89 / Language.js
Created March 1, 2020 14:25
Language.js from react-i18n-demo
import { FormControl, MenuItem, Select } from '@material-ui/core';
import React, { useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useHistory } from 'react-router-dom';
const Language = () => {
const history = useHistory();
const { i18n } = useTranslation();
const [dropdownLang, setDropdownLang] = useState(i18n.language || 'en');
@psideris89
psideris89 / Flag.js
Created March 1, 2020 14:24
Flag.js from react-i18n-demo
import React from 'react';
import { useTranslation } from 'react-i18next';
const Flag = () => {
const { i18n } = useTranslation();
const flagSvg = require(`./${i18n.language}.svg`);
return <img style={{ maxWidth: '50%' }} src={flagSvg} alt="flag" />;
};
@psideris89
psideris89 / Intro.js
Created March 1, 2020 14:21
Intro.js from rect-i18n-demo
import React from 'react';
import { useTranslation } from 'react-i18next';
const Intro = () => {
const { t } = useTranslation();
return <h1>{t('intro-title')}</h1>;
};
export default Intro;
@psideris89
psideris89 / App.js
Last active March 1, 2020 14:19
App.js from react-i18n-demo
import React, { Suspense } from 'react';
import Intro from './components/Intro/Intro';
import Flag from './components/Flag/Flag';
import Language from './components/Language/Language';
import './App.css';
const App = () => {
return (
<Suspense fallback={<p>Loading Translations ...</p>}>
<div className="App">
@psideris89
psideris89 / index.js
Created March 1, 2020 14:12
index.js from react-i18n-demo
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import { BrowserRouter, Route } from 'react-router-dom';
import * as serviceWorker from './serviceWorker';
import './i18n';
@psideris89
psideris89 / .vimrc
Created June 24, 2018 11:17 — forked from simonista/.vimrc
A basic .vimrc file that will serve as a good template on which to build.
" Don't try to be vi compatible
set nocompatible
" Helps force plugins to load correctly when it is turned back on below
filetype off
" TODO: Load plugins here (pathogen or vundle)
" Turn on syntax highlighting
syntax on