TUIGlobalization.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. //
  2. // NSBundle+TUIKIT.h
  3. // Pods
  4. //
  5. // Created by harvy on 2020/10/9.
  6. // Copyright © 2023 Tencent. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import "TUIDefine.h"
  10. /**
  11. * TUIKit 字符串国际化
  12. * Get localized strings in TUIKit
  13. */
  14. #define TUIKitLocalizableString(key) [TUIGlobalization getLocalizedStringForKey:@"" #key "" bundle:TUIKitLocalizableBundle]
  15. #define TUICoreLocalizableString(key) [TUIGlobalization getLocalizedStringForKey:@"" #key "" bundle:TUICoreLocalizableBundle]
  16. #define TUIChatLocalizableString(key) [TUIGlobalization getLocalizedStringForKey:@"" #key "" bundle:TUIChatLocalizableBundle]
  17. #define TUIConversationLocalizableString(key) [TUIGlobalization getLocalizedStringForKey:@"" #key "" bundle:TUIConversationLocalizableBundle]
  18. #define TUIContactLocalizableString(key) [TUIGlobalization getLocalizedStringForKey:@"" #key "" bundle:TUIContactLocalizableBundle]
  19. #define TUIGroupLocalizableString(key) [TUIGlobalization getLocalizedStringForKey:@"" #key "" bundle:TUIGroupLocalizableBundle]
  20. #define TUISearchLocalizableString(key) [TUIGlobalization getLocalizedStringForKey:@"" #key "" bundle:TUISearchLocalizableBundle]
  21. #define TIMCommonLocalizableString(key) [TUIGlobalization getLocalizedStringForKey:@"" #key "" bundle:TIMCommonLocalizableBundle]
  22. #define TUICustomLanguageKey @"TUICustomLanguageKey"
  23. #define TUIChangeLanguageNotification @"TUIChangeLanguageNotification"
  24. @interface TUIGlobalization : NSObject
  25. /**
  26. * 获取本地化字符串
  27. * Get localized string
  28. */
  29. + (NSString *)getLocalizedStringForKey:(NSString *)key bundle:(NSString *)bundleName;
  30. /**
  31. * 获取首选语言
  32. * Get preferred language
  33. */
  34. + (NSString *)getPreferredLanguage;
  35. /**
  36. * 将首选语言设置为指定的值
  37. * Set the preferred language to the specified value.
  38. */
  39. + (void)setPreferredLanguage:(NSString *)language;
  40. /**
  41. * 忽略繁体中文,改用简体中文
  42. * Ignore traditional chinese and switch to simplified chinese
  43. */
  44. + (void)ignoreTraditionChinese:(BOOL)ignore;
  45. #pragma mark - Deprecated
  46. + (NSString *)g_localizedStringForKey:(NSString *)key bundle:(NSString *)bundleName __attribute__((deprecated("use getLocalizedStringForKey:bundle:")));
  47. + (NSString *)tk_localizableLanguageKey __attribute__((deprecated("use getPreferredLanguage")));
  48. @end