zoontek / react-native-localize

🌍 A toolbox for your React Native app localization
MIT License
2.26k stars 211 forks source link

On IOS if i select a language such as Vietnamese i get `vi-GB` instead of `vi-VN` #265

Closed ed-sparkes closed 1 month ago

ed-sparkes commented 1 month ago

Before submitting a new issue

Bug summary

On IOS if i select a language such as Vietnamese i get vi-GB instead of vi-VN

Library version

3.2.0

Environment info

System:
  OS: macOS 14.5
  CPU: (10) arm64 Apple M1 Pro
  Memory: 91.09 MB / 32.00 GB
  Shell:
    version: "5.8"
    path: /opt/homebrew/bin/zsh
Binaries:
  Node:
    version: 22.3.0
    path: /private/var/folders/4c/1kcm9kwx7wsgwyb8vch2zhd00000gn/T/xfs-e337ef24/node
  Yarn:
    version: 4.3.1
    path: /private/var/folders/4c/1kcm9kwx7wsgwyb8vch2zhd00000gn/T/xfs-e337ef24/yarn
  npm:
    version: 10.8.1
    path: /opt/homebrew/bin/npm
  Watchman:
    version: 2024.06.17.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /opt/homebrew/lib/ruby/gems/3.3.0/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.5
      - iOS 17.5
      - macOS 14.5
      - tvOS 17.5
      - visionOS 1.2
      - watchOS 10.5
  Android SDK: Not Found
IDEs:
  Android Studio: 2024.1 AI-241.15989.150.2411.11948838
  Xcode:
    version: 15.4/15F31d
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.11
    path: /usr/bin/javac
  Ruby:
    version: 3.3.3
    path: /opt/homebrew/opt/ruby/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.74.3
    wanted: ^0.74.3
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true

Steps to reproduce

  1. Select multiple languages in IOS settings including vietnamese, french etc.
  2. call getLocales()
  3. Note on ios the countryCode for me at least is always GB regardless of the language selected
  4. on Android this is not the case and country codes are appropriate to the language option selected

Reproducible sample code

const locales = getLocales()
console.log(JSON.stringify(locales))
zoontek commented 1 month ago

@ed-sparkes It's normal. iOS handle language and region separately.

image

If you set language: "Vietnamese" and region: "United Kingdom", you get vi-GB