@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.
- package/dist/cjs/.tsbuildinfo +1 -1
- package/dist/cjs/index.js +5 -2
- package/dist/cjs/mixins/OxyServices.auth.js +133 -27
- package/dist/cjs/mixins/OxyServices.utility.js +405 -75
- package/dist/cjs/utils/languageUtils.js +22 -0
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm/mixins/OxyServices.auth.js +131 -27
- package/dist/esm/mixins/OxyServices.utility.js +405 -75
- package/dist/esm/utils/languageUtils.js +21 -0
- package/dist/types/.tsbuildinfo +1 -1
- package/dist/types/OxyServices.d.ts +14 -4
- package/dist/types/index.d.ts +3 -2
- package/dist/types/mixins/OxyServices.auth.d.ts +72 -11
- package/dist/types/mixins/OxyServices.utility.d.ts +144 -10
- package/dist/types/utils/languageUtils.d.ts +1 -0
- package/package.json +18 -2
- package/src/OxyServices.ts +17 -3
- package/src/index.ts +3 -1
- package/src/mixins/OxyServices.auth.ts +160 -28
- package/src/mixins/OxyServices.utility.ts +551 -87
- package/src/mixins/__tests__/serviceAuth.test.ts +623 -0
- package/src/utils/languageUtils.ts +23 -2
|
@@ -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
|
+
}
|