1
0
mirror of https://gitcode.com/gh_mirrors/re/react-native-pushy.git synced 2025-10-24 01:58:53 +08:00
Code Issues Packages Projects Releases Wiki Activity GitHub Gitee

Enhance Pushy class to support locale configuration in i18n initialization by adding optional locale property to ClientOptions interface.

This commit is contained in:
sunnylqm
2025-10-17 16:03:54 +08:00
parent fa731cd583
commit 1f8748375c
2 changed files with 2 additions and 2 deletions

View File

@@ -110,8 +110,7 @@ export class Pushy {
this.clientType = clientType || 'Pushy'; this.clientType = clientType || 'Pushy';
this.options.server = SERVER_PRESETS[this.clientType]; this.options.server = SERVER_PRESETS[this.clientType];
// Initialize i18n based on clientType i18n.setLocale(options.locale ?? this.clientType === 'Pushy' ? 'zh' : 'en');
i18n.setLocale(this.clientType === 'Pushy' ? 'zh' : 'en');
if (Platform.OS === 'ios' || Platform.OS === 'android') { if (Platform.OS === 'ios' || Platform.OS === 'android') {
if (!options.appKey) { if (!options.appKey) {

View File

@@ -86,6 +86,7 @@ export interface ClientOptions {
appKey: string; appKey: string;
server?: UpdateServerConfig; server?: UpdateServerConfig;
logger?: UpdateEventsLogger; logger?: UpdateEventsLogger;
locale?: 'zh' | 'en';
updateStrategy?: updateStrategy?:
| 'alwaysAlert' | 'alwaysAlert'
| 'alertUpdateAndIgnoreError' | 'alertUpdateAndIgnoreError'