Skip to content

Commit

Permalink
feat(article): add mix language
Browse files Browse the repository at this point in the history
  • Loading branch information
surmon-china committed Sep 5, 2023
1 parent 1617b52 commit 7fa201a
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/constants/article/language.tsx
Expand Up @@ -4,28 +4,35 @@
*/

import React from 'react'
import * as Icon from '@ant-design/icons'

// 文章语言: https://github.com/surmon-china/nodepress/blob/main/src/constants/biz.constant.ts#L8
// language: https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
export enum ArticleLanguage {
English = 'en', // English
Chinese = 'zh' // 简体中文
Chinese = 'zh', // 简体中文
Mixed = 'mix' // 多语言混合
}

const EmojiIcon: React.FC<{ emoji: string }> = ({ emoji }) => {
return <span style={{ transform: 'scale(1.3)', display: 'inline-block' }}>{emoji}</span>
}

const articleLanguageMap = new Map(
[
{
id: ArticleLanguage.Chinese,
name: '中文',
icon: <Icon.GlobalOutlined />,
color: '#ee1c25'
icon: <EmojiIcon emoji="🇨🇳" />
},
{
id: ArticleLanguage.English,
name: 'English',
icon: <Icon.GlobalOutlined />,
color: '#002164'
icon: <EmojiIcon emoji="🇺🇸" />
},
{
id: ArticleLanguage.Mixed,
name: '多语言',
icon: <EmojiIcon emoji="🌐" />
}
].map((item) => [item.id, item])
)
Expand Down

0 comments on commit 7fa201a

Please sign in to comment.