@oxyhq/core 1.11.13 → 1.11.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,6 +9,7 @@ exports.getLanguageMetadata = getLanguageMetadata;
9
9
  exports.getLanguageName = getLanguageName;
10
10
  exports.getNativeLanguageName = getNativeLanguageName;
11
11
  exports.normalizeLanguageCode = normalizeLanguageCode;
12
+ exports.isRTLLocale = isRTLLocale;
12
13
  // Supported languages with their metadata
13
14
  exports.SUPPORTED_LANGUAGES = [
14
15
  {
@@ -163,3 +164,24 @@ function normalizeLanguageCode(lang) {
163
164
  };
164
165
  return map[lang] || lang;
165
166
  }
167
+ /**
168
+ * RTL language detection.
169
+ *
170
+ * Returns `true` when the given BCP-47 tag or bare language code is one
171
+ * of the right-to-left scripts we ship UI for. Apps use this to drive
172
+ * `I18nManager.allowRTL(true)` / `forceRTL(...)` on React Native and the
173
+ * `<html dir="rtl">` attribute on web.
174
+ *
175
+ * Includes Arabic (`ar`), Hebrew (`he` / legacy `iw`), Persian (`fa`),
176
+ * Urdu (`ur`) plus their common region variants. Unknown tags are
177
+ * treated as LTR.
178
+ */
179
+ const RTL_LANGUAGE_BASES = new Set(['ar', 'he', 'iw', 'fa', 'ur']);
180
+ function isRTLLocale(locale) {
181
+ if (!locale)
182
+ return false;
183
+ const base = locale.toLowerCase().split('-')[0];
184
+ if (!base)
185
+ return false;
186
+ return RTL_LANGUAGE_BASES.has(base);
187
+ }