From e6e7df74546079b357998ac3fcd485ece99c3e8a Mon Sep 17 00:00:00 2001 From: Will Miao Date: Mon, 3 Nov 2025 18:00:25 +0800 Subject: [PATCH] feat: add Chinese localization for community support banner - Update zh-CN locale with Chinese text for community support section - Add support for Afdian platform for Chinese users alongside existing Ko-fi - Implement language-based URL routing for support links and tutorials - Chinese users now see localized content with appropriate payment options (Alipay/WeChat) - Maintains existing functionality for non-Chinese users --- locales/zh-CN.json | 8 ++++---- static/js/managers/BannerService.js | 13 +++++++++++-- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/locales/zh-CN.json b/locales/zh-CN.json index ba27192c..0d715b9a 100644 --- a/locales/zh-CN.json +++ b/locales/zh-CN.json @@ -1395,10 +1395,10 @@ "seconds": "秒后刷新" }, "communitySupport": { - "title": "Keep LoRA Manager Thriving with Your Support ❤️", - "content": "LoRA Manager is a passion project maintained full-time by a solo developer. Your support on Ko-fi helps cover development costs, keeps new updates coming, and unlocks a license key for the LM Civitai Extension as a thank-you gift. Every contribution truly makes a difference.", - "supportCta": "Support on Ko-fi", - "learnMore": "LM Civitai Extension Tutorial" + "title": "LM 浏览器插件限时优惠 ⚡", + "content": "来爱发电为Lora Manager项目发电,支持项目持续开发的同时,获取浏览器插件验证码,按季支付更优惠!支付宝/微信方便支付。感谢支持!🚀", + "supportCta": "为LM发电", + "learnMore": "浏览器插件教程" } } } diff --git a/static/js/managers/BannerService.js b/static/js/managers/BannerService.js index 77bc3add..2261e267 100644 --- a/static/js/managers/BannerService.js +++ b/static/js/managers/BannerService.js @@ -4,6 +4,7 @@ import { removeStorageItem } from '../utils/storageHelpers.js'; import { translate } from '../utils/i18nHelpers.js'; +import { state } from '../state/index.js' const COMMUNITY_SUPPORT_BANNER_ID = 'community-support'; const COMMUNITY_SUPPORT_BANNER_DELAY_MS = 5 * 24 * 60 * 60 * 1000; // 5 days @@ -13,6 +14,7 @@ const COMMUNITY_SUPPORT_VERSION_KEY = 'community_support_banner_state_version'; const COMMUNITY_SUPPORT_STATE_VERSION = 'v2'; const COMMUNITY_SUPPORT_SHOWN_KEY_LEGACY = 'community_support_banner_shown'; const KO_FI_URL = 'https://ko-fi.com/pixelpawsai'; +const AFDIAN_URL = 'https://afdian.com/a/pixelpawsai'; const BANNER_HISTORY_KEY = 'banner_history'; const BANNER_HISTORY_VIEWED_AT_KEY = 'banner_history_viewed_at'; const BANNER_HISTORY_LIMIT = 20; @@ -271,6 +273,13 @@ class BannerService { this.communitySupportBannerRegistered = true; + // Determine support URL based on user language + const currentLanguage = state.global.settings.language; + const supportUrl = currentLanguage === 'zh-CN' ? AFDIAN_URL : KO_FI_URL; + const tutorialUrl = currentLanguage === 'zh-CN' + ? 'https://github.com/willmiao/ComfyUI-Lora-Manager/wiki/Lora-Manager-%E6%B5%8F%E8%A7%88%E5%99%A8%E6%8F%92%E4%BB%B6' + : 'https://github.com/willmiao/ComfyUI-Lora-Manager/wiki/LoRA-Manager-Civitai-Extension-(Chrome-Extension)'; + this.registerBanner(COMMUNITY_SUPPORT_BANNER_ID, { id: COMMUNITY_SUPPORT_BANNER_ID, title: translate( @@ -291,7 +300,7 @@ class BannerService { 'Support on Ko-fi' ), icon: 'fas fa-heart', - url: KO_FI_URL, + url: supportUrl, type: 'primary' }, { @@ -301,7 +310,7 @@ class BannerService { 'LM Civitai Extension Tutorial' ), icon: 'fas fa-book', - url: 'https://github.com/willmiao/ComfyUI-Lora-Manager/wiki/LoRA-Manager-Civitai-Extension-(Chrome-Extension)', + url: tutorialUrl, type: 'tertiary' } ],