diff --git a/manifest.json b/manifest.json index 1a37482..62f162a 100644 --- a/manifest.json +++ b/manifest.json @@ -3,7 +3,7 @@ "name": "Book Smith", "version": "1.0.0", "minAppVersion": "0.15.0", - "description": "A writing plugin for book management", + "description": "Simplify long-form writing and book creation. Organize chapters, track progress, and export your manuscript in various formats for a seamless publishing workflow.", "author": "Yeban", "isDesktopOnly": false } \ No newline at end of file diff --git a/src/assets/kofi3.ts b/src/assets/kofi3.ts new file mode 100644 index 0000000..2c22284 --- /dev/null +++ b/src/assets/kofi3.ts @@ -0,0 +1 @@ +export const kofiImage = 'data:image/webp;base64,UklGRlINAABXRUJQVlA4TEUNAAAvQ0IkEFeiqG0kx/u8vYLh6B1/BhWDQbaRUz2AH8MraNtGTqYAllHY7jHINnKqR/AzeIVt2yAd8+4A8ycIgiA4GAQPg/tpaKSR+pVYfPVIF62+JCIpIIlISkptz50fTp4oSgCR2nkhiaOgbRvG5Q97F0JETIDX3OVTsfLrSLatqPkoBuw1yN//WlO2n0y8o4j+O2LbxpHsXaSMr7fte5OnNGvbmjjbhRDL6GhAhK/33qv7X1Hi+77Pi0zO+C+i/7Jg243b5kIuVS8JCO4AJedbjOh87MY1ZX3NzGkeu+id/A1d6JO+dq59qP4hE2d9/ZxLJ/ysEHBsCuqTgsAUyiDuJtzZcfxOwY5TjQoF+8oQn8OlyEm6VtFg62xkSeFgslDVPxkeQ/38OhQRfp4ujFJIGJ+OmAzPW9lprBUV1rdvlRXkezfqksLC5O6gVVzY3kBQYPi5LWJHMygyHC9z0NCfI1GDdGGxYTy13CC7UwuOubD0NDeKDv0eEzuY94vGFR66EzU+4pkezPsYn7BUbG+6/jxN3vs5wDJ776ap7xp7fAkFthRopjmuuSUF1x3aj/Yiq23GpXU3Wc72wLo3nakX1p3FN4f1BW8H49YCZD6ob/DRDLVi9hUR0ZxMx9Qz1Vlh4Cvr7Ke+b2trjbLDtHXb9pMLi1DT7QGlm4xwu1JCb3bInGld5I76eDLNNuiY6fiOvVfrGRfD8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97MNcb7WXm7KTMEPgzikL7ODX6QZvOPn3AMTFL30dD4SX1u0kKMBprP9vZxaW4FOFHf5N/ltDsVX8MU1a39mAu0TL/mu8MxPPiRHtBiol3UxhZvJ6JqPxpHtq9GbwO50u1w8kx6NY8nyd6eYc+BjPJefukPwhdaK6Fj0HRT4OIfEb5a8ZG6v6Z+cN/PlU1FwIszu3JNNjv3kQ5ICoBe+ft1ebHMVPzQZ/nWnTOGVlX/2OMsylZjCCVnObk11oJm6MtPJPsvZkaaLpea2hqB4xrfH+6+79AUnllsX5E1w0Y/tIf9zd135rc9OPZHWHvg/7nJTfLiKDPygFwn8IIg4flAR9J+bl13HBQGKfyFAMT/hdOibOTtoSOobikR81DtxRscCZAJNfYcTz4095wjNlgKXfTq9eRFcKlkQmMlds+MFHUh97WZHkyqUag9AzhUEiGox8WSAZbzfiEvr3StLfCDXjNXqRsTBsaS8c2LEAEYyB8saSmFxAInxUKE0cpLJy4/sOHm3MIodJ0UnpdhMGBxTxEtRVmEBIHPQl04M3/eObQj/VLtGH7tp2fKLnnDfvpNh7SMFAA=='; \ No newline at end of file diff --git a/src/i18n/i18n.ts b/src/i18n/i18n.ts index afebdc6..c731432 100644 --- a/src/i18n/i18n.ts +++ b/src/i18n/i18n.ts @@ -19,7 +19,6 @@ export class I18n { // 获取系统语言 private getSystemLocale(): Locale { const systemLocale = moment.locale(); - // 映射 moment 语言代码到我们支持的语言 if (systemLocale.startsWith('zh')) return 'zh-CN'; if (systemLocale.startsWith('en')) return 'en'; @@ -33,18 +32,7 @@ export class I18n { // 默认英文 return 'en'; - } - - // 设置当前语言 - public setLocale(locale: Locale) { - this.locale = locale; - } - - // 获取当前语言 - public getLocale(): Locale { - return this.locale; - } - + } // 加载翻译文件 private loadTranslations() { // 导入所有语言文件 diff --git a/src/i18n/interfaces/settings/settings.ts b/src/i18n/interfaces/settings/settings.ts index 2f9b911..832f862 100644 --- a/src/i18n/interfaces/settings/settings.ts +++ b/src/i18n/interfaces/settings/settings.ts @@ -1,9 +1,9 @@ export interface SettingsTranslation { // 设置页面 - SETTINGS_TITLE: string; - BASIC_SETTINGS: string; - TEMPLATE_SETTINGS: string; - WRITING_TOOLS_SETTINGS: string; + PLUGIN_NAME: string; + BASIC_OPTIONS: string; + TEMPLATE_OPTIONS: string; + WRITING_TOOLS_OPTIONS: string; // 基本设置 LANGUAGE_SETTING: string; @@ -26,7 +26,7 @@ export interface SettingsTranslation { DELETE_TEMPLATE_DESC: string; // 写作工具箱设置 - FOCUS_MODE_SETTINGS: string; + FOCUS_MODE_OPTIONS: string; FOCUS_DURATION: string; FOCUS_DURATION_DESC: string; BREAK_DURATION: string; diff --git a/src/i18n/locales/en.ts b/src/i18n/locales/en.ts index 059a8b0..55e7a71 100644 --- a/src/i18n/locales/en.ts +++ b/src/i18n/locales/en.ts @@ -19,15 +19,15 @@ const commonTranslation: CommonTranslation = { HIDE: 'Hide', SHOW: 'Show', - OPEN_BOOK_PANEL: 'Open Book Panel', - OPEN_TOOL_PANEL: 'Open Tool Panel', - OPEN_ALL_PANELS: 'Open All Panels', + OPEN_BOOK_PANEL: 'Open book panel', + OPEN_TOOL_PANEL: 'Open tool panel', + OPEN_ALL_PANELS: 'Open all panels', }; // 书籍管理视图翻译 const bookSmithViewTranslation: BookSmithViewTranslation = { // 主界面 - BOOK_MANAGER: 'Book Manager', + BOOK_MANAGER: 'Book manager', NEW_BOOK: 'New', SWITCH_BOOK: 'Switch', MANAGE_BOOK: 'Manage', @@ -41,14 +41,14 @@ const bookSmithViewTranslation: BookSmithViewTranslation = { // 章节相关 CHAPTER: 'Chapter', - ADD_CHAPTER: 'Add Chapter', - DELETE_CHAPTER: 'Delete Chapter', - RENAME_CHAPTER: 'Rename Chapter', + ADD_CHAPTER: 'Add chapter', + DELETE_CHAPTER: 'Delete chapter', + RENAME_CHAPTER: 'Rename chapter', // 统计相关 STATS: 'Statistics', - WORD_COUNT: 'Word Count', - CHAPTER_COUNT: 'Chapter Count', + WORD_COUNT: 'Word count', + CHAPTER_COUNT: 'Chapter count', // 帮助提示 HELP_TOOLTIP: `👋 Welcome to BookSmith @@ -93,10 +93,10 @@ the developer via the "Donate" button in the Writing Toolbox.`, // 统计文本 TODAY_WORDS: 'Today', - TOTAL_WORDS: 'Total Words', + TOTAL_WORDS: 'Total words', CHAPTER_COMPLETION: 'Completion', - WRITING_DAYS: 'Writing Days', - AVERAGE_DAILY_WORDS: 'Daily Average', + WRITING_DAYS: 'Writing days', + AVERAGE_DAILY_WORDS: 'Daily average', WORD_UNIT: ' words', DAY_UNIT: ' days', TEN_THOUSAND: 'K', @@ -108,67 +108,67 @@ the developer via the "Donate" button in the Writing Toolbox.`, // 工具箱视图翻译 const toolViewTranslation: ToolViewTranslation = { - WRITING_TOOLBOX: 'Writing Toolbox', + WRITING_TOOLBOX: 'Writing toolbox', // 写作助手 - WRITING_ASSISTANT: 'Writing Assistant', - FOCUS_MODE: 'Focus Mode', - CREATIVE_INSPIRATION: 'Creative Inspiration', - CHARACTER_PROFILES: 'Character Profiles', - WORLD_BUILDING: 'World Building', + WRITING_ASSISTANT: 'Writing assistant', + FOCUS_MODE: 'Focus mode', + CREATIVE_INSPIRATION: 'Creative inspiration', + CHARACTER_PROFILES: 'Character profiles', + WORLD_BUILDING: 'World building', // 导出发布 - EXPORT_PUBLISH: 'Export & Publish', - DESIGN_TYPOGRAPHY: 'Design & Typography', - GENERATE_EBOOK: 'Generate E-book', - MORE_FEATURES: 'More Features...', + EXPORT_PUBLISH: 'Export & publish', + DESIGN_TYPOGRAPHY: 'Design & typography', + GENERATE_EBOOK: 'Generate e-book', + MORE_FEATURES: 'More features...', MORE_FEATURES_MESSAGE: 'More features coming with your participation', // 写作圈子 - WRITING_COMMUNITY: 'Writing Community', - CREATIVE_COMMUNITY: 'Creative Community', - CONTACT_AUTHOR: 'Contact Author', - DONATE_SUPPORT: 'Donate & Support', + WRITING_COMMUNITY: 'Writing community', + CREATIVE_COMMUNITY: 'Creative community', + CONTACT_AUTHOR: 'Contact author', + DONATE_SUPPORT: 'Donate & support', // 面板设置 - PANEL_SETTINGS: 'Panel Settings', + PANEL_SETTINGS: 'Panel settings', FEATURE_COMING_SOON: '{feature} feature coming soon' }; // 设置面板翻译 const settingsTranslation: SettingsTranslation = { - SETTINGS_TITLE: 'Book Smith Settings', - BASIC_SETTINGS: 'Basic Settings', - TEMPLATE_SETTINGS: 'Template Settings', - WRITING_TOOLS_SETTINGS: 'Writing Tools Settings', + PLUGIN_NAME: 'Book Smith', + BASIC_OPTIONS: 'Basic options', + TEMPLATE_OPTIONS: 'Template options', + WRITING_TOOLS_OPTIONS: 'Writing tools options', // Basic Settings LANGUAGE_SETTING: 'Language', LANGUAGE_DESC: 'Choose plugin language / 选择插件界面语言', - DEFAULT_AUTHOR: 'Default Author', + DEFAULT_AUTHOR: 'Default author', DEFAULT_AUTHOR_DESC: 'Default author name for new books', DEFAULT_AUTHOR_PLACEHOLDER: 'Enter default author name', - BOOK_STORAGE_PATH: 'Book Storage Path', + BOOK_STORAGE_PATH: 'Book storage path', BOOK_STORAGE_DESC: 'Default storage path for new books', STORAGE_PATH_CHANGED: 'Storage path changed, please restart Obsidian or reload for changes to take effect', // Template Settings - DEFAULT_TEMPLATE: 'Default Template', + DEFAULT_TEMPLATE: 'Default template', DEFAULT_TEMPLATE_DESC: 'Default template used when creating new books', - BOOK_TEMPLATES: 'Book Templates', - ADD_NEW_TEMPLATE: 'Add New Template', - EDIT_TEMPLATE: 'Edit Template', - DELETE_TEMPLATE: 'Delete Template', - DELETE_TEMPLATE_TITLE: 'Delete Template', + BOOK_TEMPLATES: 'Book templates', + ADD_NEW_TEMPLATE: 'Add new template', + EDIT_TEMPLATE: 'Edit template', + DELETE_TEMPLATE: 'Delete template', + DELETE_TEMPLATE_TITLE: 'Delete template', DELETE_TEMPLATE_DESC: 'Are you sure you want to delete this template? This action cannot be undone.', // Writing Tools Settings - FOCUS_MODE_SETTINGS: 'Focus Mode Settings', - FOCUS_DURATION: 'Focus Duration', + FOCUS_MODE_OPTIONS: 'Focus mode options', + FOCUS_DURATION: 'Focus duration', FOCUS_DURATION_DESC: 'Work duration for each focus session (minutes)', - BREAK_DURATION: 'Break Duration', + BREAK_DURATION: 'Break duration', BREAK_DURATION_DESC: 'Break duration after each focus session (minutes)', - WORD_GOAL: 'Word Goal', + WORD_GOAL: 'Word goal', WORD_GOAL_DESC: 'Target word count for each focus session' }; @@ -183,7 +183,7 @@ const modalTranslation: ModalTranslation = { SUBTITLE: 'Subtitle', SUBTITLE_DESC: 'Optional', SUBTITLE_PLACEHOLDER: 'Subtitle', - TARGET_WORDS: 'Target Word Count', + TARGET_WORDS: 'Target word count', TARGET_WORDS_DESC: 'Set estimated total word count (in 10k)', TARGET_WORDS_PLACEHOLDER: 'e.g., 20 or 20.0', AUTHOR: 'Author', @@ -195,10 +195,10 @@ const modalTranslation: ModalTranslation = { REQUIRED_FIELDS: 'Please fill in required fields', // CreateBookModal - CREATE_BOOK_TITLE: 'Create New Book', + CREATE_BOOK_TITLE: 'Create new book', BOOK_TEMPLATE: 'Template', TEMPLATE_CHECK_DESC: 'Please select a book template', - SELECT_IMAGE: 'Select Image', + SELECT_IMAGE: 'Select image', COVER_UPLOAD_SUCCESS: 'Cover uploaded successfully', COVER_UPLOAD_FAILED: 'Cover upload failed: ', CREATE: 'Create', @@ -206,9 +206,9 @@ const modalTranslation: ModalTranslation = { CREATE_FAILED: 'Creation failed: ', // EditBookModal - EDIT_BOOK_TITLE: 'Edit Book', - CHANGE_COVER: 'Change Cover', - SELECT_COVER: 'Select Cover', + EDIT_BOOK_TITLE: 'Edit book', + CHANGE_COVER: 'Change cover', + SELECT_COVER: 'Select cover', COVER_UPDATE_SUCCESS: 'Cover updated successfully', COVER_UPDATE_FAILED: 'Failed to update cover: ', SAVE: 'Save', @@ -216,15 +216,15 @@ const modalTranslation: ModalTranslation = { SAVE_FAILED: 'Save failed: ', // ManageBooksModal - MANAGE_BOOKS_TITLE: 'Manage Books', + MANAGE_BOOKS_TITLE: 'Manage books', SEARCH_BOOKS_PLACEHOLDER: 'Search books...', - IMPORT_BOOK: 'Import Book', + IMPORT_BOOK: 'Import book', BOOK_AUTHOR_PREFIX: 'Author: ', BOOK_DESC_PREFIX: '\nDescription: ', BOOK_PROGRESS_PREFIX: '\nProgress: ', DELETE_BOOK: 'Delete', EDIT_BOOK: 'Edit', - DELETE_BOOK_TITLE: 'Delete Book', + DELETE_BOOK_TITLE: 'Delete book', DELETE_BOOK_DESC: 'Are you sure you want to delete "{title}"?\nThis action cannot be undone.', DELETE_SUCCESS: 'Deleted successfully', DELETE_FAILED: 'Delete failed: ', @@ -235,16 +235,16 @@ const modalTranslation: ModalTranslation = { IMPORT_FAILED: 'Failed to create book configuration: ', // SwitchBookModal - SWITCH_BOOK_TITLE: 'Switch Book', + SWITCH_BOOK_TITLE: 'Switch book', SEARCH_BOOK_PLACEHOLDER: 'Search books...', BOOK_AUTHOR_LABEL: 'Author', BOOK_PROGRESS_LABEL: 'Progress', BOOK_WORDCOUNT_LABEL: 'Words', - BOOK_LASTMOD_LABEL: 'Last Modified', + BOOK_LASTMOD_LABEL: 'Last modified', SELECT_BOOK: 'Select', // UnimportedBooksModal - UNIMPORTED_BOOKS_TITLE: 'Select Book Directory to Import', + UNIMPORTED_BOOKS_TITLE: 'Select book directory to import', NO_UNIMPORTED_FOLDERS: 'No unimported book directories found', CLOSE: 'Close', SEARCH_FOLDERS_PLACEHOLDER: 'Search directories...', @@ -253,8 +253,8 @@ const modalTranslation: ModalTranslation = { SELECT_FOLDER_FIRST: 'Please select a directory first', // ReferenceModal - REFERENCE_MODAL_TITLE: 'Add Reference', - REFERENCE_CONTENT: 'Reference Content', + REFERENCE_MODAL_TITLE: 'Add reference', + REFERENCE_CONTENT: 'Reference content', REFERENCE_CONTENT_DESC: 'Please enter the details of the reference', // NamePromptModal @@ -263,18 +263,18 @@ const modalTranslation: ModalTranslation = { CANCEL: 'Cancel', // TemplateEditModal - TEMPLATE_EDIT_TITLE: 'Edit Template', - TEMPLATE_CREATE_TITLE: 'Create Template', - TEMPLATE_NAME: 'Template Name', + TEMPLATE_EDIT_TITLE: 'Edit template', + TEMPLATE_CREATE_TITLE: 'Create template', + TEMPLATE_NAME: 'Template name', TEMPLATE_NAME_PLACEHOLDER: 'Enter template name', - TEMPLATE_DESC: 'Template Description', + TEMPLATE_DESC: 'Template description', TEMPLATE_DESC_PLACEHOLDER: 'Describe the template structure', - TEMPLATE_STRUCTURE: 'Chapter Tree', - ADD_FILE: 'Add File', - ADD_FOLDER: 'Add Folder', + TEMPLATE_STRUCTURE: 'Chapter tree', + ADD_FILE: 'Add file', + ADD_FOLDER: 'Add folder', DELETE_FOLDER_CONFIRM: 'Are you sure you want to delete this folder and all its contents?', - NEW_CHAPTER: 'New Chapter', - NEW_DIRECTORY: 'New Directory', + NEW_CHAPTER: 'New chapter', + NEW_DIRECTORY: 'New directory', ENTER_NAME_PLACEHOLDER: 'Enter name', TEMPLATE_NAME_REQUIRED: 'Please enter template name', TEMPLATE_NODE_REQUIRED: 'Please add at least one node', @@ -282,6 +282,7 @@ const modalTranslation: ModalTranslation = { TEMPLATE_SAVE_SUCCESS: 'Template saved successfully', TEMPLATE_SAVE_FAILED: 'Failed to save template, check console for details' }; + const managerTranslation: ManagerTranslation = { // BookManager related BOOK_EXISTS: 'Book already exists', @@ -289,7 +290,7 @@ const managerTranslation: ManagerTranslation = { BOOK_FOLDER_NOT_FOUND: 'Book folder not found', SAVE_CONFIG_FAILED: 'Failed to save configuration file', IMPORT_BOOK_FAILED: 'Failed to import book', - UNKNOWN_AUTHOR: 'Unknown Author', + UNKNOWN_AUTHOR: 'Unknown author', // TemplateManager related TEMPLATE_TYPE_NOT_FOUND: 'Template "{type}" does not exist', @@ -314,27 +315,28 @@ const managerTranslation: ManagerTranslation = { CHAPTER_INFO_ERROR: 'Unable to get current chapter information', // ReferenceManager 菜单项 - EDIT_REFERENCE: 'Edit Reference', - DELETE_REFERENCE: 'Delete Reference', - INSERT_REFERENCE: 'Insert Reference' + EDIT_REFERENCE: 'Edit reference', + DELETE_REFERENCE: 'Delete reference', + INSERT_REFERENCE: 'Insert reference' }; + const toolbarModalTranslation: ToolbarModalTranslation = { // CommunityModal - COMMUNITY_TITLE: 'Writing Community', + COMMUNITY_TITLE: 'Writing community', COMMUNITY_INTRO: 'Join the Billion Writes community to connect with other writers, get inspiration and feedback.', - FEATURE_SHARE_TITLE: 'Share Works', + FEATURE_SHARE_TITLE: 'Share works', FEATURE_SHARE_DESC: 'Share your creations and get reader feedback', - FEATURE_DISCUSS_TITLE: 'Writing Exchange', + FEATURE_DISCUSS_TITLE: 'Writing exchange', FEATURE_DISCUSS_DESC: 'Discuss writing techniques with other creators', - FEATURE_CHALLENGE_TITLE: 'Writing Challenges', + FEATURE_CHALLENGE_TITLE: 'Writing challenges', FEATURE_CHALLENGE_DESC: 'Participate in community writing challenges to improve your skills', - JOIN_SECTION_TITLE: 'How to Join', + JOIN_SECTION_TITLE: 'How to join', JOIN_SECTION_DESC: 'Copy and search the official account below', - OFFICIAL_ACCOUNT: 'Official Account: BilionWrites', - COPY_ACCOUNT: 'Copy Account', + OFFICIAL_ACCOUNT: 'Official account: BilionWrites', + COPY_ACCOUNT: 'Copy account', // ContactModal - ABOUT_AUTHOR: 'About Author', + ABOUT_AUTHOR: 'About author', AUTHOR_INTRO_1: 'Hello, I\'m Yeban, a full-time writer and independent developer.', AUTHOR_INTRO_2_1: 'This plugin is ', AUTHOR_INTRO_2_2: 'a tool I developed to help authors write long-form content in Obsidian', @@ -348,7 +350,7 @@ const toolbarModalTranslation: ToolbarModalTranslation = { DONATE_BUTTON: 'Support', MORE_INFO_TEXT: 'If you want to learn more about writing, creative techniques, or follow my future work updates, welcome to follow my social media.', CONTACT_TITLE: 'Contact:', - CONTACT_WECHAT_OFFICIAL: 'WeChat Official', + CONTACT_WECHAT_OFFICIAL: 'WeChat official', CONTACT_XIAOHONGSHU: 'Xiaohongshu', CONTACT_WECHAT: 'WeChat', CONTACT_GITHUB: 'GitHub', @@ -356,8 +358,8 @@ const toolbarModalTranslation: ToolbarModalTranslation = { COPY_FAILED: 'Copy failed, please copy manually: {value}', // DonateModal - DONATE_MODAL_TITLE: 'Support Me', - COMMUNITY_STATS_TITLE: 'Community Stats', + DONATE_MODAL_TITLE: 'Support me', + COMMUNITY_STATS_TITLE: 'Community stats', COMMUNITY_STATS_USERS: '1200+ users, 32 supporters', COMMUNITY_STATS_WORDS: '5000+ words written daily', @@ -366,32 +368,33 @@ const toolbarModalTranslation: ToolbarModalTranslation = { DONATE_AMOUNT_FEATURE: 'Feature builder', DONATE_FEEDBACK_COFFEE: 'Thanks for your coffee support!', DONATE_FEEDBACK_CHAPTER: 'You get one vote for new features', - DONATE_FEEDBACK_FEATURE: 'Join our beta testing group, contact via WeChat Official Account', + DONATE_FEEDBACK_FEATURE: 'Join our beta testing group, contact via WeChat official account', - PAYMENT_WECHAT: 'WeChat Pay', + PAYMENT_WECHAT: 'WeChat pay', PAYMENT_ALIPAY: 'Alipay', PAYMENT_KOFI: 'Ko-fi', CURRENCY_UNIT: 'CNY' }; + const componentTranslation: ComponentTranslation = { // ChapterTree - NEW_FILE: 'New File', - NEW_FOLDER: 'New Folder', + NEW_FILE: 'New file', + NEW_FOLDER: 'New folder', ENTER_FILE_NAME: 'Enter file name', ENTER_FOLDER_NAME: 'Enter folder name', - OPEN_IN_NEW_TAB: 'Open in New Tab', - OPEN_IN_NEW_PANE: 'Open in New Pane', - MARK_AS_COMPLETE: 'Mark as Complete', - MARK_AS_DRAFT: 'Mark as Draft', - EXCLUDE_FROM_STATS: 'Exclude from Stats', - INCLUDE_IN_STATS: 'Include in Stats', - CREATE_COPY: 'Create Copy', - COPY_NAME: '{name} Copy', + OPEN_IN_NEW_TAB: 'Open in new tab', + OPEN_IN_NEW_PANE: 'Open in new pane', + MARK_AS_COMPLETE: 'Mark as complete', + MARK_AS_DRAFT: 'Mark as draft', + EXCLUDE_FROM_STATS: 'Exclude from stats', + INCLUDE_IN_STATS: 'Include in stats', + CREATE_COPY: 'Create copy', + COPY_NAME: '{name} copy', RENAME: 'Rename', DELETE: 'Delete', - DELETE_FILE_TITLE: 'Delete File', + DELETE_FILE_TITLE: 'Delete file', DELETE_FILE_DESC: 'Are you sure you want to delete "{title}"?\nIt will be moved to system trash.', - DELETE_FOLDER_TITLE: 'Delete Folder', + DELETE_FOLDER_TITLE: 'Delete folder', DELETE_FOLDER_DESC: 'Are you sure you want to delete folder "{title}" and all its contents?\nThey will be moved to system trash.', COPY_SUCCESS: 'Copy created successfully', COPY_FAILED: 'Failed to create copy: {error}', @@ -408,14 +411,14 @@ const componentTranslation: ComponentTranslation = { ENTER_NEW_NAME: 'Enter new name', // FocusToolView - FOCUS_MODE: 'Focus Mode', - START_FOCUS: 'Start Focus', + FOCUS_MODE: 'Focus mode', + START_FOCUS: 'Start focus', EXIT: 'Exit', - FOCUS_SESSIONS: 'Focus Sessions', + FOCUS_SESSIONS: 'Focus sessions', INTERRUPTIONS: 'Interruptions', - CURRENT_WORDS: 'Current Words', - WORD_GOAL: 'Word Goal', - TOTAL_FOCUS_WORDS: 'Total Focus Words', + CURRENT_WORDS: 'Current words', + WORD_GOAL: 'Word goal', + TOTAL_FOCUS_WORDS: 'Total focus words', PAUSE: 'Pause', RESUME: 'Resume', END: 'End', @@ -424,14 +427,14 @@ const componentTranslation: ComponentTranslation = { ENCOURAGEMENT_3: '🌟 Perfect! Goal reached! Maintain this enthusiasm!', ENCOURAGEMENT_4: '🎯 Goal achieved! Your persistence is admirable!', ENCOURAGEMENT_5: '💪 Outstanding performance! Goal completed! Keep going!', - EXIT_FOCUS: 'Exit Focus', + EXIT_FOCUS: 'Exit focus', EXIT_FOCUS_DESC: 'Are you sure you want to exit? Current focus progress will be lost.', - END_FOCUS: 'End Focus', + END_FOCUS: 'End focus', END_FOCUS_DESC: 'Are you sure you want to end focus? This will count as an interruption.', FOCUSING: 'Focusing', PAUSED: 'Paused', - BREAK_TIME: 'Break Time', - READY_TO_START: 'Ready to Start' + BREAK_TIME: 'Break time', + READY_TO_START: 'Ready to start' }; // 合并所有翻译 const translation: Translation = { diff --git a/src/i18n/locales/zh-CN.ts b/src/i18n/locales/zh-CN.ts index a31b8df..133f1b9 100644 --- a/src/i18n/locales/zh-CN.ts +++ b/src/i18n/locales/zh-CN.ts @@ -137,10 +137,10 @@ const toolViewTranslation: ToolViewTranslation = { // 设置面板翻译 const settingsTranslation: SettingsTranslation = { - SETTINGS_TITLE: 'Book Smith 设置', - BASIC_SETTINGS: '基本设置', - TEMPLATE_SETTINGS: '模板设置', - WRITING_TOOLS_SETTINGS: '写作工具箱设置', + PLUGIN_NAME: 'Book Smith', + BASIC_OPTIONS: '基本选项', + TEMPLATE_OPTIONS: '模板选项', + WRITING_TOOLS_OPTIONS: '写作工具箱选项', // 基本设置 LANGUAGE_SETTING: '语言', @@ -163,7 +163,7 @@ const settingsTranslation: SettingsTranslation = { DELETE_TEMPLATE_DESC: '确定要删除此模板吗?删除后无法恢复。', // 写作工具箱设置 - FOCUS_MODE_SETTINGS: '专注模式设置', + FOCUS_MODE_OPTIONS: '专注模式选项', FOCUS_DURATION: '专注时长', FOCUS_DURATION_DESC: '每个专注周期的工作时长(分钟)', BREAK_DURATION: '间隔时长', diff --git a/src/main.ts b/src/main.ts index 1544c8a..7c05f2b 100644 --- a/src/main.ts +++ b/src/main.ts @@ -16,9 +16,7 @@ export default class BookSmithPlugin extends Plugin { statsManager: BookStatsManager; async onload() { - await this.loadSettings(); - i18n.setLocale(this.settings.language); - + await this.loadSettings(); // 初始化所有管理器 this.bookManager = new BookManager(this.app, this.settings); this.statsManager = new BookStatsManager(this.app, this, this.bookManager); diff --git a/src/modals/DonateModal.ts b/src/modals/DonateModal.ts index 768e5d4..6b189d2 100644 --- a/src/modals/DonateModal.ts +++ b/src/modals/DonateModal.ts @@ -1,8 +1,8 @@ -import { Notice } from "obsidian"; import { BaseModal } from "./BaseModal"; import { WechatQRCode } from '../assets/wechat-qrcode'; import { AlipayQRCode } from '../assets/alipay-qrcode'; import { i18n } from '../i18n/i18n'; +import { kofiImage } from '../assets/kofi3'; export class DonateModal extends BaseModal { private selectedAmount: number = 6; @@ -107,7 +107,7 @@ export class DonateModal extends BaseModal { }); kofiLink.createEl('img', { attr: { - src: 'https://storage.ko-fi.com/cdn/kofi3.png?v=3', + src: kofiImage, alt: i18n.t('PAYMENT_KOFI'), style: 'height: 50px;' } diff --git a/src/settings/SettingTab.ts b/src/settings/SettingTab.ts index 97ea0fb..9ec1846 100644 --- a/src/settings/SettingTab.ts +++ b/src/settings/SettingTab.ts @@ -16,33 +16,12 @@ export class BookSmithSettingTab extends PluginSettingTab { private createSection(containerEl: HTMLElement, title: string, renderContent: (contentEl: HTMLElement) => void) { const section = containerEl.createDiv('settings-section'); const header = section.createDiv('settings-section-header'); + new Setting(header).setName(title).setHeading(); - const toggle = header.createSpan('settings-section-toggle'); - setIcon(toggle, 'chevron-right'); - - header.createEl('h4', { text: title }); - + const content = section.createDiv('settings-section-content'); renderContent(content); - - header.addEventListener('click', () => { - const isExpanded = !section.hasClass('is-expanded'); - section.toggleClass('is-expanded', isExpanded); - setIcon(toggle, isExpanded ? 'chevron-down' : 'chevron-right'); - if (isExpanded) { - this.expandedSections.add(title); - } else { - this.expandedSections.delete(title); - } - }); - - // 根据保存的状态或默认第一个展开 - if (this.expandedSections.has(title) || (!containerEl.querySelector('.settings-section'))) { - section.addClass('is-expanded'); - setIcon(toggle, 'chevron-down'); - this.expandedSections.add(title); - } - + return section; } @@ -50,37 +29,19 @@ export class BookSmithSettingTab extends PluginSettingTab { const { containerEl } = this; containerEl.empty(); containerEl.addClass('book-smith-settings'); - - containerEl.createEl('h2', { text: i18n.t('SETTINGS_TITLE') }); // 基本设置 - this.createSection(containerEl, i18n.t('BASIC_SETTINGS'), el => this.renderBasicSettings(el)); + this.createSection(containerEl, i18n.t('BASIC_OPTIONS'), el => this.renderBasicSettings(el)); // 模板设置 - this.createSection(containerEl, i18n.t('TEMPLATE_SETTINGS'), el => this.renderTemplateSettings(el)); + this.createSection(containerEl, i18n.t('TEMPLATE_OPTIONS'), el => this.renderTemplateSettings(el)); // 写作工具箱设置 - this.createSection(containerEl, i18n.t('WRITING_TOOLS_SETTINGS'), el => this.renderWritingToolsSettings(el)); + this.createSection(containerEl, i18n.t('WRITING_TOOLS_OPTIONS'), el => this.renderWritingToolsSettings(el)); } private renderBasicSettings(containerEl: HTMLElement): void { // 添加语言选择 - new Setting(containerEl) - .setName(i18n.t('LANGUAGE_SETTING')) - .setDesc(i18n.t('LANGUAGE_DESC')) - .addDropdown(dropdown => { - dropdown - .addOption('zh-CN', '简体中文') - .addOption('en', 'English') - .setValue(this.plugin.settings.language) - .onChange(async (value: Locale) => { - this.plugin.settings.language = value; - i18n.setLocale(value); - await this.plugin.saveSettings(); - this.display(); - }); - }); - new Setting(containerEl) .setName(i18n.t('DEFAULT_AUTHOR')) .setDesc(i18n.t('DEFAULT_AUTHOR_DESC')) @@ -124,8 +85,8 @@ export class BookSmithSettingTab extends PluginSettingTab { // 模板列表 const templateList = containerEl.createDiv('template-list'); - templateList.createEl('h4', { text: i18n.t('BOOK_TEMPLATES') }); - + + new Setting(templateList).setName(i18n.t('BOOK_TEMPLATES')).setHeading(); // 渲染其他自定义模板 Object.entries(this.plugin.settings.templates.custom) .filter(([key]) => key !== 'default') @@ -179,8 +140,8 @@ export class BookSmithSettingTab extends PluginSettingTab { private renderWritingToolsSettings(containerEl: HTMLElement): void { // 专注模式设置 const focusSection = containerEl.createDiv(); - focusSection.createEl('h4', { text: i18n.t('FOCUS_MODE_SETTINGS') }); - + new Setting(focusSection).setName(i18n.t('FOCUS_MODE_OPTIONS')).setHeading(); + new Setting(focusSection) .setName(i18n.t('FOCUS_DURATION')) .setDesc(i18n.t('FOCUS_DURATION_DESC')) diff --git a/src/settings/settings.ts b/src/settings/settings.ts index 55ca737..3b72e62 100644 --- a/src/settings/settings.ts +++ b/src/settings/settings.ts @@ -1,9 +1,7 @@ import { defaultTemplate } from '../templates/default'; import { ChapterTree } from '../types/book'; -import { Locale } from '../i18n/i18n'; export interface BookSmithSettings { // 基础配置 - language: Locale; defaultAuthor: string; defaultBookPath: string; lastBookId?: string; @@ -46,7 +44,6 @@ export interface BookSmithSettings { } export const DEFAULT_SETTINGS: BookSmithSettings = { - language: 'zh-CN', // 默认中文 defaultAuthor: 'Yeban', defaultBookPath: 'books', lastBookId: '', diff --git a/src/styles/settings/settings-tab.css b/src/styles/settings/settings-tab.css index 534b3fe..4d6fe9a 100644 --- a/src/styles/settings/settings-tab.css +++ b/src/styles/settings/settings-tab.css @@ -1,18 +1,3 @@ -/* 整体容器 */ -.book-smith-settings { - max-width: 800px; - margin: 0 auto; - padding: 10px 20px; -} - -/* 标题样式 */ -.book-smith-settings h2 { - margin: 20px 5px; - padding-bottom: 1rem; - border-bottom: 2px solid var(--background-modifier-border); - font-size: 1.4em; -} - /* 通用设置区块样式 */ .book-smith-settings .settings-section { margin-bottom: 1.5rem; @@ -24,36 +9,16 @@ .book-smith-settings .settings-section-header { display: flex; align-items: center; - cursor: pointer; - padding: 1rem; + padding: 1rem 1rem 0 1rem; background-color: var(--background-secondary); - transition: background-color 0.2s ease; -} - -.book-smith-settings .settings-section-header:hover { - background-color: var(--background-secondary-alt); -} - -.book-smith-settings .settings-section-header h4 { - margin: 0; - flex: 1; -} - -.book-smith-settings .settings-section-toggle { - margin-right: 0.5rem; } .book-smith-settings .settings-section-content { - display: none; padding: 1rem; padding: 0 40px; background-color: var(--background-primary); } -.book-smith-settings .settings-section.is-expanded .settings-section-content { - display: block; -} - /* 模板设置特有样式 */ .book-smith-settings .template-list { padding: 10px 0;