Skip to content

Commit 1f87483

Browse files
committed
Enhance Pushy class to support locale configuration in i18n initialization by adding optional locale property to ClientOptions interface.
1 parent fa731cd commit 1f87483

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/client.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,7 @@ export class Pushy {
110110
this.clientType = clientType || 'Pushy';
111111
this.options.server = SERVER_PRESETS[this.clientType];
112112

113-
// Initialize i18n based on clientType
114-
i18n.setLocale(this.clientType === 'Pushy' ? 'zh' : 'en');
113+
i18n.setLocale(options.locale ?? this.clientType === 'Pushy' ? 'zh' : 'en');
115114

116115
if (Platform.OS === 'ios' || Platform.OS === 'android') {
117116
if (!options.appKey) {

src/type.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ export interface ClientOptions {
8686
appKey: string;
8787
server?: UpdateServerConfig;
8888
logger?: UpdateEventsLogger;
89+
locale?: 'zh' | 'en';
8990
updateStrategy?:
9091
| 'alwaysAlert'
9192
| 'alertUpdateAndIgnoreError'

0 commit comments

Comments
 (0)