RCTI18nManager.m 926 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /**
  2. * Copyright (c) Facebook, Inc. and its affiliates.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. */
  7. #import "RCTI18nManager.h"
  8. #import "RCTI18nUtil.h"
  9. @implementation RCTI18nManager
  10. RCT_EXPORT_MODULE()
  11. + (BOOL)requiresMainQueueSetup
  12. {
  13. return NO;
  14. }
  15. RCT_EXPORT_METHOD(allowRTL:(BOOL)value)
  16. {
  17. [[RCTI18nUtil sharedInstance] allowRTL:value];
  18. }
  19. RCT_EXPORT_METHOD(forceRTL:(BOOL)value)
  20. {
  21. [[RCTI18nUtil sharedInstance] forceRTL:value];
  22. }
  23. RCT_EXPORT_METHOD(swapLeftAndRightInRTL:(BOOL)value)
  24. {
  25. [[RCTI18nUtil sharedInstance] swapLeftAndRightInRTL:value];
  26. }
  27. - (NSDictionary *)constantsToExport
  28. {
  29. return [self getConstants];
  30. }
  31. - (NSDictionary *)getConstants
  32. {
  33. return @{
  34. @"isRTL": @([[RCTI18nUtil sharedInstance] isRTL]),
  35. @"doLeftAndRightSwapInRTL": @([[RCTI18nUtil sharedInstance] doLeftAndRightSwapInRTL])
  36. };
  37. }
  38. @end