Skip to content

Commit

Permalink
feat(lang): add Catalan to language picker (#1309)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheCatLady committed Mar 30, 2021
1 parent 72931f3 commit 77911c0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/components/Layout/LanguagePicker/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React, { useState, useRef, useContext } from 'react';
import Transition from '../../Transition';
import useClickOutside from '../../../hooks/useClickOutside';
import React, { useContext, useRef, useState } from 'react';
import { defineMessages, useIntl } from 'react-intl';
import {
LanguageContext,
AvailableLocales,
LanguageContext,
} from '../../../context/LanguageContext';
import { useIntl, defineMessages } from 'react-intl';
import useClickOutside from '../../../hooks/useClickOutside';
import Transition from '../../Transition';

const messages = defineMessages({
changelanguage: 'Change Language',
Expand All @@ -17,6 +17,10 @@ type AvailableLanguageObject = Record<
>;

const availableLanguages: AvailableLanguageObject = {
ca: {
code: 'ca',
display: 'Català',
},
de: {
code: 'de',
display: 'Deutsch',
Expand Down
1 change: 1 addition & 0 deletions src/context/LanguageContext.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { ReactNode } from 'react';

export type AvailableLocales =
| 'ca'
| 'de'
| 'en'
| 'es'
Expand Down
2 changes: 2 additions & 0 deletions src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import '../styles/globals.css';
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const loadLocaleData = (locale: AvailableLocales): Promise<any> => {
switch (locale) {
case 'ca':
return import('../i18n/locale/ca.json');
case 'de':
return import('../i18n/locale/de.json');
case 'es':
Expand Down

0 comments on commit 77911c0

Please sign in to comment.