Skip to content

Commit

Permalink
✨ feat(lt-lt): Add Lithuanian locale, update labels and fix refs
Browse files Browse the repository at this point in the history
Adds Lithuanian locale support in `.dumirc.ts`, updates the default tab label in `ContentTabs` from Chinese to English, and fixes missing refs in `NativeSelect` which enables proper functionality of the select component. Additionally, the `LangSwitch` component is updated to include the Lithuanian flag and language abbreviation.

Changes include:
- Adding Lithuanian locale (`lt-LT`) to the list of available locales in `.dumirc.ts`.
- Updating the default tab label in `ContentTabs` from '文档' (Chinese for 'document') to 'document' (English).
- Fixing commented-out ref assignments in `NativeSelect` to properly reference the select items, ensuring correct behavior of the component.
- Adding the Lithuanian flag and language abbreviation to the `LangSwitch` component for a consistent and inclusive language selection experience.
- Hiding the home navigation in `.dumirc.ts` by setting `hideHomeNav` to `true`.
  • Loading branch information
Gincioks committed Mar 24, 2024
1 parent 260a13b commit b5d7e5d
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 9 deletions.
6 changes: 5 additions & 1 deletion example/.dumirc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const themeConfig = {
repo: 'arietta-studio/dumi-theme-arietta',
repoId: 'R_kgDOLh_T2Q',
},
hideHomeNav: true,
name: 'DUMI',
socialLinks: {
discord: 'https://discord.gg/',
Expand All @@ -54,7 +55,10 @@ export default defineConfig({
'process.env': process.env,
},
favicons: ['https://unpkg.com/@arietta-studio/assets-favicons@latest/assets/favicon.ico'],
locales: [{ id: 'en-US', name: 'English' }],
locales: [
{ id: 'en-US', name: 'English' },
{ id: 'lt-LT', name: 'Lietuvių' },
],
mfsu: isWin ? undefined : {},
npmClient: 'pnpm',
ssr: false,
Expand Down
4 changes: 2 additions & 2 deletions src/components/NativeSelect/SelectItem/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ export interface SelectItemProps {
value: any;
}

const SelectItem = memo<SelectItemProps>(
forwardRef(
const SelectItem = memo(
forwardRef<HTMLButtonElement, SelectItemProps>(
(
{ value, label, prefixCls, isSelected, isActive, disabled, ...props },
reference: ForwardedRef<HTMLButtonElement>,
Expand Down
8 changes: 4 additions & 4 deletions src/components/NativeSelect/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,10 @@ const NativeSelect = memo<NativeSelectProps>(
key={item.value}
label={renderItem ? renderItem(item, index) : item.label}
prefixCls={cls}
// ref={(node) => { // TODO: Fix this
// listReference.current[index] = node;
// listContentReference.current[index] = item.label as string;
// }}
ref={(node) => {
listReference.current[index] = node;
listContentReference.current[index] = item.label as string;
}}
value={item.value}
{...getItemProps({
onClick() {
Expand Down
2 changes: 1 addition & 1 deletion src/slots/ContentTabs/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const ContentTabs = memo<ContentTabsProps>(({ tabs, tabKey: key, onChange }) =>
className={styles.cls}
data-page-tabs
items={[
{ key: 'default', label: '文档', value: 'default' },
{ key: 'default', label: 'document', value: 'default' },
...tabs.map((tab) => ({
key: tab.key,
label: tab.titleIntlId
Expand Down
14 changes: 13 additions & 1 deletion src/slots/Header/LangSwitch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const languageMap: Record<string, string> = {
'it-IT': '🇮🇹',
'jp-JP': '🇯🇵',
'ko-KR': '🇰🇷',
'lt-LT': '🇱🇹',
'pt-BR': '🇧🇷',
'ru-RU': '🇷🇺',
'tr-TR': '🇹🇷',
Expand All @@ -48,7 +49,18 @@ const languageMap: Record<string, string> = {
};

const displayLangMap: Record<string, string> = {
'en-US': 'EN',
'de-DE': 'de',
'en-US': 'en',
'es-ES': 'es',
'fr-FR': 'fr',
'it-IT': 'it',
'jp-JP': 'jp',
'ko-KR': 'kr',
'lt-LT': 'lt',
'pt-BR': 'br',
'ru-RU': 'ru',
'tr-TR': 'tr',
'vi-VN': 'vn',
'zh-CN': '中',
};

Expand Down

0 comments on commit b5d7e5d

Please sign in to comment.