cdts/xdts-ios 3/TreeHole/Code/Features/Chat/UIPatch/TUIGlobalization+TUIPatch.m
2023-07-27 09:20:00 +08:00

39 lines
1.1 KiB
Objective-C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// TUIGlobalization+TUIPatch.m
// Youth
//
// Created by mambaxie on 2022/2/22.
//
#import "TUIGlobalization+TUIPatch.h"
#import <JRSwizzle.h>
#import "NSObject+BKAssociatedObjects.h"
@implementation TUIGlobalization (TUIPatch)
+ (void)load {
NSError *error;
[self jr_swizzleClassMethod:@selector(patch_g_localizedStringForKey:bundle:) withClassMethod:@selector(g_localizedStringForKey:bundle:) error:&error];
if (error) {
NSLog(@"patch TUI error: %@", error);
}
}
// 字符串国际化bundle 的格式参考 TUIKitLocalizable.bundle
+ (NSString *)patch_g_localizedStringForKey:(NSString *)key bundle:(NSString *)bundleName {
if ([key isEqualToString:@"TUIKitGroupProfileStickyOnTop"] || [key isEqualToString:@"StickyonTop"]) {
return @"置顶聊天";
}
if ([key isEqualToString:@"CancelStickonTop"]) {
return @"取消置顶";
}
if ([key isEqualToString:@"TUIKitInputHoldToTalk"]) {
return @"按住 发送语音";
}
return [self patch_g_localizedStringForKey:key bundle:bundleName];
}
@end