mirror of
https://github.com/RealKai42/qwerty-learner.git
synced 2026-04-05 14:29:04 +08:00
Add Indonesian Dictionary (#845)
* Indonesian json来源:https://github.com/fireindark707/indonesian-common-words/blob/main/dictionary.json * 补soundResource.ts的id项 * feat: add indonesian pron --------- Co-authored-by: Kai <me@kaiyi.cool>
This commit is contained in:
18224
public/dicts/Indonesian.json
Normal file
18224
public/dicts/Indonesian.json
Normal file
File diff suppressed because it is too large
Load Diff
BIN
src/assets/flags/id.png
Normal file
BIN
src/assets/flags/id.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 195 B |
@@ -10,7 +10,7 @@ import useSound from 'use-sound'
|
||||
import type { HookOptions } from 'use-sound/dist/types'
|
||||
|
||||
const pronunciationApi = 'https://dict.youdao.com/dictvoice?audio='
|
||||
export function generateWordSoundSrc(word: string, pronunciation: Exclude<PronunciationType, false>) {
|
||||
export function generateWordSoundSrc(word: string, pronunciation: Exclude<PronunciationType, false>): string {
|
||||
switch (pronunciation) {
|
||||
case 'uk':
|
||||
return `${pronunciationApi}${word}&type=1`
|
||||
@@ -27,6 +27,10 @@ export function generateWordSoundSrc(word: string, pronunciation: Exclude<Pronun
|
||||
case 'hapin':
|
||||
case 'kk':
|
||||
return `${pronunciationApi}${word}&le=ru` // 有道不支持哈萨克语, 暂时用俄语发音兜底
|
||||
case 'id':
|
||||
return `${pronunciationApi}${word}&le=id`
|
||||
default:
|
||||
return ''
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,6 +79,8 @@ export function usePrefetchPronunciationSound(word: string | undefined) {
|
||||
if (!word) return
|
||||
|
||||
const soundUrl = generateWordSoundSrc(word, pronunciationConfig.type)
|
||||
if (soundUrl === '') return
|
||||
|
||||
const head = document.head
|
||||
const isPrefetch = (Array.from(head.querySelectorAll('link[href]')) as HTMLLinkElement[]).some((el) => el.href === soundUrl)
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ import { GalleryContext } from '.'
|
||||
import codeFlag from '@/assets/flags/code.png'
|
||||
import deFlag from '@/assets/flags/de.png'
|
||||
import enFlag from '@/assets/flags/en.png'
|
||||
import idFlag from '@/assets/flags/id.png'
|
||||
import jpFlag from '@/assets/flags/ja.png'
|
||||
import kkFlag from '@/assets/flags/kk.png'
|
||||
import type { LanguageCategoryType } from '@/typings'
|
||||
@@ -19,6 +20,7 @@ const options: LanguageTabOption[] = [
|
||||
{ id: 'ja', name: '日语', flag: jpFlag },
|
||||
{ id: 'de', name: '德语', flag: deFlag },
|
||||
{ id: 'kk', name: '哈萨克语', flag: kkFlag },
|
||||
{ id: 'id', name: '印尼语', flag: idFlag },
|
||||
{ id: 'code', name: 'Code', flag: codeFlag },
|
||||
]
|
||||
|
||||
|
||||
@@ -3433,6 +3433,21 @@ const kazakhHapinDicts: DictionaryResource[] = [
|
||||
},
|
||||
]
|
||||
|
||||
//印尼语高频词汇
|
||||
const indonesianDicts: DictionaryResource[] = [
|
||||
{
|
||||
id: 'indonesian_highFrequency_3043',
|
||||
name: '印尼语高频词汇',
|
||||
description: '印尼语常用单词及中文解释',
|
||||
category: '印尼语',
|
||||
tags: ['基础'],
|
||||
url: '/dicts/Indonesian.json',
|
||||
length: 3043,
|
||||
language: 'id',
|
||||
languageCategory: 'id',
|
||||
},
|
||||
]
|
||||
|
||||
/**
|
||||
* Built-in dictionaries in an array.
|
||||
* Why arrays? Because it keeps the order across browsers.
|
||||
@@ -3445,6 +3460,7 @@ export const dictionaryResources: DictionaryResource[] = [
|
||||
...japaneseExam,
|
||||
...germanExam,
|
||||
...kazakhHapinDicts,
|
||||
...indonesianDicts,
|
||||
|
||||
// {
|
||||
// id: 'zhtest',
|
||||
|
||||
@@ -118,4 +118,13 @@ export const LANG_PRON_MAP: LanguagePronunciationMap = {
|
||||
},
|
||||
],
|
||||
},
|
||||
id: {
|
||||
defaultPronIndex: 0,
|
||||
pronunciation: [
|
||||
{
|
||||
name: '印尼语',
|
||||
pron: 'id',
|
||||
},
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
export * from './resource'
|
||||
|
||||
export type PronunciationType = 'us' | 'uk' | 'romaji' | 'zh' | 'ja' | 'de' | 'hapin' | 'kk'
|
||||
export type PhoneticType = 'us' | 'uk' | 'romaji' | 'zh' | 'ja' | 'de' | 'hapin' | 'kk'
|
||||
export type LanguageType = 'en' | 'romaji' | 'zh' | 'ja' | 'code' | 'de' | 'kk' | 'hapin'
|
||||
export type LanguageCategoryType = 'en' | 'ja' | 'de' | 'code' | 'kk'
|
||||
export type PronunciationType = 'us' | 'uk' | 'romaji' | 'zh' | 'ja' | 'de' | 'hapin' | 'kk' | 'id'
|
||||
export type PhoneticType = 'us' | 'uk' | 'romaji' | 'zh' | 'ja' | 'de' | 'hapin' | 'kk' | 'id'
|
||||
export type LanguageType = 'en' | 'romaji' | 'zh' | 'ja' | 'code' | 'de' | 'kk' | 'hapin' | 'id'
|
||||
export type LanguageCategoryType = 'en' | 'ja' | 'de' | 'code' | 'kk' | 'id'
|
||||
|
||||
type Pronunciation2PhoneticMap = Record<PronunciationType, PhoneticType>
|
||||
|
||||
@@ -16,6 +16,7 @@ export const PRONUNCIATION_PHONETIC_MAP: Pronunciation2PhoneticMap = {
|
||||
de: 'de',
|
||||
hapin: 'hapin',
|
||||
kk: 'kk',
|
||||
id: 'id',
|
||||
}
|
||||
|
||||
export type Word = {
|
||||
|
||||
@@ -2740,9 +2740,9 @@ camelcase@^6.2.0:
|
||||
integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==
|
||||
|
||||
caniuse-lite@^1.0.30001109, caniuse-lite@^1.0.30001449, caniuse-lite@^1.0.30001464:
|
||||
version "1.0.30001489"
|
||||
resolved "https://registry.npmmirror.com/caniuse-lite/-/caniuse-lite-1.0.30001489.tgz"
|
||||
integrity sha512-x1mgZEXK8jHIfAxm+xgdpHpk50IN3z3q3zP261/WS+uvePxW8izXuCu6AHz0lkuYTlATDehiZ/tNyYBdSQsOUQ==
|
||||
version "1.0.30001655"
|
||||
resolved "https://registry.npmmirror.com/caniuse-lite/-/caniuse-lite-1.0.30001655.tgz"
|
||||
integrity sha512-jRGVy3iSGO5Uutn2owlb5gR6qsGngTw9ZTb4ali9f3glshcNmJ2noam4Mo9zia5P9Dk3jNNydy7vQjuE5dQmfg==
|
||||
|
||||
canvas-confetti@^1.6.0:
|
||||
version "1.6.0"
|
||||
|
||||
Reference in New Issue
Block a user