إنشاء:2024-08-11آخر تحديث:2025-06-29
استخدم هذه الصفحة والموفر AI الذي تريدهChatGPTClaudeDeepSeekGoogle AI modeGeminiPerplexityMistralGrok
استخدم مساعدك المفضل للملخص واستخدم هذه الصفحة والموفر AI الذي تريده
هذه الوثيقة غير محدثة، تم تحديث النسخة الأساسية في ٢١ يناير ٢٠٢٦.
الانتقال إلى الوثيقة الإنجليزيةتاريخ الإصدارات
تمت ترجمة محتوى هذه الصفحة باستخدام الذكاء الاصطناعي.
اعرض آخر نسخة المحتوى الأصلي باللغة الإنكليزيةEdit this doc
If you have an idea for improving this documentation, please feel free to contribute by submitting a pull request on GitHub.
GitHub link to the documentationCopy
Copy doc Markdown to clipboard
القاموس
يجب إعلان جميع مفاتيح القاموس داخل ملفات إعلان المحتوى لتعزيز أمان النوع وتجنب الأخطاء. يمكنك العثور على تعليمات الإعداد هنا.
مثال على الاستخدام في React
عرض استخدام الـ useIntlayer hook داخل مكون React:
src/app.tsx
نسخ الكود
نسخ الكود إلى الحافظة
import type { FC } from "react";
import { ClientComponentExample, ServerComponentExample } from "@components";
import { IntlayerProvider } from "react-intlayer";
import { useIntlayer, IntlayerServerProvider } from "react-intlayer/server";
import { Locales } from "intlayer";
const App: FC<{ locale: Locales }> = ({ locale }) => {
const content = useIntlayer("homepage", locale);
return (
<>
<p>{content.introduction}</p>
<IntlayerProvider locale={locale}>
<ClientComponentExample />
</IntlayerProvider>
<IntlayerServerProvider locale={locale}>
<ServerComponentExample />
</IntlayerServerProvider>
</>
);
};src/components/ComponentExample.tsx
نسخ الكود
نسخ الكود إلى الحافظة
import type { FC } from "react";
import { useIntlayer } from "react-intlayer";
const ComponentExample: FC = () => {
const content = useIntlayer("component-example");
return (
<div>
<h1>{content.title}</h1>
<p>{content.description}</p>
</div>
);
};src/components/ServerComponentExample.tsx
نسخ الكود
نسخ الكود إلى الحافظة
import { useIntlayer } from "react-intlayer/server";
const ServerComponentExample = () => {
const content = useIntlayer("server-component");
return (
<div>
<h1>{content.title}</h1>
<p>{content.description}</p>
</div>
);
};موارد إضافية
- محرر Intlayer المرئي: لتجربة إدارة محتوى أكثر سهولة وبديهية، راجع توثيق المحرر المرئي هنا.
تستهدف هذه القسم بشكل خاص دمج الخطاف useIntlayer في تطبيقات React، مما يبسط عملية التعريب ويضمن تناسق المحتوى عبر اللغات المختلفة.