zoontek / zoontek/react-native-localize

[iOS] Get store locale country code

Open
#300 2 comments 0 reactions 1 assignee View on GitHub

@zoontek is already working on this.

Since Jul 2, 2025.

feature request
Dominant language
TypeScript
Stars
2.4k
Forks
225
Avg merge
4d 15h
Merged PRs (30d)
3

Description

Why it is needed?

It would be nice if this library exposed the iOS countryCode for the App Store, as this can change the localization of content as well.

Something like https://developer.apple.com/documentation/storekit/storefront/countrycode

Possible implementation
import Foundation
import React
import StoreKit

@objc(AppStoreRegion)
class AppStoreRegion: NSObject {
  
  @objc
  static func requiresMainQueueSetup() -> Bool {
    return false
  }
  
  @objc
  func getAppStoreRegion(_ resolve: @escaping RCTPromiseResolveBlock,
                        rejecter reject: @escaping RCTPromiseRejectBlock) {
    
    // Get the actual App Store storefront country code
    if let countryCode = SKPaymentQueue.default().storefront?.countryCode {
      resolve(countryCode)
    } else {
      // Fallback to device locale if storefront is unavailable
      let fallbackCode = Locale.current.regionCode ?? "US"
      resolve(fallbackCode)
    }
  }
}
#import <React/RCTBridgeModule.h>

@interface RCT_EXTERN_MODULE(AppStoreRegion, NSObject)

RCT_EXTERN_METHOD(getAppStoreRegion:(RCTPromiseResolveBlock)resolve
                  rejecter:(RCTPromiseRejectBlock)reject)

@end
Code sample

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.