feat: improve built-in locales (#441)

This commit is contained in:
pengzhanbo 2025-01-21 12:00:06 +08:00 committed by GitHub
parent 4a39d39331
commit 62c43d25ee
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
22 changed files with 192 additions and 472 deletions

View File

@ -0,0 +1,18 @@
/** 德语 */
import type { SearchLocaleOptions } from '../../shared/index.js'
export const deSearchLocale: Partial<SearchLocaleOptions> = {
placeholder: 'Dokumente durchsuchen',
resetButtonTitle: 'Suche zurücksetzen',
backButtonTitle: 'Schließen',
noResultsText: 'Keine Suchergebnisse:',
footer: {
selectText: 'Auswählen',
selectKeyAriaLabel: 'Eingabe',
navigateText: 'Wechseln',
navigateUpKeyAriaLabel: 'Nach oben',
navigateDownKeyAriaLabel: 'Nach unten',
closeText: 'Schließen',
closeKeyAriaLabel: 'Beenden',
},
}

View File

@ -0,0 +1,17 @@
import type { SearchLocaleOptions } from '../../shared/index.js'
export const enSearchLocale: Partial<SearchLocaleOptions> = {
placeholder: 'Search',
resetButtonTitle: 'Reset search',
backButtonTitle: 'Close search',
noResultsText: 'No results for',
footer: {
selectText: 'to select',
selectKeyAriaLabel: 'enter',
navigateText: 'to navigate',
navigateUpKeyAriaLabel: 'up arrow',
navigateDownKeyAriaLabel: 'down arrow',
closeText: 'to close',
closeKeyAriaLabel: 'escape',
},
}

View File

@ -0,0 +1,18 @@
/** 法语 */
import type { SearchLocaleOptions } from '../../shared/index.js'
export const frSearchLocale: Partial<SearchLocaleOptions> = {
placeholder: 'Rechercher dans la documentation',
resetButtonTitle: 'Réinitialiser la recherche',
backButtonTitle: 'Fermer',
noResultsText: 'Aucun résultat trouvé :',
footer: {
selectText: 'sélectionner',
selectKeyAriaLabel: 'Entrée',
navigateText: 'naviguer',
navigateUpKeyAriaLabel: 'haut',
navigateDownKeyAriaLabel: 'bas',
closeText: 'fermer',
closeKeyAriaLabel: 'sortie',
},
}

View File

@ -0,0 +1,24 @@
/**
*
* /zh/ /en/ AI
* issue
*/
import type { DefaultLocaleInfo } from '@vuepress/helper'
import type { SearchLocaleOptions } from '../../shared/index.js'
import { deSearchLocale } from './de.js'
import { enSearchLocale } from './en.js'
import { frSearchLocale } from './fr.js'
import { jaSearchLocale } from './ja.js'
import { ruSearchLocale } from './ru.js'
import { zhTwSearchLocale } from './zh-tw.js'
import { zhSearchLocale } from './zh.js'
export const SEARCH_LOCALES: DefaultLocaleInfo<Partial<SearchLocaleOptions>> = [
[['en', 'en-US'], enSearchLocale],
[['zh', 'zh-CN', 'zh-Hans', 'zh-Hant'], zhSearchLocale],
[['zh-TW'], zhTwSearchLocale],
[['de', 'de-DE'], deSearchLocale],
[['fr', 'fr-FR'], frSearchLocale],
[['ru', 'ru-RU'], ruSearchLocale],
[['ja', 'ja-JP'], jaSearchLocale],
]

View File

@ -0,0 +1,18 @@
/** 日语 */
import type { SearchLocaleOptions } from '../../shared/index.js'
export const jaSearchLocale: Partial<SearchLocaleOptions> = {
placeholder: 'ドキュメントを検索',
resetButtonTitle: '検索をリセット',
backButtonTitle: '閉じる',
noResultsText: '検索結果がありません:',
footer: {
selectText: '選択',
selectKeyAriaLabel: '入力',
navigateText: '切り替え',
navigateUpKeyAriaLabel: '上へ',
navigateDownKeyAriaLabel: '下へ',
closeText: '閉じる',
closeKeyAriaLabel: '終了',
},
}

View File

@ -0,0 +1,18 @@
/** 俄语 */
import type { SearchLocaleOptions } from '../../shared/index.js'
export const ruSearchLocale: Partial<SearchLocaleOptions> = {
placeholder: 'Поиск по документации',
resetButtonTitle: 'Сбросить поиск',
backButtonTitle: 'Закрыть',
noResultsText: 'Нет результатов поиска:',
footer: {
selectText: 'Выбрать',
selectKeyAriaLabel: 'Ввод',
navigateText: 'Переключить',
navigateUpKeyAriaLabel: 'Вверх',
navigateDownKeyAriaLabel: 'Вниз',
closeText: 'Закрыть',
closeKeyAriaLabel: 'Выход',
},
}

View File

@ -0,0 +1,18 @@
/** 繁体中文 */
import type { SearchLocaleOptions } from '../../shared/index.js'
export const zhTwSearchLocale: Partial<SearchLocaleOptions> = {
placeholder: '搜索文檔',
resetButtonTitle: '重置搜索',
backButtonTitle: '關閉',
noResultsText: '無搜索結果:',
footer: {
selectText: '選擇',
selectKeyAriaLabel: '輸入',
navigateText: '切換',
navigateUpKeyAriaLabel: '向上',
navigateDownKeyAriaLabel: '向下',
closeText: '關閉',
closeKeyAriaLabel: '退出',
},
}

View File

@ -0,0 +1,17 @@
import type { SearchLocaleOptions } from '../../shared/index.js'
export const zhSearchLocale: Partial<SearchLocaleOptions> = {
placeholder: '搜索文档',
resetButtonTitle: '重置搜索',
backButtonTitle: '关闭',
noResultsText: '无搜索结果:',
footer: {
selectText: '选择',
selectKeyAriaLabel: '输入',
navigateText: '切换',
navigateUpKeyAriaLabel: '向上',
navigateDownKeyAriaLabel: '向下',
closeText: '关闭',
closeKeyAriaLabel: '退出',
},
}

View File

@ -1,8 +1,9 @@
import type { Plugin } from 'vuepress/core'
import type { SearchPluginOptions } from '../shared/index.js'
import { addViteOptimizeDepsInclude } from '@vuepress/helper'
import { addViteOptimizeDepsInclude, getFullLocaleConfig } from '@vuepress/helper'
import chokidar from 'chokidar'
import { getDirname, path } from 'vuepress/utils'
import { SEARCH_LOCALES } from './locales/index.js'
import { onSearchIndexRemoved, onSearchIndexUpdated, prepareSearchIndex } from './prepareSearchIndex.js'
const __dirname = getDirname(import.meta.url)
@ -18,7 +19,12 @@ export function searchPlugin({
clientConfigFile: path.resolve(__dirname, '../client/config.js'),
define: {
__SEARCH_LOCALES__: locales,
__SEARCH_LOCALES__: getFullLocaleConfig({
app,
name: '@vuepress-plume/plugin-search',
default: SEARCH_LOCALES,
config: locales,
}),
__SEARCH_OPTIONS__: searchOptions,
},

View File

@ -4,7 +4,6 @@ export * from './resolveLocaleOptions.js'
export * from './resolveNotesOptions.js'
export * from './resolveProvideData.js'
export * from './resolveSearchOptions.js'
export * from './resolveThemeData.js'
export * from './resolveThemeOption.js'

View File

@ -1,7 +1,7 @@
import type { App } from 'vuepress'
import type { PlumeThemeData, PlumeThemeLocaleOptions } from '../../shared/index.js'
import { hasOwn, uniq } from '@pengzhanbo/utils'
import { entries, fromEntries, getLocaleConfig, isPlainObject } from '@vuepress/helper'
import { entries, fromEntries, getFullLocaleConfig, isPlainObject } from '@vuepress/helper'
import { LOCALE_OPTIONS } from '../locales/index.js'
import { THEME_NAME } from '../utils/index.js'
@ -43,7 +43,7 @@ const FALLBACK_OPTIONS: PlumeThemeData = {
export function resolveLocaleOptions(app: App, { locales, ...options }: PlumeThemeLocaleOptions): PlumeThemeLocaleOptions {
const resolvedOptions: PlumeThemeLocaleOptions = {
...mergeLocaleOptions(FALLBACK_OPTIONS, options),
locales: getLocaleConfig({
locales: getFullLocaleConfig({
app,
name: THEME_NAME,
default: LOCALE_OPTIONS,

View File

@ -1,24 +1,22 @@
import type { App } from 'vuepress'
import type { PlumeThemePluginOptions } from '../../shared/index.js'
import { entries, fromEntries, getLocalePaths, inferRootLocalePath, isPlainObject } from '@vuepress/helper'
import { getFullLocaleConfig, isPlainObject } from '@vuepress/helper'
import { PRESET_LOCALES } from '../locales/index.js'
export function resolveProvideData(
app: App,
plugins: PlumeThemePluginOptions,
): Record<string, any> {
const root = inferRootLocalePath(app)
const locales = [...getLocalePaths(app), root]
return {
// 注入水印配置
__PLUME_WM_FP__: isPlainObject(plugins.watermark)
? plugins.watermark.fullPage !== false
: true,
// 注入多语言配置
__PLUME_PRESET_LOCALE__: fromEntries(
entries(PRESET_LOCALES)
.filter(([locale]) => locales.includes(locale))
.map(([locale, value]) => [locale === root ? '/' : locale, value]),
),
__PLUME_PRESET_LOCALE__: getFullLocaleConfig({
app,
name: 'vuepress-theme-plume/preset-locales',
default: PRESET_LOCALES,
}),
}
}

View File

@ -1,33 +0,0 @@
import type { SearchPluginOptions } from '@vuepress-plume/plugin-search'
import type { DocSearchPluginOptions } from '@vuepress/plugin-docsearch'
import type { App } from 'vuepress'
import { getLocaleConfig } from '@vuepress/helper'
import { DOCSEARCH_LOCALES, SEARCH_LOCALES } from '../locales/index.js'
export function resolveSearchOptions(
app: App,
{ locales, ...options }: SearchPluginOptions = {},
): SearchPluginOptions {
return {
...options,
locales: getLocaleConfig({
app,
default: SEARCH_LOCALES,
config: locales,
}),
}
}
export function resolveDocsearchOptions(
app: App,
{ locales, ...options }: DocSearchPluginOptions = {},
): DocSearchPluginOptions {
return {
...options,
locales: getLocaleConfig({
app,
default: DOCSEARCH_LOCALES,
config: locales,
}),
}
}

View File

@ -1,6 +1,4 @@
/** 德语 */
import type { SearchLocaleOptions } from '@vuepress-plume/plugin-search'
import type { DocSearchLocaleOptions } from '@vuepress/plugin-docsearch'
import type { PlumeThemeLocaleData, PresetLocale } from '../../shared/index.js'
export const deLocale: PlumeThemeLocaleData = {
@ -66,61 +64,3 @@ export const dePresetLocale: PresetLocale = {
'CC-BY-ND-4.0': 'Namensnennung-Keine Bearbeitung 4.0 International',
'CC-BY-SA-4.0': 'Namensnennung-Weitergabe unter gleichen Bedingungen 4.0 International',
}
export const deDocsearchLocale: DocSearchLocaleOptions = {
placeholder: 'Dokumente durchsuchen',
translations: {
button: {
buttonText: 'Dokumente durchsuchen',
buttonAriaLabel: 'Dokumente durchsuchen',
},
modal: {
searchBox: {
resetButtonTitle: 'Suchkriterien löschen',
resetButtonAriaLabel: 'Suchkriterien löschen',
cancelButtonText: 'Abbrechen',
cancelButtonAriaLabel: 'Abbrechen',
},
startScreen: {
recentSearchesTitle: 'Letzte Suchen',
noRecentSearchesText: 'Keine letzten Suchen',
saveRecentSearchButtonTitle: 'Zu letzten Suchen hinzufügen',
removeRecentSearchButtonTitle: 'Aus letzten Suchen entfernen',
favoriteSearchesTitle: 'Favoriten',
removeFavoriteSearchButtonTitle: 'Aus Favoriten entfernen',
},
errorScreen: {
titleText: 'Ergebnisse konnten nicht abgerufen werden',
helpText: 'Möglicherweise müssen Sie Ihre Internetverbindung überprüfen.',
},
footer: {
selectText: 'Auswählen',
navigateText: 'Wechseln',
closeText: 'Schließen',
searchByText: 'Bereitgestellt von',
},
noResultsScreen: {
noResultsText: 'Keine relevanten Ergebnisse gefunden',
suggestedQueryText: 'Sie können versuchen, nach',
reportMissingResultsText: 'Sie glauben, dass diese Suche Ergebnisse liefern sollte?',
reportMissingResultsLinkText: 'Klicken Sie hier, um Feedback zu geben',
},
},
},
}
export const deSearchLocale: Partial<SearchLocaleOptions> = {
placeholder: 'Dokumente durchsuchen',
resetButtonTitle: 'Suche zurücksetzen',
backButtonTitle: 'Schließen',
noResultsText: 'Keine Suchergebnisse:',
footer: {
selectText: 'Auswählen',
selectKeyAriaLabel: 'Eingabe',
navigateText: 'Wechseln',
navigateUpKeyAriaLabel: 'Nach oben',
navigateDownKeyAriaLabel: 'Nach unten',
closeText: 'Schließen',
closeKeyAriaLabel: 'Beenden',
},
}

View File

@ -1,4 +1,3 @@
import type { SearchLocaleOptions } from '@vuepress-plume/plugin-search'
import type { PlumeThemeLocaleData, PresetLocale } from '../../shared/index.js'
export const enLocale: PlumeThemeLocaleData = {
@ -51,19 +50,3 @@ export const enPresetLocale: PresetLocale = {
'CC-BY-ND-4.0': 'Attribution-NoDerivatives 4.0 International',
'CC-BY-SA-4.0': 'Attribution-ShareAlike 4.0 International',
}
export const enSearchLocale: Partial<SearchLocaleOptions> = {
placeholder: 'Search',
resetButtonTitle: 'Reset search',
backButtonTitle: 'Close search',
noResultsText: 'No results for',
footer: {
selectText: 'to select',
selectKeyAriaLabel: 'enter',
navigateText: 'to navigate',
navigateUpKeyAriaLabel: 'up arrow',
navigateDownKeyAriaLabel: 'down arrow',
closeText: 'to close',
closeKeyAriaLabel: 'escape',
},
}

View File

@ -1,6 +1,4 @@
/** 法语 */
import type { SearchLocaleOptions } from '@vuepress-plume/plugin-search'
import type { DocSearchLocaleOptions } from '@vuepress/plugin-docsearch'
import type { PlumeThemeLocaleData, PresetLocale } from '../../shared/index.js'
export const frLocale: PlumeThemeLocaleData = {
@ -65,61 +63,3 @@ export const frPresetLocale: PresetLocale = {
'CC-BY-ND-4.0': 'Attribution-Pas de Modification 4.0 International',
'CC-BY-SA-4.0': 'Attribution-Partage dans les Mêmes Conditions 4.0 International',
}
export const frDocsearchLocale: DocSearchLocaleOptions = {
placeholder: 'Rechercher dans la documentation',
translations: {
button: {
buttonText: 'Rechercher dans la documentation',
buttonAriaLabel: 'Rechercher dans la documentation',
},
modal: {
searchBox: {
resetButtonTitle: 'Effacer les critères de recherche',
resetButtonAriaLabel: 'Effacer les critères de recherche',
cancelButtonText: 'Annuler',
cancelButtonAriaLabel: 'Annuler',
},
startScreen: {
recentSearchesTitle: 'Recherches récentes',
noRecentSearchesText: 'Aucune recherche récente',
saveRecentSearchButtonTitle: 'Enregistrer dans les recherches récentes',
removeRecentSearchButtonTitle: 'Supprimer des recherches récentes',
favoriteSearchesTitle: 'Favoris',
removeFavoriteSearchButtonTitle: 'Supprimer des favoris',
},
errorScreen: {
titleText: 'Impossible d\'obtenir les résultats',
helpText: 'Vous devriez vérifier votre connexion Internet',
},
footer: {
selectText: 'sélectionner',
navigateText: 'naviguer',
closeText: 'fermer',
searchByText: 'Recherche par',
},
noResultsScreen: {
noResultsText: 'Aucun résultat trouvé',
suggestedQueryText: 'Vous pouvez essayer de rechercher',
reportMissingResultsText: 'Pensez-vous que cette recherche devrait avoir des résultats ?',
reportMissingResultsLinkText: 'Cliquez pour signaler',
},
},
},
}
export const frSearchLocale: Partial<SearchLocaleOptions> = {
placeholder: 'Rechercher dans la documentation',
resetButtonTitle: 'Réinitialiser la recherche',
backButtonTitle: 'Fermer',
noResultsText: 'Aucun résultat trouvé :',
footer: {
selectText: 'sélectionner',
selectKeyAriaLabel: 'Entrée',
navigateText: 'naviguer',
navigateUpKeyAriaLabel: 'haut',
navigateDownKeyAriaLabel: 'bas',
closeText: 'fermer',
closeKeyAriaLabel: 'sortie',
},
}

View File

@ -3,52 +3,32 @@
* /zh/ /en/ AI
* issue
*/
import type { SearchLocaleOptions } from '@vuepress-plume/plugin-search'
import type { DocSearchLocaleOptions } from '@vuepress/plugin-docsearch'
import type { DefaultLocaleInfo } from '@vuepress/helper'
import type { PlumeThemeLocaleData, PresetLocale } from '../../shared/index.js'
import { deDocsearchLocale, deLocale, dePresetLocale, deSearchLocale } from './de.js'
import { enLocale, enPresetLocale, enSearchLocale } from './en.js'
import { frDocsearchLocale, frLocale, frPresetLocale, frSearchLocale } from './fr.js'
import { jaDocsearchLocale, jaLocale, jaPresetLocale, jaSearchLocale } from './ja.js'
import { ruDocsearchLocale, ruLocale, ruPresetLocale, ruSearchLocale } from './ru.js'
import { zhTwDocsearchLocale, zhTwLocale, zhTwPresetLocale, zhTwSearchLocale } from './zh-tw.js'
import { zhDocsearchLocale, zhLocale, zhPresetLocale, zhSearchLocale } from './zh.js'
import { deLocale, dePresetLocale } from './de.js'
import { enLocale, enPresetLocale } from './en.js'
import { frLocale, frPresetLocale } from './fr.js'
import { jaLocale, jaPresetLocale } from './ja.js'
import { ruLocale, ruPresetLocale } from './ru.js'
import { zhTwLocale, zhTwPresetLocale } from './zh-tw.js'
import { zhLocale, zhPresetLocale } from './zh.js'
export const LOCALE_OPTIONS: Record<string, PlumeThemeLocaleData> = {
'/zh/': zhLocale,
'/en/': enLocale,
'/zh-tw/': zhTwLocale,
'/de/': deLocale,
'/fr/': frLocale,
'/ru/': ruLocale,
'/ja/': jaLocale,
}
export const LOCALE_OPTIONS: DefaultLocaleInfo<PlumeThemeLocaleData> = [
[['en', 'en-US'], enLocale],
[['zh', 'zh-CN', 'zh-Hans', 'zh-Hant'], zhLocale],
[['zh-TW'], zhTwLocale],
[['de', 'de-DE'], deLocale],
[['fr', 'fr-FR'], frLocale],
[['ru', 'ru-RU'], ruLocale],
[['ja', 'ja-JP'], jaLocale],
]
export const PRESET_LOCALES: Record<string, PresetLocale> = {
'/zh/': zhPresetLocale,
'/en/': enPresetLocale,
'/zh-tw/': zhTwPresetLocale,
'/de/': dePresetLocale,
'/fr/': frPresetLocale,
'/ru/': ruPresetLocale,
'/ja/': jaPresetLocale,
}
export const DOCSEARCH_LOCALES: Record<string, DocSearchLocaleOptions> = {
'/zh/': zhDocsearchLocale,
'/zh-tw/': zhTwDocsearchLocale,
'/de/': deDocsearchLocale,
'/fr/': frDocsearchLocale,
'/ru/': ruDocsearchLocale,
'/ja/': jaDocsearchLocale,
}
export const SEARCH_LOCALES: Record<string, Partial<SearchLocaleOptions>> = {
'/zh/': zhSearchLocale,
'/en/': enSearchLocale,
'/zh-tw/': zhTwSearchLocale,
'/de/': deSearchLocale,
'/fr/': frSearchLocale,
'/ru/': ruSearchLocale,
'/ja/': jaSearchLocale,
}
export const PRESET_LOCALES: DefaultLocaleInfo<PresetLocale> = [
[['en', 'en-US'], enPresetLocale],
[['zh', 'zh-CN', 'zh-Hans', 'zh-Hant'], zhPresetLocale],
[['zh-TW'], zhTwPresetLocale],
[['de', 'de-DE'], dePresetLocale],
[['fr', 'fr-FR'], frPresetLocale],
[['ru', 'ru-RU'], ruPresetLocale],
[['ja', 'ja-JP'], jaPresetLocale],
]

View File

@ -1,6 +1,4 @@
/** 日语 */
import type { SearchLocaleOptions } from '@vuepress-plume/plugin-search'
import type { DocSearchLocaleOptions } from '@vuepress/plugin-docsearch'
import type { PlumeThemeLocaleData, PresetLocale } from '../../shared/index.js'
export const jaLocale: PlumeThemeLocaleData = {
@ -65,61 +63,3 @@ export const jaPresetLocale: PresetLocale = {
'CC-BY-ND-4.0': '表示-改変禁止 4.0 国際',
'CC-BY-SA-4.0': '表示-継承 4.0 国際',
}
export const jaDocsearchLocale: DocSearchLocaleOptions = {
placeholder: 'ドキュメントを検索',
translations: {
button: {
buttonText: 'ドキュメントを検索',
buttonAriaLabel: 'ドキュメントを検索',
},
modal: {
searchBox: {
resetButtonTitle: 'クエリをクリア',
resetButtonAriaLabel: 'クエリをクリア',
cancelButtonText: 'キャンセル',
cancelButtonAriaLabel: 'キャンセル',
},
startScreen: {
recentSearchesTitle: '最近の検索',
noRecentSearchesText: '最近の検索はありません',
saveRecentSearchButtonTitle: '最近の検索に保存',
removeRecentSearchButtonTitle: '最近の検索から削除',
favoriteSearchesTitle: 'お気に入り',
removeFavoriteSearchButtonTitle: 'お気に入りから削除',
},
errorScreen: {
titleText: '結果を取得できません',
helpText: 'ネットワーク接続を確認する必要があるかもしれません',
},
footer: {
selectText: '選択',
navigateText: '切り替え',
closeText: '閉じる',
searchByText: '検索提供者',
},
noResultsScreen: {
noResultsText: '関連する結果が見つかりません',
suggestedQueryText: 'クエリを試すことができます',
reportMissingResultsText: 'このクエリに結果があると思いますか?',
reportMissingResultsLinkText: 'フィードバックを送信',
},
},
},
}
export const jaSearchLocale: Partial<SearchLocaleOptions> = {
placeholder: 'ドキュメントを検索',
resetButtonTitle: '検索をリセット',
backButtonTitle: '閉じる',
noResultsText: '検索結果がありません:',
footer: {
selectText: '選択',
selectKeyAriaLabel: '入力',
navigateText: '切り替え',
navigateUpKeyAriaLabel: '上へ',
navigateDownKeyAriaLabel: '下へ',
closeText: '閉じる',
closeKeyAriaLabel: '終了',
},
}

View File

@ -1,6 +1,4 @@
/** 俄语 */
import type { SearchLocaleOptions } from '@vuepress-plume/plugin-search'
import type { DocSearchLocaleOptions } from '@vuepress/plugin-docsearch'
import type { PlumeThemeLocaleData, PresetLocale } from '../../shared/index.js'
export const ruLocale: PlumeThemeLocaleData = {
@ -65,61 +63,3 @@ export const ruPresetLocale: PresetLocale = {
'CC-BY-ND-4.0': 'Атрибуция-Без производных 4.0 Международный',
'CC-BY-SA-4.0': 'Атрибуция-С сохранением условий 4.0 Международный',
}
export const ruDocsearchLocale: DocSearchLocaleOptions = {
placeholder: 'Поиск по документации',
translations: {
button: {
buttonText: 'Поиск по документации',
buttonAriaLabel: 'Поиск по документации',
},
modal: {
searchBox: {
resetButtonTitle: 'Очистить условия поиска',
resetButtonAriaLabel: 'Очистить условия поиска',
cancelButtonText: 'Отмена',
cancelButtonAriaLabel: 'Отмена',
},
startScreen: {
recentSearchesTitle: 'История поиска',
noRecentSearchesText: 'Нет истории поиска',
saveRecentSearchButtonTitle: 'Сохранить в историю поиска',
removeRecentSearchButtonTitle: 'Удалить из истории поиска',
favoriteSearchesTitle: 'Избранное',
removeFavoriteSearchButtonTitle: 'Удалить из избранного',
},
errorScreen: {
titleText: 'Не удалось получить результаты',
helpText: 'Возможно, вам нужно проверить подключение к интернету',
},
footer: {
selectText: 'Выбрать',
navigateText: 'Переключить',
closeText: 'Закрыть',
searchByText: 'Поиск предоставлен',
},
noResultsScreen: {
noResultsText: 'Не найдено соответствующих результатов',
suggestedQueryText: 'Вы можете попробовать запрос',
reportMissingResultsText: 'Считаете, что этот запрос должен вернуть результаты?',
reportMissingResultsLinkText: 'Нажмите, чтобы сообщить',
},
},
},
}
export const ruSearchLocale: Partial<SearchLocaleOptions> = {
placeholder: 'Поиск по документации',
resetButtonTitle: 'Сбросить поиск',
backButtonTitle: 'Закрыть',
noResultsText: 'Нет результатов поиска:',
footer: {
selectText: 'Выбрать',
selectKeyAriaLabel: 'Ввод',
navigateText: 'Переключить',
navigateUpKeyAriaLabel: 'Вверх',
navigateDownKeyAriaLabel: 'Вниз',
closeText: 'Закрыть',
closeKeyAriaLabel: 'Выход',
},
}

View File

@ -1,6 +1,4 @@
/** 繁体中文 */
import type { SearchLocaleOptions } from '@vuepress-plume/plugin-search'
import type { DocSearchLocaleOptions } from '@vuepress/plugin-docsearch'
import type { PlumeThemeLocaleData, PresetLocale } from '../../shared/index.js'
export const zhTwLocale: PlumeThemeLocaleData = {
@ -65,61 +63,3 @@ export const zhTwPresetLocale: PresetLocale = {
'CC-BY-ND-4.0': '署名-禁止演繹 4.0 國際',
'CC-BY-SA-4.0': '署名-相同方式共享 4.0 國際',
}
export const zhTwDocsearchLocale: DocSearchLocaleOptions = {
placeholder: '搜索文檔',
translations: {
button: {
buttonText: '搜索文檔',
buttonAriaLabel: '搜索文檔',
},
modal: {
searchBox: {
resetButtonTitle: '清除查詢條件',
resetButtonAriaLabel: '清除查詢條件',
cancelButtonText: '取消',
cancelButtonAriaLabel: '取消',
},
startScreen: {
recentSearchesTitle: '搜索歷史',
noRecentSearchesText: '沒有搜索歷史',
saveRecentSearchButtonTitle: '保存至搜索歷史',
removeRecentSearchButtonTitle: '從搜索歷史中移除',
favoriteSearchesTitle: '收藏',
removeFavoriteSearchButtonTitle: '從收藏中移除',
},
errorScreen: {
titleText: '無法獲取結果',
helpText: '你可能需要檢查你的網絡連接',
},
footer: {
selectText: '選擇',
navigateText: '切換',
closeText: '關閉',
searchByText: '搜索提供者',
},
noResultsScreen: {
noResultsText: '無法找到相關結果',
suggestedQueryText: '你可以嘗試查詢',
reportMissingResultsText: '你認為該查詢應該有結果?',
reportMissingResultsLinkText: '點擊反饋',
},
},
},
}
export const zhTwSearchLocale: Partial<SearchLocaleOptions> = {
placeholder: '搜索文檔',
resetButtonTitle: '重置搜索',
backButtonTitle: '關閉',
noResultsText: '無搜索結果:',
footer: {
selectText: '選擇',
selectKeyAriaLabel: '輸入',
navigateText: '切換',
navigateUpKeyAriaLabel: '向上',
navigateDownKeyAriaLabel: '向下',
closeText: '關閉',
closeKeyAriaLabel: '退出',
},
}

View File

@ -1,5 +1,3 @@
import type { SearchLocaleOptions } from '@vuepress-plume/plugin-search'
import type { DocSearchLocaleOptions } from '@vuepress/plugin-docsearch'
import type { PlumeThemeLocaleData, PresetLocale } from '../../shared/index.js'
export const zhLocale: PlumeThemeLocaleData = {
@ -64,61 +62,3 @@ export const zhPresetLocale: PresetLocale = {
'CC-BY-ND-4.0': '署名-禁止演绎 4.0 国际',
'CC-BY-SA-4.0': '署名-相同方式共享 4.0 国际',
}
export const zhDocsearchLocale: DocSearchLocaleOptions = {
placeholder: '搜索文档',
translations: {
button: {
buttonText: '搜索文档',
buttonAriaLabel: '搜索文档',
},
modal: {
searchBox: {
resetButtonTitle: '清除查询条件',
resetButtonAriaLabel: '清除查询条件',
cancelButtonText: '取消',
cancelButtonAriaLabel: '取消',
},
startScreen: {
recentSearchesTitle: '搜索历史',
noRecentSearchesText: '没有搜索历史',
saveRecentSearchButtonTitle: '保存至搜索历史',
removeRecentSearchButtonTitle: '从搜索历史中移除',
favoriteSearchesTitle: '收藏',
removeFavoriteSearchButtonTitle: '从收藏中移除',
},
errorScreen: {
titleText: '无法获取结果',
helpText: '你可能需要检查你的网络连接',
},
footer: {
selectText: '选择',
navigateText: '切换',
closeText: '关闭',
searchByText: '搜索提供者',
},
noResultsScreen: {
noResultsText: '无法找到相关结果',
suggestedQueryText: '你可以尝试查询',
reportMissingResultsText: '你认为该查询应该有结果?',
reportMissingResultsLinkText: '点击反馈',
},
},
},
}
export const zhSearchLocale: Partial<SearchLocaleOptions> = {
placeholder: '搜索文档',
resetButtonTitle: '重置搜索',
backButtonTitle: '关闭',
noResultsText: '无搜索结果:',
footer: {
selectText: '选择',
selectKeyAriaLabel: '输入',
navigateText: '切换',
navigateUpKeyAriaLabel: '向上',
navigateDownKeyAriaLabel: '向下',
closeText: '关闭',
closeKeyAriaLabel: '退出',
},
}

View File

@ -21,7 +21,6 @@ import { sitemapPlugin, type SitemapPluginOptions } from '@vuepress/plugin-sitem
import { watermarkPlugin } from '@vuepress/plugin-watermark'
import { mdEnhancePlugin } from 'vuepress-plugin-md-enhance'
import { markdownPowerPlugin } from 'vuepress-plugin-md-power'
import { resolveDocsearchOptions, resolveSearchOptions } from '../config/index.js'
export interface SetupPluginOptions {
app: App
@ -95,13 +94,13 @@ export function getPlugins(
if (pluginOptions.docsearch) {
if (pluginOptions.docsearch.appId && pluginOptions.docsearch.apiKey)
plugins.push(docsearchPlugin(resolveDocsearchOptions(app, pluginOptions.docsearch)))
plugins.push(docsearchPlugin(pluginOptions.docsearch))
else
console.error('docsearch plugin: appId and apiKey are both required')
}
else if (pluginOptions.search !== false) {
plugins.push(searchPlugin(resolveSearchOptions(app, pluginOptions.search)))
plugins.push(searchPlugin(pluginOptions.search || {}))
}
const shikiOption = pluginOptions.shiki