Skip to content
This repository has been archived by the owner on Feb 25, 2024. It is now read-only.

Commit

Permalink
[Client] Declare Italian, Catalan and Chinese (traditional)
Browse files Browse the repository at this point in the history
  • Loading branch information
DjLeChuck committed Apr 23, 2017
1 parent 9375f2b commit a1e6db9
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 72 deletions.
89 changes: 19 additions & 70 deletions client/src/components/Layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,73 +12,24 @@ import NavDropdown from 'react-bootstrap/lib/NavDropdown';
import NavItem from 'react-bootstrap/lib/NavItem';
import Row from 'react-bootstrap/lib/Row';
import { IndexLinkContainer, LinkContainer } from 'react-router-bootstrap';
import flagAr from '../dependencies/img/flag-ar.png';
import flagCn from '../dependencies/img/flag-cn.png';
import flagDe from '../dependencies/img/flag-de.png';
import flagEn from '../dependencies/img/flag-en.png';
import flagEs from '../dependencies/img/flag-es.png';
import flagFr from '../dependencies/img/flag-fr.png';
import flagKo from '../dependencies/img/flag-ko.png';
import flagLv from '../dependencies/img/flag-lv.png';
import flagPt from '../dependencies/img/flag-pt.png';
import flagPtBR from '../dependencies/img/flag-pt_BR.png';
import flagPl from '../dependencies/img/flag-pl.png';
import flagRu from '../dependencies/img/flag-ru.png';
import flagUa from '../dependencies/img/flag-ua.png';

const languages = {
ar: {
flag: flagAr,
name: 'Argentina',
},
cn: {
flag: flagCn,
name: '中国语文',
},
de: {
flag: flagDe,
name: 'Deutsch',
},
en: {
flag: flagEn,
name: 'English',
},
es: {
flag: flagEs,
name: 'Español',
},
fr: {
flag: flagFr,
name: 'Français',
},
ko: {
flag: flagKo,
name: '한국말',
},
lv: {
flag: flagLv,
name: 'Latviešu',
},
pt: {
flag: flagPt,
name: 'Português',
},
'pt-BR': {
flag: flagPtBR,
name: 'Português brasileiro',
},
pl: {
flag: flagPl,
name: 'Język polski',
},
ru: {
flag: flagRu,
name: 'Русский',
},
ua: {
flag: flagUa,
name: 'українська мова',
},
ar: 'Argentina',
ca: 'Catalan',
cn: '中国语文',
de: 'Deutsch',
en: 'English',
es: 'Español',
fr: 'Français',
it: 'Italiano',
ko: '한국말',
lv: 'Latviešu',
pl: 'Język polski',
pt: 'Português',
'pt-BR': 'Português brasileiro',
ru: 'Русский',
ua: 'українська мова',
zh: '中國語文',
};

class Layout extends React.Component {
Expand All @@ -92,7 +43,7 @@ class Layout extends React.Component {
const { t, i18n } = this.props;
const toggle = lng => i18n.changeLanguage(lng);
let menuLanguages = [];
const CurrentFlag = languages[i18n.language || 'en'].flag;
const CurrentLang = languages[i18n.language || 'en'];
const versionStyle = {
position: 'absolute',
display: 'inline-block',
Expand All @@ -105,11 +56,10 @@ class Layout extends React.Component {
return false;
}

const { flag, name } = languages[locale];
const name = languages[locale];

menuLanguages.push(
<MenuItem key={locale} onClick={() => toggle(locale)}>
<img src={flag} alt={locale} />{' '}
{name}
</MenuItem>
);
Expand All @@ -129,8 +79,7 @@ class Layout extends React.Component {

<Navbar.Collapse>
<Nav pullLeft>
<NavDropdown title={<img src={CurrentFlag}
alt={i18n.language} />} id="language-switcher"
<NavDropdown title={CurrentLang} id="language-switcher"
className="pull-left locale-switcher">
{menuLanguages}
</NavDropdown>
Expand Down
4 changes: 2 additions & 2 deletions client/src/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ i18n
.use(LanguageDetector)
.init({
whitelist: [
'ar', 'cn', 'en', 'de', 'es', 'fr', 'ko', 'lv', 'pl', 'pt', 'pt-BR',
'ru', 'ua',
'ar', 'ca', 'cn', 'de', 'en', 'es', 'fr', 'it', 'ko', 'lv', 'pl', 'pt',
'pt-BR', 'ru', 'ua', 'zh',
],

fallbackLng: 'en',
Expand Down

0 comments on commit a1e6db9

Please sign in to comment.