From 1f8748375c3c6a3ef6a9b5b277bd49e3e9d3a55c Mon Sep 17 00:00:00 2001 From: sunnylqm Date: Fri, 17 Oct 2025 16:03:54 +0800 Subject: [PATCH] Enhance Pushy class to support locale configuration in i18n initialization by adding optional locale property to ClientOptions interface. --- src/client.ts | 3 +-- src/type.ts | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/client.ts b/src/client.ts index d0cf554..8c4c9ab 100644 --- a/src/client.ts +++ b/src/client.ts @@ -110,8 +110,7 @@ export class Pushy { this.clientType = clientType || 'Pushy'; this.options.server = SERVER_PRESETS[this.clientType]; - // Initialize i18n based on clientType - i18n.setLocale(this.clientType === 'Pushy' ? 'zh' : 'en'); + i18n.setLocale(options.locale ?? this.clientType === 'Pushy' ? 'zh' : 'en'); if (Platform.OS === 'ios' || Platform.OS === 'android') { if (!options.appKey) { diff --git a/src/type.ts b/src/type.ts index 28aa6ea..e2e01b0 100644 --- a/src/type.ts +++ b/src/type.ts @@ -86,6 +86,7 @@ export interface ClientOptions { appKey: string; server?: UpdateServerConfig; logger?: UpdateEventsLogger; + locale?: 'zh' | 'en'; updateStrategy?: | 'alwaysAlert' | 'alertUpdateAndIgnoreError'