@solidnative-dev/localization

Validated startup locale and effective native layout direction (ltr / rtl) for Solid Native applications. Reads React Native's I18nManager TurboModule directly without evaluating I18nManager.js.

Installation#

sh
pnpm add @solidnative-dev/localization

No extra native dependency is required—uses React Native's built-in I18nManager TurboModule.

Usage#

ts
import { getReactNativeLocalizationSnapshot } from "@solidnative-dev/localization/react-native";

const localization = getReactNativeLocalizationSnapshot();
// { localeTag: "de-CH", layoutDirection: "ltr", ... }

Entrypoints#

ImportKey exports
@solidnative-dev/localizationreadLocalizationSnapshot, LocalizationSnapshot, NativeLayoutDirection, LocalizationAdapter, LOCALIZATION_MAX_LOCALE_TAG_LENGTH (128)
@solidnative-dev/localization/react-nativegetReactNativeLocalizationSnapshot

Behavior & platform notes#

  • Startup snapshot by design: Android and iOS apply locale and RTL layout direction at process/activity startup and require a restart to change. This package intentionally returns a frozen snapshot rather than exposing forceRTL / allowRTL mutations that cannot update a running Fabric surface.
  • Locale normalization: Android's underscore-separated locale identifiers are normalized to BCP-47 hyphenated tags. Because React Native's iOS I18nManager omits the locale string, iOS reads the Hermes Intl.DateTimeFormat locale while keeping native isRTL and style-swap flags.
  • iOS Info.plist requirement: Shipping iOS apps must declare supported localizations (including at least one RTL localization via CFBundleLocalizations or localized resources) before natural RTL activates.
  • Android Activity alignment: @solidnative-dev/fabric-host's SolidNativeSurface synchronizes React Native's package-scoped I18nUtil preferences from the Activity's effective locale before surface creation so the Activity, snapshot, and Yoga layout direction agree.