Skip to content

Commit

Permalink
chore: i18n: exports octuple locales and locale type (#684)
Browse files Browse the repository at this point in the history
* chore: i18n: exports octuple locales and locale type

* chore: i18n: moves locale to separate entry

* chore: i18n: apply structure
  • Loading branch information
dkilgore-eightfold committed Aug 10, 2023
1 parent af91b66 commit a724f80
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/components/ConfigProvider/ConfigProvider.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import Upload, { UploadProps } from '../Upload';
import dayjs, { Dayjs } from 'dayjs';

// locales
import type { Locale as OcLocale } from '../LocaleProvider'; // Need to alias because story name declaration conflicts with the type
import csCZ from '../Locale/cs_CZ'; // čeština
import daDK from '../Locale/da_DK'; // Dansk
import deDE from '../Locale/de_DE'; // Deutsch
Expand Down Expand Up @@ -787,10 +788,10 @@ const snackArgs: Object = {

const Locale_Story: ComponentStory<typeof ConfigProvider> = (args) => {
const [_, updateArgs] = useArgs();
const [locale, setLocale] = useState(enUS);
const [locale, setLocale] = useState<OcLocale>(enUS);
const [localeValue, setLocaleValue] = useState<string>('en_US');

const locales: Record<string, any> = {
const locales: Record<string, OcLocale> = {
cs_CZ: csCZ,
da_DK: daDK,
de_DE: deDE,
Expand Down
77 changes: 77 additions & 0 deletions src/locale.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import type { Locale } from './components/LocaleProvider';

// Supported locales
import csCZ from './components/Locale/cs_CZ'; // čeština
import daDK from './components/Locale/da_DK'; // Dansk
import deDE from './components/Locale/de_DE'; // Deutsch
import elGR from './components/Locale/el_GR'; // Ελληνικά
import enGB from './components/Locale/en_GB'; // English (United Kingdom)
import enUS from './components/Locale/en_US'; // English (United States)
import esES from './components/Locale/es_ES'; // Español
import esDO from './components/Locale/es_DO'; // Español (Dominican Republic)
import esMX from './components/Locale/es_MX'; // Español (Mexico)
import fiFI from './components/Locale/fi_FI'; // Suomi
import frBE from './components/Locale/fr_BE'; // Français (Belgium) TODO: dayjs has no fr_BE locale, use fr
import frCA from './components/Locale/fr_CA'; // Français (Canada)
import frFR from './components/Locale/fr_FR'; // Français
import heIL from './components/Locale/he_IL'; // עברית
import hiIN from './components/Locale/hi_IN'; // हिंदी
import hrHR from './components/Locale/hr_HR'; // Hrvatski
import htHT from './components/Locale/ht_HT'; // Haitian
import huHU from './components/Locale/hu_HU'; // Magyar
import itIT from './components/Locale/it_IT'; // Italiano
import jaJP from './components/Locale/ja_JP'; // 日本語
import koKR from './components/Locale/ko_KR'; // 한국어
import msMY from './components/Locale/ms_MY'; // Bahasa melayu
import nbNO from './components/Locale/nb_NO'; // Norsk
import nlBE from './components/Locale/nl_BE'; // Nederlands (Belgium)
import nlNL from './components/Locale/nl_NL'; // Nederlands
import plPL from './components/Locale/pl_PL'; // Polski
import ptBR from './components/Locale/pt_BR'; // Português (Brazil)
import ptPT from './components/Locale/pt_PT'; // Português
import ruRU from './components/Locale/ru_RU'; // Pусский
import svSE from './components/Locale/sv_SE'; // Svenska
import thTH from './components/Locale/th_TH'; // ภาษาไทย
import trTR from './components/Locale/tr_TR'; // Türkçe
import ukUA from './components/Locale/uk_UA'; // Yкраїнська
import zhCN from './components/Locale/zh_CN'; // 中文 (简体)
import zhTW from './components/Locale/zh_TW'; // 中文 (繁體)

export {
Locale,
csCZ,
daDK,
deDE,
elGR,
enGB,
enUS,
esES,
esDO,
esMX,
fiFI,
frBE,
frCA,
frFR,
heIL,
hiIN,
hrHR,
htHT,
huHU,
itIT,
jaJP,
koKR,
msMY,
nbNO,
nlBE,
nlNL,
plPL,
ptBR,
ptPT,
ruRU,
svSE,
thTH,
trTR,
ukUA,
zhCN,
zhTW,
};
1 change: 1 addition & 0 deletions webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
module.exports = (_, { mode }) => ({
entry: {
octuple: [path.resolve(__dirname, 'src/octuple.ts')],
locale: [path.resolve(__dirname, 'src/locale.ts')],
},
module: {
rules: [
Expand Down

0 comments on commit a724f80

Please sign in to comment.