TUIGlobalization.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. * Get localized strings in TUIKit
  12. */
  13. #define TUIKitLocalizableString(key) [TUIGlobalization getLocalizedStringForKey:@"" #key "" bundle:TUIKitLocalizableBundle]
  14. #define TUICoreLocalizableString(key) [TUIGlobalization getLocalizedStringForKey:@"" #key "" bundle:TUICoreLocalizableBundle]
  15. #define TUIChatLocalizableString(key) [TUIGlobalization getLocalizedStringForKey:@"" #key "" bundle:TUIChatLocalizableBundle]
  16. #define TUIConversationLocalizableString(key) [TUIGlobalization getLocalizedStringForKey:@"" #key "" bundle:TUIConversationLocalizableBundle]
  17. #define TUIContactLocalizableString(key) [TUIGlobalization getLocalizedStringForKey:@"" #key "" bundle:TUIContactLocalizableBundle]
  18. #define TUISearchLocalizableString(key) [TUIGlobalization getLocalizedStringForKey:@"" #key "" bundle:TUISearchLocalizableBundle]
  19. #define TIMCommonLocalizableString(key) [TUIGlobalization getLocalizedStringForKey:@"" #key "" bundle:TIMCommonLocalizableBundle]
  20. #define isRTL() [TUIGlobalization getRTLOption]
  21. #define TUICustomLanguageKey @"TUICustomLanguageKey"
  22. #define TUIChangeLanguageNotification @"TUIChangeLanguageNotification"
  23. #define TUIKitGlobalizationRTLOptionKey @"TUIKitGlobalizationRTLOptionKey"
  24. @interface TUIGlobalization : NSObject
  25. /**
  26. * Get localized string
  27. */
  28. + (NSString *)getLocalizedStringForKey:(NSString *)key bundle:(NSString *)bundleName;
  29. /**
  30. * Get preferred language
  31. */
  32. + (NSString *)getPreferredLanguage;
  33. /**
  34. * Set the preferred language to the specified value.
  35. */
  36. + (void)setPreferredLanguage:(NSString *)language;
  37. + (void)setRTLOption:(BOOL)op;
  38. + (BOOL)getRTLOption;
  39. #pragma mark - Deprecated
  40. + (NSString *)g_localizedStringForKey:(NSString *)key bundle:(NSString *)bundleName __attribute__((deprecated("use getLocalizedStringForKey:bundle:")));
  41. + (NSString *)tk_localizableLanguageKey __attribute__((deprecated("use getPreferredLanguage")));
  42. + (void)ignoreTraditionChinese:(BOOL)ignore __attribute__((deprecated("traditional chinese is now supported by the TUIKit component, and the current API has been deprecated")));
  43. @end