المؤلف:
    إنشاء:2026-01-21آخر تحديث:2026-06-25

    حزمة react-native-intlayer

    توفر حزمة react-native-intlayer الأدوات اللازمة لدمج Intlayer في تطبيقات React Native. تُعيد تصدير واجهة برمجة تطبيقات react-intlayer الكاملة (الخطافات والأدوات) مع IntlayerProvider جاهز لـ React Native، بالإضافة إلى polyfills وتكوين Metro المطلوبين بواسطة React Native.

    في تطبيق React Native، قم باستيراد كل شيء من react-native-intlayer. لا تحتاج إلى تثبيت react-intlayer أو استيراده مباشرة.

    التثبيت

    bash
    npm install react-native-intlayer
    

    الصادرات

    الموفّر

    المكوّنالوصف
    IntlayerProviderمكوّن Provider يلف تطبيقك ويوفر سياق Intlayer. يطبّق تلقائيًا polyfills المطلوبة.
    tsx
    import { IntlayerProvider } from "react-native-intlayer";
    

    الخطافات والأدوات

    يتم إعادة تصدير هذه العناصر من react-intlayer، لذلك يمكنك استيرادها مباشرةً من react-native-intlayer:

    الصادرالوصف
    useIntlayerالوصول إلى المحتوى المحلّي لمفتاح قاموس معيّن.
    useLocaleقراءة اللغة الحالية وتغييرها.
    useDictionary, useDictionaryAsync, useDictionaryDynamic, useLoadDynamicتحميل محتوى القاموس بطرق مختلفة.
    useI18nخطاف متوافق مع i18next.
    tمساعد الترجمة المضمّن.
    getIntlayer, getDictionaryأدوات استرجاع المحتوى الأمرية.
    localeCookie, localeInStorage, setLocaleCookie, setLocaleInStorage, useLocaleCookie, useLocaleStorageمساعدات استمرارية اللغة.
    tsx
    import { useIntlayer, useLocale, t } from "react-native-intlayer";
    

    ملحق التوافق (Polyfill)

    الدالةالوصف
    intlayerPolyfillدالة تطبّق polyfills الضرورية لـ React Native لدعم Intlayer.
    tsx
    import { intlayerPolyfill } from "react-native-intlayer";
    
    يتم تطبيق polyfill تلقائيًا عند استيراد IntlayerProvider. استدعِ intlayerPolyfill يدويًا فقط إذا كنت بحاجة إلى polyfills قبل تحميل الموفّر.

    المنسّقات

    خطافات التنسيق المعتمدة على Intl للأرقام والتواريخ وغيرها متاحة من المسار الفرعي /format:

    tsx
    import { useNumber, useDate } from "react-native-intlayer/format";
    

    عرض Markdown و HTML

    tsx
    import { MarkdownProvider } from "react-native-intlayer/markdown";
    import { HTMLProvider } from "react-native-intlayer/html";
    

    تكوين Metro

    توفّر حزمة react-native-intlayer أدوات تكوين Metro لضمان عمل Intlayer بشكل صحيح مع React Native.

    الدالةالوصف
    configMetroIntlayerدالة غير متزامنة تقوم بتحضير Intlayer وتدمج تكوين Metro.
    configMetroIntlayerSyncدالة متزامنة تدمج تكوين Metro دون تحضير موارد Intlayer.
    exclusionListتنشئ نمط RegExp لقائمة الحظر (blockList) في Metro لاستبعاد ملفات المحتوى من الحزمة.
    tsx
    import { configMetroIntlayer } from "react-native-intlayer/metro";