diff --git a/manifest.json b/manifest.json index 565ad28..90d0e72 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "note-image-gallery", "name": "Note Image Gallery", - "version": "1.0.10", + "version": "1.0.11", "minAppVersion": "1.9.14", "description": "Display all images from your note in a gallery view.", "author": "Lemon695", diff --git a/src/i18n/locale.ts b/src/i18n/locale.ts index 5c9dbd9..bd034aa 100644 --- a/src/i18n/locale.ts +++ b/src/i18n/locale.ts @@ -1,3 +1,5 @@ +import { getLanguage } from 'obsidian'; + export const translations = { 'en-GB': { // Command names @@ -14,7 +16,6 @@ export const translations = { saveCacheIndexFailed: 'Failed to save cache index:', // Settings - imageGallerySettings: 'Image Gallery settings', enableCache: 'Enable image cache', enableCacheDesc: 'Cache remote images to speed up loading', cacheValidPeriod: 'Cache valid period', @@ -85,7 +86,6 @@ export const translations = { saveCacheIndexFailed: '保存缓存索引失败:', // Settings - imageGallerySettings: '图片墙设置', enableCache: '启用图片缓存', enableCacheDesc: '启用后,将缓存远程图片以加快加载速度', cacheValidPeriod: '缓存有效期', @@ -146,8 +146,7 @@ export const translations = { type Locale = keyof typeof translations; export function getLocale(): Locale { - // Use Obsidian's official i18n API instead of reading from localStorage directly - const lang: string = (window as unknown as { i18next?: { language?: string } }).i18next?.language ?? 'en-GB'; + const lang: string = getLanguage() ?? 'en-GB'; if (lang && lang.startsWith('zh')) return 'zh'; return 'en-GB'; } diff --git a/src/settings.ts b/src/settings.ts index 68f4324..555a066 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -35,10 +35,6 @@ export class NoteImageGallerySettingTab extends PluginSettingTab { containerEl.empty(); - new Setting(containerEl) - .setName(t('imageGallerySettings')) - .setHeading(); - new Setting(containerEl) .setName(t('enableCache')) .setDesc(t('enableCacheDesc'))