diff --git a/apps/web/src/content/ar/docs/gitmoji/emojis.mdx b/apps/web/src/content/ar/docs/gitmoji/emojis.mdx new file mode 100644 index 000000000..e68127075 --- /dev/null +++ b/apps/web/src/content/ar/docs/gitmoji/emojis.mdx @@ -0,0 +1,11 @@ +--- +title: مرجع الرموز التعبيرية +description: قائمة كاملة من gitmojis +--- +نستخدم [gitmoji](https://gitmoji.dev) لتصنيف الالتزامات الخاصة بنا. إليك القائمة الكاملة من الرموز التعبيرية، ورمزها ووصفها: + + + + + استخدم [gitmoji-cli](https://github.com/carloscuesta/gitmoji-cli) أو [إضافة VS Code](https://marketplace.visualstudio.com/items?itemName=seatonjiang.gitmoji-vscode) لتجربة التزام تفاعلية. + diff --git a/apps/web/src/content/ar/docs/gitmoji/getting-started.mdx b/apps/web/src/content/ar/docs/gitmoji/getting-started.mdx new file mode 100644 index 000000000..d4c766cb7 --- /dev/null +++ b/apps/web/src/content/ar/docs/gitmoji/getting-started.mdx @@ -0,0 +1,91 @@ +--- +title: البدء +description: تعلم قاعدة الالتزام لدينا +--- +نحب أن يكون لدينا تاريخ مشروع نظيف. تقليدنا في الكومِيت هو مستوحى من [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0) لكنه مخصص بـ [gitmoji](https://gitmoji.dev) لجعله أكثر وضوحًا ومتعة. + +## الهيكل + +يجب أن تكون رسالة الكومِيت منظمة كالتالي و **بالحروف الصغيرة**: + +``` + [(#)] + +[optional body] + +[optional footer(s)] +``` + +### مثال + +```bash +📝 تحديث المساهمين في الوثائق + +- إضافة @jerembdn كمساهم +- إضافة @younesbessa كمساهم + +Co-authored-by: Younes Bessa +``` + +معظم الوقت، سطر واحد بسيط يكفي: + +```bash +📝 تحديث المساهمين في الوثائق +``` + +## الأنواع + +نستخدم أنواع الكومِيت التالية: + +| النوع | الوصف | +| --- | --- | +| `add` | إضافة ميزة جديدة | +| `fix` | إصلاح خطأ | +| `improve` | تحسين شيء ما | +| `update` | تحديث شيء ما | +| `remove` | إزالة شيء ما | +| `refactor` | إعادة هيكلة شيء ما | +| `rename` | إعادة تسمية شيء ما | +| `move` | نقل ملف أو مجلد | +| `upgrade` | ترقية التبعيات | +| `downgrade` | تقليل التبعيات | + +## الوصف + +اكتب الأوصاف في **صيغة الأمر** و **بالحروف الصغيرة**: + +```bash +# جيد +📝 تحديث المساهمين في الوثائق + +# سيء +📝 تم تحديث المساهمين في الوثائق + +# سيء +📝 تحديث المساهمين في الوثائق +``` + +## رقم القضية + +اربط الكومِيت بالقضايا بإضافة رقم القضية: + +```bash +📝 تحديث المساهمين في الوثائق (#123) +``` + +## المتن + +استخدم المتن للسياق والدافع: + +```bash +📝 تحديث المساهمين في الوثائق + +- إضافة @jerembdn كمساهم +- إضافة @younesbessa كمساهم + +Co-authored-by: Younes Bessa +``` + + + يجب أن يمثل كل كومِيت تغييرًا منطقيًا واحدًا. لا تخلط بين التغييرات غير ذات الصلة. + diff --git a/apps/web/src/content/ar/docs/gitmoji/with-ai.mdx b/apps/web/src/content/ar/docs/gitmoji/with-ai.mdx new file mode 100644 index 000000000..49ed2068e --- /dev/null +++ b/apps/web/src/content/ar/docs/gitmoji/with-ai.mdx @@ -0,0 +1,63 @@ +--- +title: مع الذكاء الاصطناعي +description: استخدم gitmoji مع Claude Code +--- +قم بتثبيت ملحق gitmoji الخاص بنا لـ [Claude Code](https://claude.ai/code) لإنشاء التزامات تتبع الاتفاق. + +## تثبيت الملحق + +أضف سوق onRuntime وثبّت الملحق: + +```bash +# أضف سوق onRuntime +/plugin marketplace add https://onruntime.com/plugins + +# ثبّت ملحق gitmoji +/plugin install gitmoji@onruntime +``` + +أو قم بالتثبيت مباشرة من القائمة: + +1. قم بتشغيل `/plugin` في Claude Code +2. انتقل إلى علامة التبويب **Discover** +3. أضف السوق: `https://onruntime.com/plugins` +4. ابحث عن "gitmoji" وقم بالتثبيت + +## الاستخدام + +قم بتشغيل أمر `/commit` لإنشاء التزام: + +``` +/commit +``` + +``` +/commit fix the login bug +``` + +سيقوم Claude Code بتحليل التغييرات الخاصة بك وإنشاء التزام يتبع اتفاق gitmoji. + + + أمر `/commit` يسترجع تلقائياً حالة جيت الخاصة بك و diff لإنشاء رسالة الالتزام المناسبة. + + +## بديل: CLAUDE.md + +إذا كنت تفضل عدم تثبيت الملحق، أضف هذا إلى `CLAUDE.md` الخاص بمشروعك: + +```markdown +## اتفاق الالتزام + +استخدم التزامات gitmoji التقليدية: + +\`\`\` + +\`\`\` + +الأنواع: add, fix, improve, update, remove, refactor, rename, move, upgrade, downgrade + +القواعد: +- اكتب بأحرف صغيرة +- استخدم صيغة الأمر ("add" وليس "added") +- تغيير منطقي واحد لكل التزام +``` diff --git a/apps/web/src/content/ar/docs/next-sitemap/api.mdx b/apps/web/src/content/ar/docs/next-sitemap/api.mdx new file mode 100644 index 000000000..e89a930b3 --- /dev/null +++ b/apps/web/src/content/ar/docs/next-sitemap/api.mdx @@ -0,0 +1,169 @@ +--- +title: مرجع واجهة برمجة التطبيقات +description: وثائق كاملة لواجهة برمجة التطبيقات لـ @onruntime/next-sitemap +--- +## generateSitemap + +ينشئ خريطة موقع لتطبيق Next.js الخاص بك. + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +const sitemap = await generateSitemap(options); +``` + +### Options + +| الخيار | النوع | مطلوب | الوصف | +|--------|------|----------|-------------| +| `baseUrl` | `string` | نعم | عنوان URL الأساسي لموقعك | +| `additionalPaths` | `SitemapEntry[]` | لا | عناوين URL إضافية للإدراج | +| `exclude` | `string[]` | لا | أنماط Glob للاستبعاد | +| `defaults` | `SitemapDefaults` | لا | القيم الافتراضية لجميع الإدخالات | +| `locales` | `string[]` | لا | اللغات المدعومة | +| `defaultLocale` | `string` | لا | اللغة الافتراضية | + +### SitemapEntry + +| الخاصية | النوع | الوصف | +|----------|------|-------------| +| `url` | `string` | عنوان URL للصفحة (نسبي أو مطلق) | +| `lastModified` | `Date \| string` | تاريخ آخر تعديل | +| `changeFrequency` | `ChangeFrequency` | مدى تكرار تغيير الصفحة | +| `priority` | `number` | الأولوية (0.0 - 1.0) | + +### ChangeFrequency + +```tsx +type ChangeFrequency = + | "always" + | "hourly" + | "daily" + | "weekly" + | "monthly" + | "yearly" + | "never"; +``` + +### Example + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + const blogPosts = await fetchPosts(); + + return generateSitemap({ + baseUrl: "https://example.com", + defaults: { + changeFrequency: "weekly", + priority: 0.7, + }, + additionalPaths: blogPosts.map((post) => ({ + url: `/blog/${post.slug}`, + lastModified: post.updatedAt, + priority: 0.8, + })), + exclude: ["/admin/*", "/api/*"], + }); +} +``` + +## generateRobots + +ينشئ ملف robots.txt. + +```tsx +import { generateRobots } from "@onruntime/next-sitemap/app"; + +const robots = generateRobots(options); +``` + +### Options + +| الخيار | النوع | مطلوب | الوصف | +|--------|------|----------|-------------| +| `baseUrl` | `string` | نعم | عنوان URL الأساسي لموقعك | +| `rules` | `RobotsRule[]` | لا | قواعد الروبوتات المخصصة | +| `sitemap` | `string \| boolean` | لا | عنوان URL لخريطة الموقع أو `false` للاستبعاد | + +### RobotsRule + +| الخاصية | النوع | الوصف | +|----------|------|-------------| +| `userAgent` | `string` | عميل المستخدم المستهدف | +| `allow` | `string \| string[]` | المسارات المسموح بها | +| `disallow` | `string \| string[]` | المسارات الممنوعة | +| `crawlDelay` | `number` | تأخير الزحف بالثواني | + +### Example + +```tsx +import { generateRobots } from "@onruntime/next-sitemap/app"; + +export default function robots() { + return generateRobots({ + baseUrl: "https://example.com", + rules: [ + { + userAgent: "*", + allow: "/", + disallow: ["/admin/", "/private/"], + }, + { + userAgent: "Googlebot", + allow: "/", + crawlDelay: 1, + }, + ], + }); +} +``` + +## generateSitemapIndex + +ينشئ فهرس خريطة الموقع للمواقع الكبيرة. + +```tsx +import { generateSitemapIndex } from "@onruntime/next-sitemap/app"; + +const index = await generateSitemapIndex(options); +``` + +### Options + +| الخيار | النوع | مطلوب | الوصف | +|--------|------|----------|-------------| +| `baseUrl` | `string` | نعم | عنوان URL الأساسي لموقعك | +| `sitemapsPerFile` | `number` | لا | عناوين URL لكل خريطة موقع (افتراضي: 5000) | + +### Example + +```tsx +import { generateSitemapIndex } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemapIndex({ + baseUrl: "https://example.com", + sitemapsPerFile: 10000, + }); +} +``` + +## Type Exports + +الحزمة تصدر أنواع TypeScript للراحة: + +```tsx +import type { + SitemapEntry, + SitemapOptions, + RobotsOptions, + RobotsRule, + ChangeFrequency, +} from "@onruntime/next-sitemap"; +``` + + + جميع الدوال والخيارات مهيأة بالكامل. سيوفر لك IDE الخاص بك الإكمال التلقائي والتحقق من الأنواع. + diff --git a/apps/web/src/content/ar/docs/next-sitemap/configuration.mdx b/apps/web/src/content/ar/docs/next-sitemap/configuration.mdx new file mode 100644 index 000000000..6ec4860cd --- /dev/null +++ b/apps/web/src/content/ar/docs/next-sitemap/configuration.mdx @@ -0,0 +1,176 @@ +--- +title: تكوين +description: قم بتكوين @onruntime/next-sitemap وفقًا لاحتياجاتك +--- +## الإعدادات الأساسية + +أبسط إعداد يتطلب فقط عنوان URL الأساسي الخاص بك: + +```tsx +// app/sitemap.ts +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + }); +} +``` + +## الإعدادات المتقدمة + +### المسارات المخصصة + +أضف مسارات مخصصة أو محتوى ديناميكي: + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + // جلب المحتوى الديناميكي + const posts = await fetchBlogPosts(); + + return generateSitemap({ + baseUrl: "https://example.com", + additionalPaths: posts.map((post) => ({ + url: `/blog/${post.slug}`, + lastModified: post.updatedAt, + changeFrequency: "weekly", + priority: 0.7, + })), + }); +} +``` + +### استبعاد المسارات + +استبعد مسارات محددة من خريطة الموقع: + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + exclude: [ + "/admin/*", + "/api/*", + "/private/*", + ], + }); +} +``` + +### الأولوية وتكرار التغيير + +حدد القيم الافتراضية لجميع الصفحات: + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + defaults: { + changeFrequency: "weekly", + priority: 0.7, + }, + }); +} +``` + +## إعدادات robots.txt + +### robots.txt الأساسية + +```tsx +// app/robots.ts +import { generateRobots } from "@onruntime/next-sitemap/app"; + +export default function robots() { + return generateRobots({ + baseUrl: "https://example.com", + }); +} +``` + +### قواعد مخصصة + +```tsx +import { generateRobots } from "@onruntime/next-sitemap/app"; + +export default function robots() { + return generateRobots({ + baseUrl: "https://example.com", + rules: [ + { + userAgent: "*", + allow: "/", + disallow: ["/admin/", "/private/"], + }, + { + userAgent: "Googlebot", + allow: "/", + }, + ], + }); +} +``` + +## التدويل + +### خرائط المواقع متعددة اللغات + +دعم عدة لغات مع بدائل: + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +const locales = ["en", "fr", "de"]; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + locales, + defaultLocale: "en", + }); +} +``` + +هذا يولد عناوين URL مع بدائل `hreflang`: + +```xml + + https://example.com/en/about + + + + +``` + +## تقسيم خرائط المواقع + +للمواقع الكبيرة، قسم خريطة الموقع الخاصة بك إلى ملفات متعددة: + +```tsx +// app/sitemap/[id]/route.ts +import { generateSitemapIndex } from "@onruntime/next-sitemap/app"; + +export async function GET( + request: Request, + { params }: { params: { id: string } } +) { + const sitemaps = await generateSitemapIndex({ + baseUrl: "https://example.com", + sitemapsPerFile: 5000, + }); + + return new Response(sitemaps[parseInt(params.id)], { + headers: { "Content-Type": "application/xml" }, + }); +} +``` + + + توصي Google بالحفاظ على خرائط المواقع أقل من 50 ميغابايت و50,000 عنوان URL. استخدم خرائط المواقع المقسمة للمواقع الأكبر. + diff --git a/apps/web/src/content/ar/docs/next-sitemap/getting-started.mdx b/apps/web/src/content/ar/docs/next-sitemap/getting-started.mdx new file mode 100644 index 000000000..83aeda0c7 --- /dev/null +++ b/apps/web/src/content/ar/docs/next-sitemap/getting-started.mdx @@ -0,0 +1,86 @@ +--- +title: البدء +description: مولد خريطة الموقع لتطبيقات Next.js +--- +## ما هو @onruntime/next-sitemap؟ + +`@onruntime/next-sitemap` هو مولد خرائط مواقع قوي مصمم خصيصًا لتطبيقات Next.js. يقوم تلقائيًا بإنشاء ملفات `sitemap.xml` و `robots.txt` لموقعك على Next.js. + + + - إنشاء خرائط مواقع تلقائي لجهاز التوجيه الخاص بالتطبيق + - دعم للمسارات الديناميكية + - أولوية وقابلية تغيير مخصصة + - إنشاء robots.txt + - دعم لخرائط المواقع متعددة اللغات + + +## لماذا استخدامه؟ + +### تحسين محركات البحث + +تساعد خرائط المواقع محركات البحث في اكتشاف وفهرسة صفحاتك بكفاءة أكبر: + +- **فهرسة أسرع** - يمكن لمحركات البحث العثور على صفحاتك كلها +- **زحف أفضل** - إبلاغ الزواحف بتحديثات الصفحات +- **تلميحات أولوية** - توجيه الزواحف إلى الصفحات المهمة + +### تكامل مع Next.js + +تم بناؤه خصيصًا لـ Next.js، ويفهم: + +- هيكل جهاز التوجيه الخاص بالتطبيق +- المسارات الديناميكية +- التوليد الثابت +- التوجيه الدولي + +## مثال سريع + +```tsx +// app/sitemap.ts +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + }); +} +``` + +هذا ينشئ خريطة موقع كاملة بما في ذلك جميع صفحاتك الثابتة والديناميكية. + +## الناتج الناتج + +الحزمة تنشئ خرائط مواقع XML قياسية: + +```xml + + + + https://example.com/ + 2024-01-15 + daily + 1.0 + + + https://example.com/about + 2024-01-10 + monthly + 0.8 + + +``` + +## الخطوات التالية + + + + + diff --git a/apps/web/src/content/ar/docs/next-sitemap/installation.mdx b/apps/web/src/content/ar/docs/next-sitemap/installation.mdx new file mode 100644 index 000000000..f50c0bb8e --- /dev/null +++ b/apps/web/src/content/ar/docs/next-sitemap/installation.mdx @@ -0,0 +1,121 @@ +--- +title: التثبيت +description: قم بتثبيت وإعداد @onruntime/next-sitemap +--- +## التثبيت + +قم بتثبيت الحزمة باستخدام مدير الحزم المفضل لديك: + +```bash +# npm +npm install @onruntime/next-sitemap + +# yarn +yarn add @onruntime/next-sitemap + +# pnpm +pnpm add @onruntime/next-sitemap +``` + +## الإعداد الأساسي + +### موجه التطبيق (Next.js 13+) + +أنشئ ملف `sitemap.ts` في دليل `app` الخاص بك: + +```tsx +// app/sitemap.ts +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://your-domain.com", + }); +} +``` + +### robots.txt + +أنشئ ملف `robots.ts` لتوليد robots.txt: + +```tsx +// app/robots.ts +import { generateRobots } from "@onruntime/next-sitemap/app"; + +export default function robots() { + return generateRobots({ + baseUrl: "https://your-domain.com", + }); +} +``` + +## هيكل المشروع + +بعد الإعداد، يجب أن يبدو مشروعك كالتالي: + + + + + + + + + + + + + + + + + + +## تحقق من التثبيت + +ابدأ خادم التطوير الخاص بك وزر: + +- `http://localhost:3000/sitemap.xml` - خريطة الموقع الخاصة بك +- `http://localhost:3000/robots.txt` - ملف robots.txt الخاص بك + +يجب أن ترى XML مولد لخريطة الموقع الخاصة بك ومحتوى نصي لملف robots.txt. + + + ستتضمن خريطة الموقع جميع المسارات المكتشفة في وقت البناء. في وضع التطوير، تعكس هيكل المسار الحالي الخاص بك. + + +## المتغيرات البيئية + +للإنتاج، قم بتعيين عنوان URL الأساسي الخاص بك: + +```env +# .env.production +NEXT_PUBLIC_SITE_URL=https://your-domain.com +``` + +ثم استخدمه في تكوينك: + +```tsx +// app/sitemap.ts +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: process.env.NEXT_PUBLIC_SITE_URL || "https://your-domain.com", + }); +} +``` + +## الخطوات التالية + + + + + diff --git a/apps/web/src/content/ar/docs/translations/api.mdx b/apps/web/src/content/ar/docs/translations/api.mdx new file mode 100644 index 000000000..9eed64562 --- /dev/null +++ b/apps/web/src/content/ar/docs/translations/api.mdx @@ -0,0 +1,194 @@ +--- +title: مرجع API +description: وثائق كاملة لواجهة برمجة التطبيقات لـ @onruntime/translations +--- +## TranslationsProvider + +مكون الموفر الذي يلف تطبيقك. + +```tsx +import { TranslationsProvider } from "@onruntime/translations/react"; + + + {children} + +``` + +### Props + +| Prop | Type | Required | Description | +|------|------|----------|-------------| +| `locale` | `string` | نعم | الإعداد المحلي النشط الحالي | +| `locales` | `Record` | نعم | كائن يحتوي على جميع ترجمات الإعدادات المحلية | +| `fallbackLocale` | `string` | لا | الإعداد المحلي الاحتياطي عند فقدان المفتاح | +| `children` | `ReactNode` | نعم | مكونات الطفل | + +## useTranslation + +خطاف للوصول إلى الترجمات في مكونات العميل. + +```tsx +const { t, locale, setLocale } = useTranslation("namespace"); +``` + +### Parameters + +| Parameter | Type | Required | Description | +|-----------|------|----------|-------------| +| `namespace` | `string` | نعم | مساحة اسم الترجمة للاستخدام | + +### Returns + +| Property | Type | Description | +|----------|------|-------------| +| `t` | `(key: string, vars?: object) => string` | دالة الترجمة | +| `locale` | `string` | الإعداد المحلي الحالي | +| `setLocale` | `(locale: string) => void` | دالة لتغيير الإعداد المحلي | + +### Example + +```tsx +const { t, locale, setLocale } = useTranslation("common"); + +// الاستخدام الأساسي +t("greeting"); // "مرحبا" + +// مع المتغيرات +t("greeting_name", { name: "جون" }); // "مرحبا، جون!" + +// المفاتيح المتداخلة +t("nav.home"); // "الرئيسية" + +// تغيير الإعداد المحلي +setLocale("fr"); +``` + +## getTranslation + +دالة غير متزامنة للوصول إلى الترجمات في مكونات الخادم (Next.js). + +```tsx +const { t } = await getTranslation("namespace"); +``` + +### Parameters + +| Parameter | Type | Required | Description | +|-----------|------|----------|-------------| +| `namespace` | `string` | نعم | مساحة اسم الترجمة للاستخدام | + +### Returns + +| Property | Type | Description | +|----------|------|-------------| +| `t` | `(key: string, vars?: object) => string` | دالة الترجمة | +| `locale` | `string` | الإعداد المحلي الحالي | + +### Example + +```tsx +// مكون الخادم +export default async function Page() { + const { t } = await getTranslation("common"); + + return

{t("title")}

; +} +``` + +## Link Component + +مكون رابط يدرك الإعداد المحلي لـ Next.js. + +```tsx +import { Link } from "@onruntime/translations/next"; + +حول +``` + +### Props + +جميع الخصائص من مكون `Link` الخاص بـ Next.js، بالإضافة إلى: + +| Prop | Type | Default | Description | +|------|------|---------|-------------| +| `locale` | `string` | الإعداد المحلي الحالي | تجاوز إعدادات اللغة للرابط | + +### Example + +```tsx +// يستخدم الإعداد المحلي الحالي +حول + +// فرض إعداد محلي معين +À propos +``` + +## Translation Function (t) + +تستخدم دالة `t` لاسترجاع السلاسل المترجمة. + +### Signature + +```tsx +t(key: string, variables?: Record): string +``` + +### Parameters + +| Parameter | Type | Description | +|-----------|------|-------------| +| `key` | `string` | مفتاح الترجمة (يدعم الصيغة النقطية) | +| `variables` | `object` | المتغيرات للإدراج | + +### Variable Interpolation + +```json +{ + "greeting": "مرحبا، {name}!", + "items": "لديك {count} عناصر" +} +``` + +```tsx +t("greeting", { name: "أليس" }); // "مرحبا، أليس!" +t("items", { count: 5 }); // "لديك 5 عناصر" +``` + +### Nested Keys + +```json +{ + "user": { + "profile": { + "title": "الملف الشخصي" + } + } +} +``` + +```tsx +t("user.profile.title"); // "الملف الشخصي" +``` + +## Type Definitions + +### TranslationNamespaces + +وسّع هذه الواجهة لترجمات ذات نوع آمن: + +```tsx +declare module "@onruntime/translations" { + interface TranslationNamespaces { + common: typeof import("./locales/en/common.json"); + auth: typeof import("./locales/en/auth.json"); + } +} +``` + + + مع التعريفات الصحيحة للنوع، ستحصل على إكمال تلقائي لمفاتيح الترجمة وأخطاء في وقت الترجمة للمفاتيح غير الصالحة. + diff --git a/apps/web/src/content/ar/docs/translations/getting-started.mdx b/apps/web/src/content/ar/docs/translations/getting-started.mdx new file mode 100644 index 000000000..a23d15ed5 --- /dev/null +++ b/apps/web/src/content/ar/docs/translations/getting-started.mdx @@ -0,0 +1,92 @@ +--- +title: البدء +description: مكتبة لتدويل خفيفة الوزن وآمنة من نوعها لـ React و Next.js +--- +## ما هو @onruntime/translations؟ + +`@onruntime/translations` هو مكتبة خفيفة وسليمة من ناحية النوع لعملية التعريب (i18n) مصممة لتطبيقات React و Next.js. إنها توفر واجهة برمجة تطبيقات بسيطة لإدارة الترجمات مع دعم كامل لـ TypeScript. + + + - ترجمات سليمة من ناحية النوع باستخدام TypeScript + - دعم لـ React و Next.js (App Router) + - تنظيم قائم على المساحات + - التداخل مع المتغيرات + - خفيفة وأداء عالٍ + + +## لماذا تستخدمها؟ + +### سلامة النوع + +احصل على أخطاء في وقت الترجمة عند استخدام مفاتيح ترجمة غير صالحة: + +```typescript +const { t } = useTranslation("common"); + +t("greeting"); // ✅ مفتاح صالح +t("invalid_key"); // ❌ خطأ TypeScript +``` + +### واجهة برمجة بسيطة + +فقط حلقتين لتلبية كافة احتياجاتك من الترجمات: + +```typescript +// مكونات العميل +const { t } = useTranslation("namespace"); + +// مكونات الخادم (Next.js) +const { t } = await getTranslation("namespace"); +``` + +### ترجمات منظمة + +احتفظ بترجماتك منظمة باستخدام المساحات: + + + + + + + + + + + + + + + + +## مثال سريع + +```tsx +// locales/en/common.json +{ + "greeting": "Hello, {name}!" +} + +// مكون +import { useTranslation } from "@onruntime/translations/react"; + +function Welcome({ name }) { + const { t } = useTranslation("common"); + + return

{t("greeting", { name })}

; +} +``` + +## الخطوات التالية + + + + + diff --git a/apps/web/src/content/ar/docs/translations/installation.mdx b/apps/web/src/content/ar/docs/translations/installation.mdx new file mode 100644 index 000000000..359b7c1be --- /dev/null +++ b/apps/web/src/content/ar/docs/translations/installation.mdx @@ -0,0 +1,127 @@ +--- +title: التثبيت +description: قم بتثبيت وتكوين @onruntime/translations +--- +## التثبيت + +قم بتثبيت الحزمة باستخدام مدير الحزم المفضل لديك: + +```bash +# npm +npm install @onruntime/translations + +# yarn +yarn add @onruntime/translations + +# pnpm +pnpm add @onruntime/translations +``` + +## إعداد المشروع + +### 1. إنشاء ملفات الترجمة + +قم بإنشاء دليل `locales` في مشروعك مع ملفات ترجمة لكل لغة: + + + + + + + + + + + + + + +مثال `locales/en/common.json`: + +```json +{ + "title": "مرحبًا", + "greeting": "مرحبًا، {name}!", + "items": { + "one": "{count} عنصر", + "other": "{count} عناصر" + } +} +``` + +### 2. تكوين TypeScript (اختياري) + +لترجمات آمنة من حيث النوع، قم بإنشاء ملف تعريف نوع: + +```typescript +// types/translations.d.ts +import "onruntime/translations"; + +declare module "@onruntime/translations" { + interface TranslationNamespaces { + common: typeof import("../locales/en/common.json"); + auth: typeof import("../locales/en/auth.json"); + } +} +``` + +### 3. إعداد المزود + +قم بلف تطبيقك بـ `TranslationsProvider`: + +```tsx +// لـ React +import { TranslationsProvider } from "@onruntime/translations/react"; +import en from "./locales/en"; +import fr from "./locales/fr"; + +const locales = { en, fr }; + +function App() { + return ( + + + + ); +} +``` + + + إذا كنت تستخدم Next.js مع App Router، تحقق من دليل [استخدام Next.js](/docs/translations/nextjs) للإعداد الموصى به. + + +## التحقق من التثبيت + +اختبر إعدادك بمكون بسيط: + +```tsx +import { useTranslation } from "@onruntime/translations/react"; + +function TestComponent() { + const { t } = useTranslation("common"); + + return ( +
+

{t("title")}

+

{t("greeting", { name: "World" })}

+
+ ); +} +``` + +إذا رأيت ترجماتك تم عرضها، فأنت جاهز! + +## الخطوات التالية + + + + + diff --git a/apps/web/src/content/ar/docs/translations/nextjs.mdx b/apps/web/src/content/ar/docs/translations/nextjs.mdx new file mode 100644 index 000000000..a7f77ce0d --- /dev/null +++ b/apps/web/src/content/ar/docs/translations/nextjs.mdx @@ -0,0 +1,191 @@ +--- +title: استخدام Next.js +description: استخدام @onruntime/translations مع Next.js App Router +--- +## إعداد توجيه التطبيق + +### 1. تكوين الموفر + +قم بإنشاء ملف الموفرين لإعداد الترجمات: + +```tsx +// app/providers.tsx +"use client"; + +import { TranslationsProvider } from "@onruntime/translations/react"; +import { ReactNode } from "react"; + +import en from "@/locales/en"; +import fr from "@/locales/fr"; + +const locales = { en, fr }; + +interface ProvidersProps { + children: ReactNode; + locale: string; +} + +export function Providers({ children, locale }: ProvidersProps) { + return ( + + {children} + + ); +} +``` + +### 2. إعداد تخطيط الجذر + +استخدم الموفر في تخطيط الجذر الخاص بك: + +```tsx +// app/[locale]/layout.tsx +import { Providers } from "../providers"; + +export default function LocaleLayout({ + children, + params, +}: { + children: React.ReactNode; + params: { locale: string }; +}) { + return ( + + {children} + + ); +} +``` + +## مكونات الخادم + +استخدم `getTranslation` لمكونات الخادم: + +```tsx +// app/[locale]/page.tsx +import { getTranslation } from "@/lib/translations.server"; + +export default async function HomePage() { + const { t } = await getTranslation("common"); + + return ( +
+

{t("title")}

+

{t("description")}

+
+ ); +} +``` + + + استخدم `getTranslation` في مكونات الخادم و `useTranslation` في مكونات العميل. + + +## مكونات العميل + +استخدم `useTranslation` لمكونات العميل: + +```tsx +"use client"; + +import { useTranslation } from "@onruntime/translations/react"; + +export function LanguageSwitcher() { + const { locale, setLocale } = useTranslation("common"); + + return ( + + ); +} +``` + +## توجيه مبني على اللغة + +### إعداد الوسيط + +قم بإعداد وسيط للتعامل مع اكتشاف اللغة: + +```tsx +// middleware.ts +import { NextRequest, NextResponse } from "next/server"; + +const locales = ["en", "fr"]; +const defaultLocale = "en"; + +export function middleware(request: NextRequest) { + const pathname = request.nextUrl.pathname; + + // تحقق مما إذا كان المسار يحتوي على لغة + const pathnameHasLocale = locales.some( + (locale) => pathname.startsWith(`/${locale}/`) || pathname === `/${locale}` + ); + + if (pathnameHasLocale) return; + + // إعادة التوجيه إلى اللغة الافتراضية + return NextResponse.redirect( + new URL(`/${defaultLocale}${pathname}`, request.url) + ); +} + +export const config = { + matcher: ["/((?!api|_next|.*\\..*).*)"], +}; +``` + +## التوليد الثابت + +قم بإنشاء صفحات ثابتة لجميع اللغات: + +```tsx +// app/[locale]/page.tsx +export async function generateStaticParams() { + return [{ locale: "en" }, { locale: "fr" }]; +} +``` + +## مكون الرابط + +استخدم مكون الرابط المترجم للتنقل: + +```tsx +import { Link } from "@onruntime/translations/next"; + +function Navigation() { + return ( + + ); +} +``` + +مكون `Link` يدير تلقائيًا إعداد بادئات اللغة. + +## هيكل المشروع كمثال + + + + + + + + + + + + + + + + + + + + + + diff --git a/apps/web/src/content/ar/docs/translations/react.mdx b/apps/web/src/content/ar/docs/translations/react.mdx new file mode 100644 index 000000000..ed2351426 --- /dev/null +++ b/apps/web/src/content/ar/docs/translations/react.mdx @@ -0,0 +1,157 @@ +--- +title: استخدام React +description: استخدام @onruntime/translations في تطبيقات React +--- +## الاستخدام الأساسي + +### هوك useTranslation + +هوك `useTranslation` هو الطريقة الرئيسية للوصول إلى الترجمات في مكونات React: + +```tsx +import { useTranslation } from "@onruntime/translations/react"; + +function MyComponent() { + const { t, locale } = useTranslation("common"); + + return ( +
+

اللغة الحالية: {locale}

+

{t("title")}

+
+ ); +} +``` + +### تمرير المتغيرات + +مرر المتغيرات إلى الترجمات الخاصة بك: + +```json +// locales/en/common.json +{ + "greeting": "مرحبا، {name}!", + "items_count": "لديك {count} عناصر" +} +``` + +```tsx +function Greeting({ name, itemCount }) { + const { t } = useTranslation("common"); + + return ( + <> +

{t("greeting", { name })}

+

{t("items_count", { count: itemCount })}

+ + ); +} +``` + +## استخدام مساحات أسماء متعددة + +يمكنك استخدام مساحات أسماء متعددة في نفس المكون: + +```tsx +function Dashboard() { + const { t: tCommon } = useTranslation("common"); + const { t: tDashboard } = useTranslation("dashboard"); + + return ( +
+

{tDashboard("title")}

+ +
+ ); +} +``` + +## تغيير اللغة + +استخدم دالة `setLocale` لتغيير اللغة الحالية: + +```tsx +import { useTranslation } from "@onruntime/translations/react"; + +function LanguageSwitcher() { + const { locale, setLocale } = useTranslation("common"); + + return ( + + ); +} +``` + +## المفاتيح المتداخلة + +وصول إلى مفاتيح الترجمة المتداخلة باستخدام تدوين النقاط: + +```json +// locales/en/common.json +{ + "nav": { + "home": "الرئيسية", + "about": "حول", + "contact": "اتصل" + } +} +``` + +```tsx +function Navigation() { + const { t } = useTranslation("common"); + + return ( + + ); +} +``` + +## أفضل الممارسات + + + نظم الترجمات حسب الميزة أو الصفحة بدلاً من وضع كل شيء في ملف واحد. + + +### الهيكل الموصى به + + + + + + + + + + + + +### الحفاظ على تناسق المفاتيح + +استخدم تسميات متسقة عبر جميع اللغات: + +```json +// ✅ جيد - هيكل متسق +{ + "page_title": "لوحة التحكم", + "actions": { + "save": "احفظ", + "cancel": "إلغاء" + } +} + +// ❌ تجنب - غير متسق +{ + "pageTitle": "لوحة التحكم", + "save_button": "احفظ", + "cancelBtn": "إلغاء" +} +``` diff --git a/apps/web/src/content/de/docs/gitmoji/emojis.mdx b/apps/web/src/content/de/docs/gitmoji/emojis.mdx new file mode 100644 index 000000000..28332f806 --- /dev/null +++ b/apps/web/src/content/de/docs/gitmoji/emojis.mdx @@ -0,0 +1,11 @@ +--- +title: Emoji-Verzeichnis +description: Vollständige Liste der gitmojis +--- +Wir nutzen [gitmoji](https://gitmoji.dev), um unsere Commits zu kategorisieren. Hier ist die komplette Liste der Emojis, ihren Code und Beschreibung: + + + + + Nutze die [gitmoji-cli](https://github.com/carloscuesta/gitmoji-cli) oder die [VS Code Erweiterung](https://marketplace.visualstudio.com/items?itemName=seatonjiang.gitmoji-vscode) für ein interaktives Commit-Erlebnis. + diff --git a/apps/web/src/content/de/docs/gitmoji/getting-started.mdx b/apps/web/src/content/de/docs/gitmoji/getting-started.mdx new file mode 100644 index 000000000..e292baa0f --- /dev/null +++ b/apps/web/src/content/de/docs/gitmoji/getting-started.mdx @@ -0,0 +1,91 @@ +--- +title: Erste Schritte +description: Lerne unser Commit-Konvention +--- +Wir mögen eine saubere Projektgeschichte. Unser Commit-Konvention ist inspiriert von [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0), aber mit [gitmoji](https://gitmoji.dev) angepasst, um es visuell und spaßig zu gestalten. + +## Struktur + +Die Commit-Nachricht sollte wie folgt strukturiert sein und **in kleingeschriebener Form**: + +``` + [(#)] + +[optionale body] + +[optionale footer(s)] +``` + +### Beispiel + +```bash +📝 update documentation contributors + +- Add @jerembdn as a contributor +- Add @younesbessa as a contributor + +Co-authored-by: Younes Bessa +``` + +In den meisten Fällen reicht eine einfache Einzeiligkeit: + +```bash +📝 update documentation contributors +``` + +## Typen + +Wir verwenden die folgenden Commit-Typen: + +| Typ | Beschreibung | +| --- | --- | +| `add` | Neue Funktion hinzufügen | +| `fix` | Bug beheben | +| `improve` | Etwas verbessern | +| `update` | Etwas aktualisieren | +| `remove` | Etwas entfernen | +| `refactor` | Etwas umstrukturieren | +| `rename` | Etwas umbenennen | +| `move` | Eine Datei oder einen Ordner verschieben | +| `upgrade` | Abhängigkeiten aktualisieren | +| `downgrade` | Abhängigkeiten downgraden | + +## Beschreibung + +Schreibe Beschreibungen im **Imperativ** und **in kleingeschriebener Form**: + +```bash +# Gut +📝 update documentation contributors + +# Schlecht +📝 updated documentation contributors + +# Schlecht +📝 Update documentation contributors +``` + +## Issue-Nummer + +Verlinke Commits zu Issues, indem du die Issue-Nummer hinzufügst: + +```bash +📝 update documentation contributors (#123) +``` + +## Body + +Verwende den Body für Kontext und Motivation: + +```bash +📝 update documentation contributors + +- Add @jerembdn as a contributor +- Add @younesbessa as a contributor + +Co-authored-by: Younes Bessa +``` + + + Jeder Commit sollte eine einzelne logische Änderung darstellen. Mische keine unzusammenhängenden Änderungen. + diff --git a/apps/web/src/content/de/docs/gitmoji/with-ai.mdx b/apps/web/src/content/de/docs/gitmoji/with-ai.mdx new file mode 100644 index 000000000..f0fe8b2c5 --- /dev/null +++ b/apps/web/src/content/de/docs/gitmoji/with-ai.mdx @@ -0,0 +1,63 @@ +--- +title: Mit KI +description: Verwende gitmoji mit Claude Code +--- +Installiere unser gitmoji Plugin für [Claude Code](https://claude.ai/code), um Commits gemäß der Konvention zu generieren. + +## Installiere das Plugin + +Füge den onRuntime Marketplace hinzu und installiere das Plugin: + +```bash +# Füge den onRuntime Marketplace hinzu +/plugin marketplace add https://onruntime.com/plugins + +# Installiere das gitmoji Plugin +/plugin install gitmoji@onruntime +``` + +Oder installiere direkt über das Menü: + +1. Führe `/plugin` in Claude Code aus +2. Gehe zum **Entdecken** Tab +3. Füge den Marketplace hinzu: `https://onruntime.com/plugins` +4. Suche nach "gitmoji" und installiere + +## Verwendung + +Führe den Befehl `/commit` aus, um einen Commit zu erstellen: + +``` +/commit +``` + +``` +/commit fix den Login-Bug +``` + +Claude Code analysiert deine Änderungen und erstellt einen Commit gemäß der gitmoji-Konvention. + + + Der Befehl `/commit` ruft automatisch deinen Git-Status und den Diff ab, um die passende Commit-Nachricht zu generieren. + + +## Alternative: CLAUDE.md + +Wenn du das Plugin nicht installieren möchtest, füge dies zu deinem Projekt `CLAUDE.md` hinzu: + +```markdown +## Commit-Konvention + +Verwende gitmoji konventionelle Commits: + +\`\`\` + +\`\`\` + +Typen: add, fix, improve, update, remove, refactor, rename, move, upgrade, downgrade + +Regeln: +- Kleinbuchstaben verwenden +- Imperativ benutzen ("add" nicht "added") +- Eine logische Änderung pro Commit +``` diff --git a/apps/web/src/content/de/docs/next-sitemap/api.mdx b/apps/web/src/content/de/docs/next-sitemap/api.mdx new file mode 100644 index 000000000..a5bdc5a44 --- /dev/null +++ b/apps/web/src/content/de/docs/next-sitemap/api.mdx @@ -0,0 +1,169 @@ +--- +title: API-Referenz +description: Vollständige API-Dokumentation für @onruntime/next-sitemap +--- +## generateSitemap + +Generiert eine Sitemap für deine Next.js Anwendung. + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +const sitemap = await generateSitemap(options); +``` + +### Optionen + +| Option | Typ | Erforderlich | Beschreibung | +|--------|------|----------|-------------| +| `baseUrl` | `string` | Ja | Die Basis-URL deiner Seite | +| `additionalPaths` | `SitemapEntry[]` | Nein | Zusätzliche URLs, die eingeschlossen werden sollen | +| `exclude` | `string[]` | Nein | Glob-Muster, die ausgeschlossen werden sollen | +| `defaults` | `SitemapDefaults` | Nein | Standardwerte für alle Einträge | +| `locales` | `string[]` | Nein | Unterstützte Sprachen | +| `defaultLocale` | `string` | Nein | Standardsprache | + +### SitemapEntry + +| Eigenschaft | Typ | Beschreibung | +|----------|------|-------------| +| `url` | `string` | Seiten-URL (relativ oder absolut) | +| `lastModified` | `Date \| string` | Letztes Änderungsdatum | +| `changeFrequency` | `ChangeFrequency` | Wie oft sich die Seite ändert | +| `priority` | `number` | Priorität (0.0 - 1.0) | + +### ChangeFrequency + +```tsx +type ChangeFrequency = + | "always" + | "hourly" + | "daily" + | "weekly" + | "monthly" + | "yearly" + | "never"; +``` + +### Beispiel + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + const blogPosts = await fetchPosts(); + + return generateSitemap({ + baseUrl: "https://example.com", + defaults: { + changeFrequency: "weekly", + priority: 0.7, + }, + additionalPaths: blogPosts.map((post) => ({ + url: `/blog/${post.slug}`, + lastModified: post.updatedAt, + priority: 0.8, + })), + exclude: ["/admin/*", "/api/*"], + }); +} +``` + +## generateRobots + +Generiert eine robots.txt Datei. + +```tsx +import { generateRobots } from "@onruntime/next-sitemap/app"; + +const robots = generateRobots(options); +``` + +### Optionen + +| Option | Typ | Erforderlich | Beschreibung | +|--------|------|----------|-------------| +| `baseUrl` | `string` | Ja | Die Basis-URL deiner Seite | +| `rules` | `RobotsRule[]` | Nein | Benutzerdefinierte Robots-Regeln | +| `sitemap` | `string \| boolean` | Nein | Sitemap-URL oder `false`, um auszuschließen | + +### RobotsRule + +| Eigenschaft | Typ | Beschreibung | +|----------|------|-------------| +| `userAgent` | `string` | Zielbenutzer-Agent | +| `allow` | `string \| string[]` | Erlaubte Pfade | +| `disallow` | `string \| string[]` | Nicht erlaubte Pfade | +| `crawlDelay` | `number` | Crawl-Verzögerung in Sekunden | + +### Beispiel + +```tsx +import { generateRobots } from "@onruntime/next-sitemap/app"; + +export default function robots() { + return generateRobots({ + baseUrl: "https://example.com", + rules: [ + { + userAgent: "*", + allow: "/", + disallow: ["/admin/", "/private/"], + }, + { + userAgent: "Googlebot", + allow: "/", + crawlDelay: 1, + }, + ], + }); +} +``` + +## generateSitemapIndex + +Generiert einen Sitemap-Index für große Seiten. + +```tsx +import { generateSitemapIndex } from "@onruntime/next-sitemap/app"; + +const index = await generateSitemapIndex(options); +``` + +### Optionen + +| Option | Typ | Erforderlich | Beschreibung | +|--------|------|----------|-------------| +| `baseUrl` | `string` | Ja | Die Basis-URL deiner Seite | +| `sitemapsPerFile` | `number` | Nein | URLs pro Sitemap (Standard: 5000) | + +### Beispiel + +```tsx +import { generateSitemapIndex } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemapIndex({ + baseUrl: "https://example.com", + sitemapsPerFile: 10000, + }); +} +``` + +## Typ-Exporte + +Das Paket exportiert TypeScript-Typen für den Komfort: + +```tsx +import type { + SitemapEntry, + SitemapOptions, + RobotsOptions, + RobotsRule, + ChangeFrequency, +} from "@onruntime/next-sitemap"; +``` + + + Alle Funktionen und Optionen sind vollständig typisiert. Deine IDE bietet Autocomplete und Typüberprüfung. + diff --git a/apps/web/src/content/de/docs/next-sitemap/configuration.mdx b/apps/web/src/content/de/docs/next-sitemap/configuration.mdx new file mode 100644 index 000000000..75935173e --- /dev/null +++ b/apps/web/src/content/de/docs/next-sitemap/configuration.mdx @@ -0,0 +1,176 @@ +--- +title: Konfiguration +description: Konfiguriere @onruntime/next-sitemap nach deinen Bedürfnissen +--- +## Grundkonfiguration + +Die einfachste Konfiguration benötigt nur deine Basis-URL: + +```tsx +// app/sitemap.ts +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + }); +} +``` + +## Erweiterte Konfiguration + +### Benutzerdefinierte Routen + +Füge benutzerdefinierte Routen oder dynamische Inhalte hinzu: + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + // Dynamische Inhalte abrufen + const posts = await fetchBlogPosts(); + + return generateSitemap({ + baseUrl: "https://example.com", + additionalPaths: posts.map((post) => ({ + url: `/blog/${post.slug}`, + lastModified: post.updatedAt, + changeFrequency: "weekly", + priority: 0.7, + })), + }); +} +``` + +### Routen ausschließen + +Schließe bestimmte Routen aus der Sitemap aus: + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + exclude: [ + "/admin/*", + "/api/*", + "/private/*", + ], + }); +} +``` + +### Priorität und Änderungsfrequenz + +Setze Standardwerte für alle Seiten: + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + defaults: { + changeFrequency: "weekly", + priority: 0.7, + }, + }); +} +``` + +## robots.txt Konfiguration + +### Grundlegende robots.txt + +```tsx +// app/robots.ts +import { generateRobots } from "@onruntime/next-sitemap/app"; + +export default function robots() { + return generateRobots({ + baseUrl: "https://example.com", + }); +} +``` + +### Benutzerdefinierte Regeln + +```tsx +import { generateRobots } from "@onruntime/next-sitemap/app"; + +export default function robots() { + return generateRobots({ + baseUrl: "https://example.com", + rules: [ + { + userAgent: "*", + allow: "/", + disallow: ["/admin/", "/private/"], + }, + { + userAgent: "Googlebot", + allow: "/", + }, + ], + }); +} +``` + +## Internationalisierung + +### Mehrsprachige Sitemaps + +Unterstütze mehrere Sprachen mit Alternativen: + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +const locales = ["en", "fr", "de"]; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + locales, + defaultLocale: "en", + }); +} +``` + +Dies generiert URLs mit `hreflang` Alternativen: + +```xml + + https://example.com/en/about + + + + +``` + +## Geteilte Sitemaps + +Für große Websites teile deine Sitemap in mehrere Dateien auf: + +```tsx +// app/sitemap/[id]/route.ts +import { generateSitemapIndex } from "@onruntime/next-sitemap/app"; + +export async function GET( + request: Request, + { params }: { params: { id: string } } +) { + const sitemaps = await generateSitemapIndex({ + baseUrl: "https://example.com", + sitemapsPerFile: 5000, + }); + + return new Response(sitemaps[parseInt(params.id)], { + headers: { "Content-Type": "application/xml" }, + }); +} +``` + + + Google empfiehlt, Sitemaps unter 50 MB und 50.000 URLs zu halten. Verwende geteilte Sitemaps für größere Seiten. + diff --git a/apps/web/src/content/de/docs/next-sitemap/getting-started.mdx b/apps/web/src/content/de/docs/next-sitemap/getting-started.mdx new file mode 100644 index 000000000..da9468dbf --- /dev/null +++ b/apps/web/src/content/de/docs/next-sitemap/getting-started.mdx @@ -0,0 +1,86 @@ +--- +title: Loslegen +description: Ein Sitemap-Generator für Next.js-Anwendungen +--- +## Was ist @onruntime/next-sitemap? + +`@onruntime/next-sitemap` ist ein leistungsstarker Sitemap-Generator, der speziell für Next.js-Anwendungen entwickelt wurde. Er generiert automatisch die Dateien `sitemap.xml` und `robots.txt` für deine Next.js-Seite. + + + - Automatische Sitemap-Generierung für den App Router + - Unterstützung für dynamische Routen + - Konfigurierbare Priorität und changefreq + - robots.txt-Generierung + - Unterstützung für mehrsprachige Sitemaps + + +## Warum solltest du es nutzen? + +### SEO-Optimierung + +Sitemaps helfen Suchmaschinen, deine Seiten effizienter zu entdecken und zu indexieren: + +- **Schnellere Indizierung** - Suchmaschinen können alle deine Seiten finden +- **Besseres Crawlen** - Informiere Crawler über Seitenaktualisierungen +- **Prioritäts-Hinweise** - Leite Crawler zu wichtigen Seiten + +### Next.js-Integration + +Speziell für Next.js gebaut, versteht es: + +- App Router-Struktur +- Dynamische Routen +- Statische Generierung +- Internationalisierte Routen + +## Schnelles Beispiel + +```tsx +// app/sitemap.ts +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + }); +} +``` + +Das generiert eine vollständige Sitemap, die alle deine statischen und dynamischen Seiten umfasst. + +## Generierte Ausgabe + +Das Paket generiert standardmäßige XML-Sitemaps: + +```xml + + + + https://example.com/ + 2024-01-15 + daily + 1.0 + + + https://example.com/about + 2024-01-10 + monthly + 0.8 + + +``` + +## Nächste Schritte + + + + + diff --git a/apps/web/src/content/de/docs/next-sitemap/installation.mdx b/apps/web/src/content/de/docs/next-sitemap/installation.mdx new file mode 100644 index 000000000..456734768 --- /dev/null +++ b/apps/web/src/content/de/docs/next-sitemap/installation.mdx @@ -0,0 +1,121 @@ +--- +title: Installation +description: Installiere und richte @onruntime/next-sitemap ein +--- +## Installation + +Installiere das Paket mit deinem bevorzugten Paketmanager: + +```bash +# npm +npm install @onruntime/next-sitemap + +# yarn +yarn add @onruntime/next-sitemap + +# pnpm +pnpm add @onruntime/next-sitemap +``` + +## Grundlegende Einrichtung + +### App Router (Next.js 13+) + +Erstelle eine `sitemap.ts` Datei in deinem `app` Verzeichnis: + +```tsx +// app/sitemap.ts +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://your-domain.com", + }); +} +``` + +### robots.txt + +Erstelle eine `robots.ts` Datei für die robots.txt Generierung: + +```tsx +// app/robots.ts +import { generateRobots } from "@onruntime/next-sitemap/app"; + +export default function robots() { + return generateRobots({ + baseUrl: "https://your-domain.com", + }); +} +``` + +## Projektstruktur + +Nach der Einrichtung sollte dein Projekt so aussehen: + + + + + + + + + + + + + + + + + + +## Installation überprüfen + +Starte deinen Entwicklungsserver und besuche: + +- `http://localhost:3000/sitemap.xml` - Deine Sitemap +- `http://localhost:3000/robots.txt` - Deine robots.txt + +Du solltest generiertes XML für deine Sitemap und Textinhalt für robots.txt sehen. + + + Die Sitemap enthält alle Routen, die zur Build-Zeit entdeckt wurden. In der Entwicklung spiegelt sie deine aktuelle Routenstruktur wider. + + +## Umgebungsvariablen + +Für die Produktion setze deine Basis-URL: + +```env +# .env.production +NEXT_PUBLIC_SITE_URL=https://your-domain.com +``` + +Nutze sie dann in deiner Konfiguration: + +```tsx +// app/sitemap.ts +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: process.env.NEXT_PUBLIC_SITE_URL || "https://your-domain.com", + }); +} +``` + +## Nächste Schritte + + + + + diff --git a/apps/web/src/content/de/docs/translations/api.mdx b/apps/web/src/content/de/docs/translations/api.mdx new file mode 100644 index 000000000..7ebd2b1a8 --- /dev/null +++ b/apps/web/src/content/de/docs/translations/api.mdx @@ -0,0 +1,194 @@ +--- +title: API-Referenz +description: Vollständige API-Dokumentation für @onruntime/translations +--- +## TranslationsProvider + +Die Provider-Komponente, die deine Anwendung umschließt. + +```tsx +import { TranslationsProvider } from "@onruntime/translations/react"; + + + {children} + +``` + +### Props + +| Prop | Type | Erforderlich | Beschreibung | +|------|------|-------------|--------------| +| `locale` | `string` | Ja | Aktuelle aktive Sprache | +| `locales` | `Record` | Ja | Objekt, das alle Übersetzungen für die Sprachen enthält | +| `fallbackLocale` | `string` | Nein | Fallback-Sprache, wenn der Schlüssel fehlt | +| `children` | `ReactNode` | Ja | Kind-Komponenten | + +## useTranslation + +Hook zum Zugriff auf Übersetzungen in Client-Komponenten. + +```tsx +const { t, locale, setLocale } = useTranslation("namespace"); +``` + +### Parameter + +| Parameter | Type | Erforderlich | Beschreibung | +|-----------|------|-------------|--------------| +| `namespace` | `string` | Ja | Zu verwendender Übersetzungs-Namespace | + +### Rückgaben + +| Property | Type | Beschreibung | +|----------|------|--------------| +| `t` | `(key: string, vars?: object) => string` | Übersetzungsfunktion | +| `locale` | `string` | Aktuelle Sprache | +| `setLocale` | `(locale: string) => void` | Funktion zum Ändern der Sprache | + +### Beispiel + +```tsx +const { t, locale, setLocale } = useTranslation("common"); + +// Grundlegende Nutzung +t("greeting"); // "Hallo" + +// Mit Variablen +t("greeting_name", { name: "John" }); // "Hallo, John!" + +// Verschachtelte Schlüssel +t("nav.home"); // "Startseite" + +// Sprache ändern +setLocale("fr"); +``` + +## getTranslation + +Asynchrone Funktion zum Zugriff auf Übersetzungen in Server-Komponenten (Next.js). + +```tsx +const { t } = await getTranslation("namespace"); +``` + +### Parameter + +| Parameter | Type | Erforderlich | Beschreibung | +|-----------|------|-------------|--------------| +| `namespace` | `string` | Ja | Zu verwendender Übersetzungs-Namespace | + +### Rückgaben + +| Property | Type | Beschreibung | +|----------|------|--------------| +| `t` | `(key: string, vars?: object) => string` | Übersetzungsfunktion | +| `locale` | `string` | Aktuelle Sprache | + +### Beispiel + +```tsx +// Server-Komponente +export default async function Page() { + const { t } = await getTranslation("common"); + + return

{t("title")}

; +} +``` + +## Link Component + +Locale-bewusste Link-Komponente für Next.js. + +```tsx +import { Link } from "@onruntime/translations/next"; + +Über +``` + +### Props + +Alle Props von der Next.js `Link`-Komponente, plus: + +| Prop | Type | Standard | Beschreibung | +|------|------|----------|--------------| +| `locale` | `string` | Aktuelle Sprache | Überschreibt die Link-Sprache | + +### Beispiel + +```tsx +// Verwendet die aktuelle Sprache +Über + +// Bestimmte Sprache erzwingen +À propos +``` + +## Übersetzungsfunktion (t) + +Die `t`-Funktion wird verwendet, um übersetzte Strings abzurufen. + +### Signatur + +```tsx +t(key: string, variablen?: Record): string +``` + +### Parameter + +| Parameter | Type | Beschreibung | +|-----------|------|--------------| +| `key` | `string` | Übersetzungsschlüssel (unterstützt Punktnotation) | +| `variablen` | `object` | Variablen zur Interpolation | + +### Variableninterpolation + +```json +{ + "greeting": "Hallo, {name}!", + "items": "Du hast {count} Elemente" +} +``` + +```tsx +t("greeting", { name: "Alice" }); // "Hallo, Alice!" +t("items", { count: 5 }); // "Du hast 5 Elemente" +``` + +### Verschachtelte Schlüssel + +```json +{ + "user": { + "profile": { + "title": "Profil" + } + } +} +``` + +```tsx +t("user.profile.title"); // "Profil" +``` + +## Typdefinitionen + +### TranslationNamespaces + +Erweitere dieses Interface für typensichere Übersetzungen: + +```tsx +declare module "@onruntime/translations" { + interface TranslationNamespaces { + common: typeof import("./locales/en/common.json"); + auth: typeof import("./locales/en/auth.json"); + } +} +``` + + + Mit richtigen Typdefinitionen bekommst du Autovervollständigung für Übersetzungsschlüssel und Kompilierzeitfehler für ungültige Schlüssel. + diff --git a/apps/web/src/content/de/docs/translations/getting-started.mdx b/apps/web/src/content/de/docs/translations/getting-started.mdx new file mode 100644 index 000000000..67016eeec --- /dev/null +++ b/apps/web/src/content/de/docs/translations/getting-started.mdx @@ -0,0 +1,94 @@ +--- +title: Erste Schritte +description: >- + Eine leichte, typsichere Internationalisierungsbibliothek für React und + Next.js +--- +## Was ist @onruntime/translations? + +`@onruntime/translations` ist eine leichte, typensichere Internationalisierungsbibliothek (i18n), die für React- und Next.js-Anwendungen entwickelt wurde. Sie bietet eine einfache API zur Verwaltung von Übersetzungen mit voller TypeScript-Unterstützung. + + + - Typensichere Übersetzungen mit TypeScript + - Unterstützung für React und Next.js (App Router) + - Namensraum-basierte Organisation + - Variableninterpolation + - Leichtgewichtig und performant + + +## Warum nutzen? + +### Typensicherheit + +Erhalte Compile-Zeitfehler, wenn ungültige Übersetzungsschlüssel verwendet werden: + +```typescript +const { t } = useTranslation("common"); + +t("greeting"); // ✅ Gültiger Schlüssel +t("invalid_key"); // ❌ TypeScript-Fehler +``` + +### Einfache API + +Nur zwei Hooks für all deine Übersetzungsbedürfnisse: + +```typescript +// Client-Komponenten +const { t } = useTranslation("namespace"); + +// Server-Komponenten (Next.js) +const { t } = await getTranslation("namespace"); +``` + +### Organisierte Übersetzungen + +Halte deine Übersetzungen mit Namensräumen organisiert: + + + + + + + + + + + + + + + + +## Schnelles Beispiel + +```tsx +// locales/en/common.json +{ + "greeting": "Hallo, {name}!" +} + +// Komponente +import { useTranslation } from "@onruntime/translations/react"; + +function Welcome({ name }) { + const { t } = useTranslation("common"); + + return

{t("greeting", { name })}

; +} +``` + +## Nächste Schritte + + + + + diff --git a/apps/web/src/content/de/docs/translations/installation.mdx b/apps/web/src/content/de/docs/translations/installation.mdx new file mode 100644 index 000000000..2a571fab0 --- /dev/null +++ b/apps/web/src/content/de/docs/translations/installation.mdx @@ -0,0 +1,127 @@ +--- +title: Installation +description: Installiere und konfiguriere @onruntime/translations +--- +## Installation + +Installiere das Paket mit deinem bevorzugten Paketmanager: + +```bash +# npm +npm install @onruntime/translations + +# yarn +yarn add @onruntime/translations + +# pnpm +pnpm add @onruntime/translations +``` + +## Projekt Setup + +### 1. Erstelle Übersetzungsdateien + +Erstelle ein Verzeichnis `locales` in deinem Projekt mit Übersetzungsdateien für jede Sprache: + + + + + + + + + + + + + + +Beispiel `locales/en/common.json`: + +```json +{ + "title": "Willkommen", + "greeting": "Hallo, {name}!", + "items": { + "one": "{count} Artikel", + "other": "{count} Artikel" + } +} +``` + +### 2. TypeScript konfigurieren (optional) + +Für typsichere Übersetzungen erstelle eine Typdefinitionsdatei: + +```typescript +// types/translations.d.ts +import "onruntime/translations"; + +declare module "@onruntime/translations" { + interface TranslationNamespaces { + common: typeof import("../locales/en/common.json"); + auth: typeof import("../locales/en/auth.json"); + } +} +``` + +### 3. Anbieter einrichten + +Umhülle deine App mit dem `TranslationsProvider`: + +```tsx +// Für React +import { TranslationsProvider } from "@onruntime/translations/react"; +import en from "./locales/en"; +import fr from "./locales/fr"; + +const locales = { en, fr }; + +function App() { + return ( + + + + ); +} +``` + + + Für Next.js mit App Router, schau dir die [Next.js Nutzung](/docs/translations/nextjs) Anleitung für das empfohlene Setup an. + + +## Installation überprüfen + +Teste dein Setup mit einer einfachen Komponente: + +```tsx +import { useTranslation } from "@onruntime/translations/react"; + +function TestComponent() { + const { t } = useTranslation("common"); + + return ( +
+

{t("title")}

+

{t("greeting", { name: "Welt" })}

+
+ ); +} +``` + +Wenn du deine Übersetzungen gerendert siehst, bist du bereit! + +## Nächste Schritte + + + + + diff --git a/apps/web/src/content/de/docs/translations/nextjs.mdx b/apps/web/src/content/de/docs/translations/nextjs.mdx new file mode 100644 index 000000000..25428522b --- /dev/null +++ b/apps/web/src/content/de/docs/translations/nextjs.mdx @@ -0,0 +1,191 @@ +--- +title: Next.js Nutzung +description: Verwendung von @onruntime/translations mit Next.js App Router +--- +## Einrichtung für den App Router + +### 1. Konfigurieren Sie den Anbieter + +Erstellen Sie eine Anbieter-Datei, um Übersetzungen einzurichten: + +```tsx +// app/providers.tsx +"use client"; + +import { TranslationsProvider } from "@onruntime/translations/react"; +import { ReactNode } from "react"; + +import en from "@/locales/en"; +import fr from "@/locales/fr"; + +const locales = { en, fr }; + +interface ProvidersProps { + children: ReactNode; + locale: string; +} + +export function Providers({ children, locale }: ProvidersProps) { + return ( + + {children} + + ); +} +``` + +### 2. Richten Sie das Root-Layout ein + +Verwenden Sie den Anbieter in Ihrem Root-Layout: + +```tsx +// app/[locale]/layout.tsx +import { Providers } from "../providers"; + +export default function LocaleLayout({ + children, + params, +}: { + children: React.ReactNode; + params: { locale: string }; +}) { + return ( + + {children} + + ); +} +``` + +## Server-Komponenten + +Verwenden Sie `getTranslation` für Server-Komponenten: + +```tsx +// app/[locale]/page.tsx +import { getTranslation } from "@/lib/translations.server"; + +export default async function HomePage() { + const { t } = await getTranslation("common"); + + return ( +
+

{t("title")}

+

{t("description")}

+
+ ); +} +``` + + + Verwenden Sie `getTranslation` in Server-Komponenten und `useTranslation` in Client-Komponenten. + + +## Client-Komponenten + +Verwenden Sie `useTranslation` für Client-Komponenten: + +```tsx +"use client"; + +import { useTranslation } from "@onruntime/translations/react"; + +export function LanguageSwitcher() { + const { locale, setLocale } = useTranslation("common"); + + return ( + + ); +} +``` + +## Lokalisierungsbasierte Routenführung + +### Middleware-Einrichtung + +Richten Sie Middleware ein, um die Lokalisierung zu erkennen: + +```tsx +// middleware.ts +import { NextRequest, NextResponse } from "next/server"; + +const locales = ["en", "fr"]; +const defaultLocale = "en"; + +export function middleware(request: NextRequest) { + const pathname = request.nextUrl.pathname; + + // Überprüfen, ob der Pfad einen Locale hat + const pathnameHasLocale = locales.some( + (locale) => pathname.startsWith(`/${locale}/`) || pathname === `/${locale}` + ); + + if (pathnameHasLocale) return; + + // Weiterleitung zur Standard-Locale + return NextResponse.redirect( + new URL(`/${defaultLocale}${pathname}`, request.url) + ); +} + +export const config = { + matcher: ["/((?!api|_next|.*\\..*).*)"], +}; +``` + +## Statische Generierung + +Generieren Sie statische Seiten für alle Locales: + +```tsx +// app/[locale]/page.tsx +export async function generateStaticParams() { + return [{ locale: "en" }, { locale: "fr" }]; +} +``` + +## Link-Komponente + +Verwenden Sie die übersetzte Link-Komponente für die Navigation: + +```tsx +import { Link } from "@onruntime/translations/next"; + +function Navigation() { + return ( + + ); +} +``` + +Die `Link`-Komponente behandelt automatisch das Hinzufügen des Locale-Prefixes. + +## Beispielprojektstruktur + + + + + + + + + + + + + + + + + + + + + + diff --git a/apps/web/src/content/de/docs/translations/react.mdx b/apps/web/src/content/de/docs/translations/react.mdx new file mode 100644 index 000000000..a35ab0435 --- /dev/null +++ b/apps/web/src/content/de/docs/translations/react.mdx @@ -0,0 +1,157 @@ +--- +title: Verwendung von React +description: Die Verwendung von @onruntime/translations in React-Anwendungen +--- +## Grundlegende Verwendung + +### Der useTranslation Hook + +Der `useTranslation` Hook ist deine Hauptmethode, um Übersetzungen in React-Komponenten zuzugreifen: + +```tsx +import { useTranslation } from "@onruntime/translations/react"; + +function MyComponent() { + const { t, locale } = useTranslation("common"); + + return ( +
+

Aktuelle Sprache: {locale}

+

{t("title")}

+
+ ); +} +``` + +### Variableninterpolation + +Übergebe Variablen an deine Übersetzungen: + +```json +// locales/en/common.json +{ + "greeting": "Hallo, {name}!", + "items_count": "Du hast {count} Artikel" +} +``` + +```tsx +function Greeting({ name, itemCount }) { + const { t } = useTranslation("common"); + + return ( + <> +

{t("greeting", { name })}

+

{t("items_count", { count: itemCount })}

+ + ); +} +``` + +## Mehrere Namensräume + +Du kannst mehrere Namensräume in der gleichen Komponente verwenden: + +```tsx +function Dashboard() { + const { t: tCommon } = useTranslation("common"); + const { t: tDashboard } = useTranslation("dashboard"); + + return ( +
+

{tDashboard("title")}

+ +
+ ); +} +``` + +## Sprache ändern + +Verwende die `setLocale` Funktion, um die aktuelle Sprache zu ändern: + +```tsx +import { useTranslation } from "@onruntime/translations/react"; + +function LanguageSwitcher() { + const { locale, setLocale } = useTranslation("common"); + + return ( + + ); +} +``` + +## Verschachtelte Schlüssel + +Greife auf verschachtelte Übersetzungsschlüssel mit Punktnotation zu: + +```json +// locales/en/common.json +{ + "nav": { + "home": "Startseite", + "about": "Über", + "contact": "Kontakt" + } +} +``` + +```tsx +function Navigation() { + const { t } = useTranslation("common"); + + return ( + + ); +} +``` + +## Beste Praktiken + + + Organisiere Übersetzungen nach Funktion oder Seite, anstatt alles in eine Datei zu packen. + + +### Empfohlene Struktur + + + + + + + + + + + + +### Halte Schlüssel konsistent + +Verwende konsistente Benennungskonventionen über alle Sprachen hinweg: + +```json +// ✅ Gut - konsistente Struktur +{ + "page_title": "Dashboard", + "actions": { + "save": "Speichern", + "cancel": "Abbrechen" + } +} + +// ❌ Vermeiden - inkonsistent +{ + "pageTitle": "Dashboard", + "save_button": "Speichern", + "cancelBtn": "Abbrechen" +} +``` diff --git a/apps/web/src/content/es/docs/gitmoji/emojis.mdx b/apps/web/src/content/es/docs/gitmoji/emojis.mdx new file mode 100644 index 000000000..9e6a012fe --- /dev/null +++ b/apps/web/src/content/es/docs/gitmoji/emojis.mdx @@ -0,0 +1,11 @@ +--- +title: Referencia de Emoji +description: Lista completa de gitmojis +--- +Usamos [gitmoji](https://gitmoji.dev) para categorizar nuestros commits. Aquí está la lista completa de emojis, su código y descripción: + + + + + Usa [gitmoji-cli](https://github.com/carloscuesta/gitmoji-cli) o la [extensión de VS Code](https://marketplace.visualstudio.com/items?itemName=seatonjiang.gitmoji-vscode) para una experiencia interactiva de commits. + diff --git a/apps/web/src/content/es/docs/gitmoji/getting-started.mdx b/apps/web/src/content/es/docs/gitmoji/getting-started.mdx new file mode 100644 index 000000000..acf81bf37 --- /dev/null +++ b/apps/web/src/content/es/docs/gitmoji/getting-started.mdx @@ -0,0 +1,91 @@ +--- +title: Comenzando +description: Aprende nuestra convención de commits +--- +Nos gusta tener un historial de proyectos limpio. Nuestra convención de commits está inspirada en [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0) pero personalizada con [gitmoji](https://gitmoji.dev) para hacerlo más visual y divertido. + +## Estructura + +El mensaje del commit debe estar estructurado de la siguiente manera y **en minúsculas**: + +``` + [(#)] + +[cuerpo opcional] + +[pie opcional(es)] +``` + +### Ejemplo + +```bash +📝 actualizar colaboradores de documentación + +- Agregar a @jerembdn como colaborador +- Agregar a @younesbessa como colaborador + +Co-authored-by: Younes Bessa +``` + +La mayoría de las veces, una línea simple es suficiente: + +```bash +📝 actualizar colaboradores de documentación +``` + +## Tipos + +Usamos los siguientes tipos de commits: + +| Tipo | Descripción | +| --- | --- | +| `add` | Agregar una nueva característica | +| `fix` | Arreglar un error | +| `improve` | Mejorar algo | +| `update` | Actualizar algo | +| `remove` | Eliminar algo | +| `refactor` | Refactorizar algo | +| `rename` | Renombrar algo | +| `move` | Mover un archivo o carpeta | +| `upgrade` | Actualizar dependencias | +| `downgrade` | Degradar dependencias | + +## Descripción + +Escribe descripciones en **modo imperativo** y **en minúsculas**: + +```bash +# Bueno +📝 actualizar colaboradores de documentación + +# Malo +📝 actualizado colaboradores de documentación + +# Malo +📝 Actualizar colaboradores de documentación +``` + +## Número de Issue + +Vincula commits a issues añadiendo el número de issue: + +```bash +📝 actualizar colaboradores de documentación (#123) +``` + +## Cuerpo + +Usa el cuerpo para contexto y motivación: + +```bash +📝 actualizar colaboradores de documentación + +- Agregar a @jerembdn como colaborador +- Agregar a @younesbessa como colaborador + +Co-authored-by: Younes Bessa +``` + + + Cada commit debe representar un solo cambio lógico. No mezcles cambios no relacionados. + diff --git a/apps/web/src/content/es/docs/gitmoji/with-ai.mdx b/apps/web/src/content/es/docs/gitmoji/with-ai.mdx new file mode 100644 index 000000000..907d528cc --- /dev/null +++ b/apps/web/src/content/es/docs/gitmoji/with-ai.mdx @@ -0,0 +1,63 @@ +--- +title: Con IA +description: Usa gitmoji con Claude Code +--- +Instala nuestro plugin gitmoji para [Claude Code](https://claude.ai/code) para generar commits siguiendo la convención. + +## Instala el Plugin + +Agrega el marketplace de onRuntime e instala el plugin: + +```bash +# Agrega el marketplace de onRuntime +/plugin marketplace add https://onruntime.com/plugins + +# Instala el plugin gitmoji +/plugin install gitmoji@onruntime +``` + +O instala directamente desde el menú: + +1. Ejecuta `/plugin` en Claude Code +2. Ve a la pestaña **Descubrir** +3. Agrega el marketplace: `https://onruntime.com/plugins` +4. Busca "gitmoji" e instala + +## Uso + +Ejecuta el comando `/commit` para crear un commit: + +``` +/commit +``` + +``` +/commit fix the login bug +``` + +Claude Code analizará tus cambios y creará un commit siguiendo la convención de gitmoji. + + + El comando `/commit` obtiene automáticamente tu estado de git y diff para generar el mensaje de commit apropiado. + + +## Alternativa: CLAUDE.md + +Si prefieres no instalar el plugin, agrega esto a tu `CLAUDE.md` del proyecto: + +```markdown +## Convención de Commits + +Usa commits convencionales de gitmoji: + +\`\`\` + +\`\`\` + +Tipos: add, fix, improve, update, remove, refactor, rename, move, upgrade, downgrade + +Reglas: +- Escribe en minúsculas +- Usa modo imperativo ("add" no "added") +- Un cambio lógico por commit +``` diff --git a/apps/web/src/content/es/docs/next-sitemap/api.mdx b/apps/web/src/content/es/docs/next-sitemap/api.mdx new file mode 100644 index 000000000..640833320 --- /dev/null +++ b/apps/web/src/content/es/docs/next-sitemap/api.mdx @@ -0,0 +1,169 @@ +--- +title: Referencia de API +description: Documentación completa de API para @onruntime/next-sitemap +--- +## generateSitemap + +Genera un sitemap para tu aplicación Next.js. + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +const sitemap = await generateSitemap(options); +``` + +### Options + +| Opción | Tipo | Requerido | Descripción | +|--------|------|-----------|-------------| +| `baseUrl` | `string` | Sí | La URL base de tu sitio | +| `additionalPaths` | `SitemapEntry[]` | No | URLs adicionales para incluir | +| `exclude` | `string[]` | No | Patrones glob para excluir | +| `defaults` | `SitemapDefaults` | No | Valores predeterminados para todas las entradas | +| `locales` | `string[]` | No | Locales soportados | +| `defaultLocale` | `string` | No | Locale por defecto | + +### SitemapEntry + +| Propiedad | Tipo | Descripción | +|-----------|------|-------------| +| `url` | `string` | URL de la página (relativa o absoluta) | +| `lastModified` | `Date \| string` | Fecha de la última modificación | +| `changeFrequency` | `ChangeFrequency` | Con qué frecuencia cambia la página | +| `priority` | `number` | Prioridad (0.0 - 1.0) | + +### ChangeFrequency + +```tsx +type ChangeFrequency = + | "always" + | "hourly" + | "daily" + | "weekly" + | "monthly" + | "yearly" + | "never"; +``` + +### Example + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + const blogPosts = await fetchPosts(); + + return generateSitemap({ + baseUrl: "https://example.com", + defaults: { + changeFrequency: "weekly", + priority: 0.7, + }, + additionalPaths: blogPosts.map((post) => ({ + url: `/blog/${post.slug}`, + lastModified: post.updatedAt, + priority: 0.8, + })), + exclude: ["/admin/*", "/api/*"], + }); +} +``` + +## generateRobots + +Genera un archivo robots.txt. + +```tsx +import { generateRobots } from "@onruntime/next-sitemap/app"; + +const robots = generateRobots(options); +``` + +### Options + +| Opción | Tipo | Requerido | Descripción | +|--------|------|-----------|-------------| +| `baseUrl` | `string` | Sí | La URL base de tu sitio | +| `rules` | `RobotsRule[]` | No | Reglas de robots personalizadas | +| `sitemap` | `string \| boolean` | No | URL del sitemap o `false` para excluir | + +### RobotsRule + +| Propiedad | Tipo | Descripción | +|-----------|------|-------------| +| `userAgent` | `string` | Agente de usuario objetivo | +| `allow` | `string \| string[]` | Rutas permitidas | +| `disallow` | `string \| string[]` | Rutas no permitidas | +| `crawlDelay` | `number` | Retardo de rastreo en segundos | + +### Example + +```tsx +import { generateRobots } from "@onruntime/next-sitemap/app"; + +export default function robots() { + return generateRobots({ + baseUrl: "https://example.com", + rules: [ + { + userAgent: "*", + allow: "/", + disallow: ["/admin/", "/private/"], + }, + { + userAgent: "Googlebot", + allow: "/", + crawlDelay: 1, + }, + ], + }); +} +``` + +## generateSitemapIndex + +Genera un índice de sitemap para sitios grandes. + +```tsx +import { generateSitemapIndex } from "@onruntime/next-sitemap/app"; + +const index = await generateSitemapIndex(options); +``` + +### Options + +| Opción | Tipo | Requerido | Descripción | +|--------|------|-----------|-------------| +| `baseUrl` | `string` | Sí | La URL base de tu sitio | +| `sitemapsPerFile` | `number` | No | URLs por sitemap (predeterminado: 5000) | + +### Example + +```tsx +import { generateSitemapIndex } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemapIndex({ + baseUrl: "https://example.com", + sitemapsPerFile: 10000, + }); +} +``` + +## Type Exports + +El paquete exporta tipos de TypeScript para conveniencia: + +```tsx +import type { + SitemapEntry, + SitemapOptions, + RobotsOptions, + RobotsRule, + ChangeFrequency, +} from "@onruntime/next-sitemap"; +``` + + + Todas las funciones y opciones están totalmente tipadas. Tu IDE te proporcionará autocompletado y verificación de tipos. + diff --git a/apps/web/src/content/es/docs/next-sitemap/configuration.mdx b/apps/web/src/content/es/docs/next-sitemap/configuration.mdx new file mode 100644 index 000000000..e9013c199 --- /dev/null +++ b/apps/web/src/content/es/docs/next-sitemap/configuration.mdx @@ -0,0 +1,176 @@ +--- +title: Configuración +description: Configura @onruntime/next-sitemap según tus necesidades +--- +## Configuración Básica + +La configuración más simple solo requiere tu URL base: + +```tsx +// app/sitemap.ts +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + }); +} +``` + +## Configuración Avanzada + +### Rutas Personalizadas + +Agrega rutas personalizadas o contenido dinámico: + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + // Obtener contenido dinámico + const posts = await fetchBlogPosts(); + + return generateSitemap({ + baseUrl: "https://example.com", + additionalPaths: posts.map((post) => ({ + url: `/blog/${post.slug}`, + lastModified: post.updatedAt, + changeFrequency: "weekly", + priority: 0.7, + })), + }); +} +``` + +### Excluyendo Rutas + +Excluye rutas específicas del sitemap: + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + exclude: [ + "/admin/*", + "/api/*", + "/private/*", + ], + }); +} +``` + +### Prioridad y Frecuencia de Cambio + +Establece valores predeterminados para todas las páginas: + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + defaults: { + changeFrequency: "weekly", + priority: 0.7, + }, + }); +} +``` + +## Configuración de robots.txt + +### robots.txt Básico + +```tsx +// app/robots.ts +import { generateRobots } from "@onruntime/next-sitemap/app"; + +export default function robots() { + return generateRobots({ + baseUrl: "https://example.com", + }); +} +``` + +### Reglas Personalizadas + +```tsx +import { generateRobots } from "@onruntime/next-sitemap/app"; + +export default function robots() { + return generateRobots({ + baseUrl: "https://example.com", + rules: [ + { + userAgent: "*", + allow: "/", + disallow: ["/admin/", "/private/"], + }, + { + userAgent: "Googlebot", + allow: "/", + }, + ], + }); +} +``` + +## Internacionalización + +### Sitemaps Multilingües + +Soporta múltiples idiomas con alternates: + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +const locales = ["en", "fr", "de"]; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + locales, + defaultLocale: "en", + }); +} +``` + +Esto genera URLs con alternates `hreflang`: + +```xml + + https://example.com/en/about + + + + +``` + +## Sitemaps Divididos + +Para sitios grandes, divide tu sitemap en múltiples archivos: + +```tsx +// app/sitemap/[id]/route.ts +import { generateSitemapIndex } from "@onruntime/next-sitemap/app"; + +export async function GET( + request: Request, + { params }: { params: { id: string } } +) { + const sitemaps = await generateSitemapIndex({ + baseUrl: "https://example.com", + sitemapsPerFile: 5000, + }); + + return new Response(sitemaps[parseInt(params.id)], { + headers: { "Content-Type": "application/xml" }, + }); +} +``` + + + Google recomienda mantener los sitemaps por debajo de 50MB y 50,000 URLs. Usa sitemaps divididos para sitios más grandes. + diff --git a/apps/web/src/content/es/docs/next-sitemap/getting-started.mdx b/apps/web/src/content/es/docs/next-sitemap/getting-started.mdx new file mode 100644 index 000000000..baef22d88 --- /dev/null +++ b/apps/web/src/content/es/docs/next-sitemap/getting-started.mdx @@ -0,0 +1,86 @@ +--- +title: Empezando +description: Un generador de mapas del sitio para aplicaciones Next.js +--- +## ¿Qué es @onruntime/next-sitemap? + +`@onruntime/next-sitemap` es un generador de sitemap potente diseñado específicamente para aplicaciones Next.js. Genera automáticamente los archivos `sitemap.xml` y `robots.txt` para tu sitio de Next.js. + + + - Generación automática de sitemap para App Router + - Soporte para rutas dinámicas + - Prioridad y changefreq configurables + - Generación de robots.txt + - Soporte para sitemap en múltiples idiomas + + +## ¿Por qué usarlo? + +### Optimización SEO + +Los sitemaps ayudan a los motores de búsqueda a descubrir e indexar tus páginas de manera más eficiente: + +- **Indexación más rápida** - Los motores de búsqueda pueden encontrar todas tus páginas +- **Mejor rastreo** - Informa a los rastreadores sobre las actualizaciones de las páginas +- **Indicaciones de prioridad** - Guía a los rastreadores hacia páginas importantes + +### Integración con Next.js + +Construido específicamente para Next.js, comprende: + +- Estructura de App Router +- Rutas dinámicas +- Generación estática +- Enrutamiento internacionalizado + +## Ejemplo rápido + +```tsx +// app/sitemap.ts +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + }); +} +``` + +Esto genera un sitemap completo que incluye todas tus páginas estáticas y dinámicas. + +## Salida generada + +El paquete genera sitemaps XML estándar: + +```xml + + + + https://example.com/ + 2024-01-15 + daily + 1.0 + + + https://example.com/about + 2024-01-10 + monthly + 0.8 + + +``` + +## Próximos pasos + + + + + diff --git a/apps/web/src/content/es/docs/next-sitemap/installation.mdx b/apps/web/src/content/es/docs/next-sitemap/installation.mdx new file mode 100644 index 000000000..e4e2549f3 --- /dev/null +++ b/apps/web/src/content/es/docs/next-sitemap/installation.mdx @@ -0,0 +1,121 @@ +--- +title: Instalación +description: Instala y configura @onruntime/next-sitemap +--- +## Instalación + +Instala el paquete usando tu gestor de paquetes favorito: + +```bash +# npm +npm install @onruntime/next-sitemap + +# yarn +yarn add @onruntime/next-sitemap + +# pnpm +pnpm add @onruntime/next-sitemap +``` + +## Configuración Básica + +### App Router (Next.js 13+) + +Crea un archivo `sitemap.ts` en tu directorio `app`: + +```tsx +// app/sitemap.ts +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://your-domain.com", + }); +} +``` + +### robots.txt + +Crea un archivo `robots.ts` para la generación de robots.txt: + +```tsx +// app/robots.ts +import { generateRobots } from "@onruntime/next-sitemap/app"; + +export default function robots() { + return generateRobots({ + baseUrl: "https://your-domain.com", + }); +} +``` + +## Estructura del Proyecto + +Después de la configuración, tu proyecto debería verse así: + + + + + + + + + + + + + + + + + + +## Verificar Instalación + +Inicia tu servidor de desarrollo y visita: + +- `http://localhost:3000/sitemap.xml` - Tu sitemap +- `http://localhost:3000/robots.txt` - Tu robots.txt + +Deberías ver XML generado para tu sitemap y contenido de texto para robots.txt. + + + El sitemap incluirá todas las rutas descubiertas en el tiempo de compilación. En desarrollo, refleja tu estructura de rutas actual. + + +## Variables de Entorno + +Para producción, establece tu URL base: + +```env +# .env.production +NEXT_PUBLIC_SITE_URL=https://your-domain.com +``` + +Luego úsala en tu configuración: + +```tsx +// app/sitemap.ts +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: process.env.NEXT_PUBLIC_SITE_URL || "https://your-domain.com", + }); +} +``` + +## Próximos Pasos + + + + + diff --git a/apps/web/src/content/es/docs/translations/api.mdx b/apps/web/src/content/es/docs/translations/api.mdx new file mode 100644 index 000000000..b2d3e48ab --- /dev/null +++ b/apps/web/src/content/es/docs/translations/api.mdx @@ -0,0 +1,194 @@ +--- +title: Referencia de API +description: Documentación completa de API para @onruntime/translations +--- +## TranslationsProvider + +El componente proveedor que envuelve tu aplicación. + +```tsx +import { TranslationsProvider } from "@onruntime/translations/react"; + + + {children} + +``` + +### Props + +| Prop | Tipo | Requerido | Descripción | +|------|------|----------|-------------| +| `locale` | `string` | Sí | Locale activo actual | +| `locales` | `Record` | Sí | Objeto que contiene todas las traducciones de locales | +| `fallbackLocale` | `string` | No | Locale de respaldo cuando falta la clave | +| `children` | `ReactNode` | Sí | Componentes hijos | + +## useTranslation + +Hook para acceder a traducciones en componentes del cliente. + +```tsx +const { t, locale, setLocale } = useTranslation("namespace"); +``` + +### Parámetros + +| Parámetro | Tipo | Requerido | Descripción | +|-----------|------|----------|-------------| +| `namespace` | `string` | Sí | Namespace de traducción a usar | + +### Devuelve + +| Propiedad | Tipo | Descripción | +|----------|------|-------------| +| `t` | `(key: string, vars?: object) => string` | Función de traducción | +| `locale` | `string` | Locale actual | +| `setLocale` | `(locale: string) => void` | Función para cambiar el locale | + +### Ejemplo + +```tsx +const { t, locale, setLocale } = useTranslation("common"); + +// Uso básico +t("greeting"); // "¡Hola!" + +// Con variables +t("greeting_name", { name: "Juan" }); // "¡Hola, Juan!" + +// Claves anidadas +t("nav.home"); // "Inicio" + +// Cambiar locale +setLocale("fr"); +``` + +## getTranslation + +Función asíncrona para acceder a traducciones en componentes del servidor (Next.js). + +```tsx +const { t } = await getTranslation("namespace"); +``` + +### Parámetros + +| Parámetro | Tipo | Requerido | Descripción | +|-----------|------|----------|-------------| +| `namespace` | `string` | Sí | Namespace de traducción a usar | + +### Devuelve + +| Propiedad | Tipo | Descripción | +|----------|------|-------------| +| `t` | `(key: string, vars?: object) => string` | Función de traducción | +| `locale` | `string` | Locale actual | + +### Ejemplo + +```tsx +// Componente del servidor +export default async function Page() { + const { t } = await getTranslation("common"); + + return

{t("title")}

; +} +``` + +## Link Component + +Componente Link consciente del locale para Next.js. + +```tsx +import { Link } from "@onruntime/translations/next"; + +Sobre +``` + +### Props + +Todos los props del componente `Link` de Next.js, además de: + +| Prop | Tipo | Predeterminado | Descripción | +|------|------|----------------|-------------| +| `locale` | `string` | Locale actual | Sobrescribir el locale del enlace | + +### Ejemplo + +```tsx +// Usa el locale actual +Sobre + +// Forzar un locale específico +À propos +``` + +## Translation Function (t) + +La función `t` se utiliza para recuperar cadenas traducidas. + +### Firma + +```tsx +t(key: string, variables?: Record): string +``` + +### Parámetros + +| Parámetro | Tipo | Descripción | +|-----------|------|-------------| +| `key` | `string` | Clave de traducción (soporta notación de punto) | +| `variables` | `object` | Variables para interpolar | + +### Interpolación de Variables + +```json +{ + "greeting": "¡Hola, {name}!", + "items": "Tienes {count} elementos" +} +``` + +```tsx +t("greeting", { name: "Alicia" }); // "¡Hola, Alicia!" +t("items", { count: 5 }); // "Tienes 5 elementos" +``` + +### Claves Anidadas + +```json +{ + "user": { + "profile": { + "title": "Perfil" + } + } +} +``` + +```tsx +t("user.profile.title"); // "Perfil" +``` + +## Type Definitions + +### TranslationNamespaces + +Extiende esta interfaz para traducciones seguras de tipos: + +```tsx +declare module "@onruntime/translations" { + interface TranslationNamespaces { + common: typeof import("./locales/es/common.json"); + auth: typeof import("./locales/es/auth.json"); + } +} +``` + + + Con las definiciones de tipo adecuadas, obtendrás autocompletado para las claves de traducción y errores en tiempo de compilación para claves inválidas. + diff --git a/apps/web/src/content/es/docs/translations/getting-started.mdx b/apps/web/src/content/es/docs/translations/getting-started.mdx new file mode 100644 index 000000000..dd2808f26 --- /dev/null +++ b/apps/web/src/content/es/docs/translations/getting-started.mdx @@ -0,0 +1,94 @@ +--- +title: Empezando +description: >- + Una biblioteca de internacionalización ligera y segura para tipos para React y + Next.js +--- +## ¿Qué es @onruntime/translations? + +`@onruntime/translations` es una biblioteca de internacionalización (i18n) ligera y con tipos diseñada para aplicaciones de React y Next.js. Proporciona una API simple para gestionar traducciones con soporte completo de TypeScript. + + + - Traducciones seguras con TypeScript + - Soporte para React y Next.js (App Router) + - Organización basada en namespaces + - Interpolación de variables + - Ligera y eficiente + + +## ¿Por Qué Usarlo? + +### Seguridad de Tipos + +Obtén errores en tiempo de compilación al usar claves de traducción inválidas: + +```typescript +const { t } = useTranslation("common"); + +t("greeting"); // ✅ Clave válida +t("invalid_key"); // ❌ Error de TypeScript +``` + +### API Simple + +Solo dos hooks para todas tus necesidades de traducción: + +```typescript +// Componentes del Cliente +const { t } = useTranslation("namespace"); + +// Componentes del Servidor (Next.js) +const { t } = await getTranslation("namespace"); +``` + +### Traducciones Organizandas + +Mantén tus traducciones organizadas con namespaces: + + + + + + + + + + + + + + + + +## Ejemplo Rápido + +```tsx +// locales/en/common.json +{ + "greeting": "¡Hola, {name}!" +} + +// Componente +import { useTranslation } from "@onruntime/translations/react"; + +function Welcome({ name }) { + const { t } = useTranslation("common"); + + return

{t("greeting", { name })}

; +} +``` + +## Siguientes Pasos + + + + + diff --git a/apps/web/src/content/es/docs/translations/installation.mdx b/apps/web/src/content/es/docs/translations/installation.mdx new file mode 100644 index 000000000..dd67ac77d --- /dev/null +++ b/apps/web/src/content/es/docs/translations/installation.mdx @@ -0,0 +1,127 @@ +--- +title: Instalación +description: Instala y configura @onruntime/translations +--- +## Instalación + +Instala el paquete usando tu administrador de paquetes favorito: + +```bash +# npm +npm install @onruntime/translations + +# yarn +yarn add @onruntime/translations + +# pnpm +pnpm add @onruntime/translations +``` + +## Configuración del Proyecto + +### 1. Crea Archivos de Traducción + +Crea un directorio `locales` en tu proyecto con archivos de traducción para cada idioma: + + + + + + + + + + + + + + +Ejemplo `locales/en/common.json`: + +```json +{ + "title": "Bienvenido", + "greeting": "¡Hola, {name}!", + "items": { + "one": "{count} artículo", + "other": "{count} artículos" + } +} +``` + +### 2. Configura TypeScript (Opcional) + +Para traducciones seguras en tipos, crea un archivo de definición de tipos: + +```typescript +// types/translations.d.ts +import "onruntime/translations"; + +declare module "@onruntime/translations" { + interface TranslationNamespaces { + common: typeof import("../locales/en/common.json"); + auth: typeof import("../locales/en/auth.json"); + } +} +``` + +### 3. Configura el Proveedor + +Envuelve tu app con el `TranslationsProvider`: + +```tsx +// Para React +import { TranslationsProvider } from "@onruntime/translations/react"; +import en from "./locales/en"; +import fr from "./locales/fr"; + +const locales = { en, fr }; + +function App() { + return ( + + + + ); +} +``` + + + Para Next.js con App Router, consulta la guía de [Uso de Next.js](/docs/translations/nextjs) para la configuración recomendada. + + +## Verificando la Instalación + +Prueba tu configuración con un componente simple: + +```tsx +import { useTranslation } from "@onruntime/translations/react"; + +function TestComponent() { + const { t } = useTranslation("common"); + + return ( +
+

{t("title")}

+

{t("greeting", { name: "World" })}

+
+ ); +} +``` + +Si ves tus traducciones representadas, ¡estás listo! + +## Siguientes Pasos + + + + + diff --git a/apps/web/src/content/es/docs/translations/nextjs.mdx b/apps/web/src/content/es/docs/translations/nextjs.mdx new file mode 100644 index 000000000..907f9840d --- /dev/null +++ b/apps/web/src/content/es/docs/translations/nextjs.mdx @@ -0,0 +1,191 @@ +--- +title: Uso de Next.js +description: Usando @onruntime/translations con el enrutador de la aplicación Next.js +--- +## Configuración para el Router de la App + +### 1. Configurar el Proveedor + +Crea un archivo de proveedores para configurar las traducciones: + +```tsx +// app/providers.tsx +"use client"; + +import { TranslationsProvider } from "@onruntime/translations/react"; +import { ReactNode } from "react"; + +import en from "@/locales/en"; +import fr from "@/locales/fr"; + +const locales = { en, fr }; + +interface ProvidersProps { + children: ReactNode; + locale: string; +} + +export function Providers({ children, locale }: ProvidersProps) { + return ( + + {children} + + ); +} +``` + +### 2. Configura el Layout Raíz + +Usa el proveedor en tu layout raíz: + +```tsx +// app/[locale]/layout.tsx +import { Providers } from "../providers"; + +export default function LocaleLayout({ + children, + params, +}: { + children: React.ReactNode; + params: { locale: string }; +}) { + return ( + + {children} + + ); +} +``` + +## Componentes del Servidor + +Usa `getTranslation` para Componentes del Servidor: + +```tsx +// app/[locale]/page.tsx +import { getTranslation } from "@/lib/translations.server"; + +export default async function HomePage() { + const { t } = await getTranslation("common"); + + return ( +
+

{t("title")}

+

{t("description")}

+
+ ); +} +``` + + + Usa `getTranslation` en Componentes del Servidor y `useTranslation` en Componentes del Cliente. + + +## Componentes del Cliente + +Usa `useTranslation` para Componentes del Cliente: + +```tsx +"use client"; + +import { useTranslation } from "@onruntime/translations/react"; + +export function LanguageSwitcher() { + const { locale, setLocale } = useTranslation("common"); + + return ( + + ); +} +``` + +## Enrutamiento Basado en Locales + +### Configuración del Middleware + +Configura middleware para manejar la detección de locales: + +```tsx +// middleware.ts +import { NextRequest, NextResponse } from "next/server"; + +const locales = ["en", "fr"]; +const defaultLocale = "en"; + +export function middleware(request: NextRequest) { + const pathname = request.nextUrl.pathname; + + // Verifica si el pathname tiene un locale + const pathnameHasLocale = locales.some( + (locale) => pathname.startsWith(`/${locale}/`) || pathname === `/${locale}` + ); + + if (pathnameHasLocale) return; + + // Redirigir al locale por defecto + return NextResponse.redirect( + new URL(`/${defaultLocale}${pathname}`, request.url) + ); +} + +export const config = { + matcher: ["/((?!api|_next|.*\\..*).*)"], +}; +``` + +## Generación Estática + +Genera páginas estáticas para todos los locales: + +```tsx +// app/[locale]/page.tsx +export async function generateStaticParams() { + return [{ locale: "en" }, { locale: "fr" }]; +} +``` + +## Componente Link + +Usa el componente Link traducido para la navegación: + +```tsx +import { Link } from "@onruntime/translations/next"; + +function Navigation() { + return ( + + ); +} +``` + +El componente `Link` maneja automáticamente el prefijo del locale. + +## Estructura de Proyecto de Ejemplo + + + + + + + + + + + + + + + + + + + + + + diff --git a/apps/web/src/content/es/docs/translations/react.mdx b/apps/web/src/content/es/docs/translations/react.mdx new file mode 100644 index 000000000..40c5461ec --- /dev/null +++ b/apps/web/src/content/es/docs/translations/react.mdx @@ -0,0 +1,157 @@ +--- +title: Uso de React +description: Usando @onruntime/translations en aplicaciones de React +--- +## Uso Básico + +### El Hook useTranslation + +El hook `useTranslation` es tu forma principal de acceder a las traducciones en componentes de React: + +```tsx +import { useTranslation } from "@onruntime/translations/react"; + +function MyComponent() { + const { t, locale } = useTranslation("common"); + + return ( +
+

Locale actual: {locale}

+

{t("title")}

+
+ ); +} +``` + +### Interpolación de Variables + +Pasa variables a tus traducciones: + +```json +// locales/es/common.json +{ + "greeting": "¡Hola, {name}!", + "items_count": "Tienes {count} artículos" +} +``` + +```tsx +function Greeting({ name, itemCount }) { + const { t } = useTranslation("common"); + + return ( + <> +

{t("greeting", { name })}

+

{t("items_count", { count: itemCount })}

+ + ); +} +``` + +## Múltiples Namespaces + +Puedes usar múltiples namespaces en el mismo componente: + +```tsx +function Dashboard() { + const { t: tCommon } = useTranslation("common"); + const { t: tDashboard } = useTranslation("dashboard"); + + return ( +
+

{tDashboard("title")}

+ +
+ ); +} +``` + +## Cambiando de Locale + +Usa la función `setLocale` para cambiar el locale actual: + +```tsx +import { useTranslation } from "@onruntime/translations/react"; + +function LanguageSwitcher() { + const { locale, setLocale } = useTranslation("common"); + + return ( + + ); +} +``` + +## Claves Anidadas + +Accede a claves de traducción anidadas usando notación de puntos: + +```json +// locales/es/common.json +{ + "nav": { + "home": "Inicio", + "about": "Acerca de", + "contact": "Contacto" + } +} +``` + +```tsx +function Navigation() { + const { t } = useTranslation("common"); + + return ( + + ); +} +``` + +## Mejores Prácticas + + + Organiza las traducciones por característica o página en lugar de poner todo en un solo archivo. + + +### Estructura Recomendada + + + + + + + + + + + + +### Mantén Claves Consistentes + +Usa convenciones de nombres consistentes en todos los locales: + +```json +// ✅ Bueno - estructura consistente +{ + "page_title": "Tablero", + "actions": { + "save": "Guardar", + "cancel": "Cancelar" + } +} + +// ❌ Evitar - inconsistente +{ + "pageTitle": "Tablero", + "save_button": "Guardar", + "cancelBtn": "Cancelar" +} +``` diff --git a/apps/web/src/content/hi/docs/gitmoji/emojis.mdx b/apps/web/src/content/hi/docs/gitmoji/emojis.mdx new file mode 100644 index 000000000..c61329851 --- /dev/null +++ b/apps/web/src/content/hi/docs/gitmoji/emojis.mdx @@ -0,0 +1,11 @@ +--- +title: इमोजी संदर्भ +description: गिटमोजी की संपूर्ण सूची +--- +हम [gitmoji](https://gitmoji.dev) का उपयोग अपनी कमिट्स को श्रेणीबद्ध करने के लिए करते हैं। यहां इमोजी की पूरी सूची, उनका कोड और विवरण है: + + + + + इंटरएक्टिव कमिट अनुभव के लिए [gitmoji-cli](https://github.com/carloscuesta/gitmoji-cli) या [VS Code एक्सटेंशन](https://marketplace.visualstudio.com/items?itemName=seatonjiang.gitmoji-vscode) का उपयोग करें। + diff --git a/apps/web/src/content/hi/docs/gitmoji/getting-started.mdx b/apps/web/src/content/hi/docs/gitmoji/getting-started.mdx new file mode 100644 index 000000000..b2589685b --- /dev/null +++ b/apps/web/src/content/hi/docs/gitmoji/getting-started.mdx @@ -0,0 +1,91 @@ +--- +title: शुरुआत करना +description: हमारी कमिट कन्वेंशन सीखें +--- +हम एक साफ़ प्रोजेक्ट इतिहास रखना पसंद करते हैं। हमारे कमिट की परंपरा [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0) से प्रेरित है लेकिन इसे [gitmoji](https://gitmoji.dev) के साथ कस्टमाइज़ किया गया है ताकि यह अधिक दृश्यात्मक और मजेदार हो सके। + +## संरचना + +कमिट संदेश का ढाँचा इस प्रकार होना चाहिए और **छोटे अक्षरों में**: + +``` + [(#)] + +[वैकल्पिक बODY] + +[वैकल्पिक फुटर(ओं)] +``` + +### उदाहरण + +```bash +📝 update documentation contributors + +- Add @jerembdn as a contributor +- Add @younesbessa as a contributor + +Co-authored-by: Younes Bessa +``` + +ज़्यादातर समय, एक साधारण एक-लाइनर ही काफी होता है: + +```bash +📝 update documentation contributors +``` + +## प्रकार + +हम निम्नलिखित कमिट प्रकारों का उपयोग करते हैं: + +| प्रकार | विवरण | +| --- | --- | +| `add` | एक नई विशेषता जोड़ें | +| `fix` | एक बग ठीक करें | +| `improve` | कुछ सुधारें | +| `update` | कुछ अपडेट करें | +| `remove` | कुछ हटाएँ | +| `refactor` | कुछ को पुनर्गठित करें | +| `rename` | कुछ का नाम बदलें | +| `move` | एक फ़ाइल या फ़ोल्डर को स्थानांतरित करें | +| `upgrade` | निर्भरताओं को अपडेट करें | +| `downgrade` | निर्भरताओं को डाउनग्रेड करें | + +## विवरण + +विवरण **आज्ञाकारी रूप** और **छोटे अक्षरों में** लिखें: + +```bash +# अच्छा +📝 update documentation contributors + +# बुरा +📝 updated documentation contributors + +# बुरा +📝 Update documentation contributors +``` + +## समस्या संख्या + +कमिट को समस्याओं से जोड़ने के लिए समस्या संख्या जोड़ें: + +```bash +📝 update documentation contributors (#123) +``` + +## शरीर + +संदर्भ और प्रेरणा के लिए शरीर का उपयोग करें: + +```bash +📝 update documentation contributors + +- Add @jerembdn as a contributor +- Add @younesbessa as a contributor + +Co-authored-by: Younes Bessa +``` + + + प्रत्येक कमिट को एकल तार्किक परिवर्तन का प्रतिनिधित्व करना चाहिए। अव्यवस्थित परिवर्तनों को न मिलाएँ। + diff --git a/apps/web/src/content/hi/docs/gitmoji/with-ai.mdx b/apps/web/src/content/hi/docs/gitmoji/with-ai.mdx new file mode 100644 index 000000000..217dccd3e --- /dev/null +++ b/apps/web/src/content/hi/docs/gitmoji/with-ai.mdx @@ -0,0 +1,63 @@ +--- +title: एआई के साथ +description: Claude Code के साथ gitmoji का इस्तेमाल करो +--- +हमारा gitmoji प्लगइन [Claude Code](https://claude.ai/code) के लिए इंस्टॉल करें ताकि कंवencija के अनुसार कमिट जेनरेट कर सकें। + +## प्लगइन इंस्टॉल करें + +onRuntime मार्केटप्लेस जोड़ें और प्लगइन इंस्टॉल करें: + +```bash +# Add the onRuntime marketplace +/plugin marketplace add https://onruntime.com/plugins + +# Install the gitmoji plugin +/plugin install gitmoji@onruntime +``` + +या मेनू से सीधे इंस्टॉल करें: + +1. Claude Code में `/plugin` चलाएं +2. **Discover** टैब पर जाएं +3. मार्केटप्लेस जोड़ें: `https://onruntime.com/plugins` +4. "gitmoji" खोजें और इंस्टॉल करें + +## उपयोग + +कमिट बनाने के लिए `/commit` कमांड चलाएं: + +``` +/commit +``` + +``` +/commit fix the login bug +``` + +Claude Code आपके बदलावों का विश्लेषण करेगा और gitmoji कंवencija के अनुसार एक कमिट बनाएगा। + + + `/commit` कमांड अपने git स्थिति और डिफ को स्वचालित रूप से लाता है ताकि उपयुक्त कमिट संदेश जेनरेट किया जा सके। + + +## वैकल्पिक: CLAUDE.md + +अगर आप प्लगइन इंस्टॉल नहीं करना चाहते, तो यह अपने प्रोजेक्ट के `CLAUDE.md` में जोड़ें: + +```markdown +## कमिट कंवENCIA + +gitmoji पारंपरिक कमिट्स का उपयोग करें: + +\`\`\` + +\`\`\` + +प्रकार: add, fix, improve, update, remove, refactor, rename, move, upgrade, downgrade + +नियम: +- छोटी अक्षरों में लिखें +- कार्य रूप का उपयोग करें ("add" नहीं "added") +- हर कमिट में एक तार्किक परिवर्तन +``` diff --git a/apps/web/src/content/hi/docs/next-sitemap/api.mdx b/apps/web/src/content/hi/docs/next-sitemap/api.mdx new file mode 100644 index 000000000..a81c83860 --- /dev/null +++ b/apps/web/src/content/hi/docs/next-sitemap/api.mdx @@ -0,0 +1,169 @@ +--- +title: एपीआई संदर्भ +description: '@onruntime/next-sitemap के लिए पूरी एपीआई दस्तावेज़ीकरण' +--- +## generateSitemap + +आपके Next.js एप्लिकेशन के लिए एक साइटमैप जनरेट करता है। + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +const sitemap = await generateSitemap(options); +``` + +### Options + +| Option | Type | Required | Description | +|--------|------|----------|-------------| +| `baseUrl` | `string` | हाँ | आपके साइट का बेस URL | +| `additionalPaths` | `SitemapEntry[]` | नहीं | शामिल करने के लिए अतिरिक्त URLs | +| `exclude` | `string[]` | नहीं | बाहर करने के लिए ग्लोब पैटर्न | +| `defaults` | `SitemapDefaults` | नहीं | सभी एंट्रियों के लिए डिफ़ॉल्ट मान | +| `locales` | `string[]` | नहीं | समर्थित लोकल्स | +| `defaultLocale` | `string` | नहीं | डिफ़ॉल्ट लोकल | + +### SitemapEntry + +| Property | Type | Description | +|----------|------|-------------| +| `url` | `string` | पेज का URL (सापेक्ष या निरपेक्ष) | +| `lastModified` | `Date \| string` | अंतिम संशोधन तिथि | +| `changeFrequency` | `ChangeFrequency` | पेज कितनी बार बदलता है | +| `priority` | `number` | प्राथमिकता (0.0 - 1.0) | + +### ChangeFrequency + +```tsx +type ChangeFrequency = + | "always" + | "hourly" + | "daily" + | "weekly" + | "monthly" + | "yearly" + | "never"; +``` + +### Example + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + const blogPosts = await fetchPosts(); + + return generateSitemap({ + baseUrl: "https://example.com", + defaults: { + changeFrequency: "weekly", + priority: 0.7, + }, + additionalPaths: blogPosts.map((post) => ({ + url: `/blog/${post.slug}`, + lastModified: post.updatedAt, + priority: 0.8, + })), + exclude: ["/admin/*", "/api/*"], + }); +} +``` + +## generateRobots + +एक robots.txt फ़ाइल जनरेट करता है। + +```tsx +import { generateRobots } from "@onruntime/next-sitemap/app"; + +const robots = generateRobots(options); +``` + +### Options + +| Option | Type | Required | Description | +|--------|------|----------|-------------| +| `baseUrl` | `string` | हाँ | आपके साइट का बेस URL | +| `rules` | `RobotsRule[]` | नहीं | कस्टम रोबोट्स नियम | +| `sitemap` | `string \| boolean` | नहीं | साइटमैप URL या बाहर करने के लिए `false` | + +### RobotsRule + +| Property | Type | Description | +|----------|------|-------------| +| `userAgent` | `string` | लक्षित उपयोगकर्ता एजेंट | +| `allow` | `string \| string[]` | अनुमति प्राप्त पथ | +| `disallow` | `string \| string[]` | अवरुद्ध पथ | +| `crawlDelay` | `number` | क्रॉल में देरी सेकंड में | + +### Example + +```tsx +import { generateRobots } from "@onruntime/next-sitemap/app"; + +export default function robots() { + return generateRobots({ + baseUrl: "https://example.com", + rules: [ + { + userAgent: "*", + allow: "/", + disallow: ["/admin/", "/private/"], + }, + { + userAgent: "Googlebot", + allow: "/", + crawlDelay: 1, + }, + ], + }); +} +``` + +## generateSitemapIndex + +बड़े साइटों के लिए एक साइटमैप इंडेक्स जनरेट करता है। + +```tsx +import { generateSitemapIndex } from "@onruntime/next-sitemap/app"; + +const index = await generateSitemapIndex(options); +``` + +### Options + +| Option | Type | Required | Description | +|--------|------|----------|-------------| +| `baseUrl` | `string` | हाँ | आपके साइट का बेस URL | +| `sitemapsPerFile` | `number` | नहीं | साइटमैप प्रति फ़ाइल (डिफ़ॉल्ट: 5000) | + +### Example + +```tsx +import { generateSitemapIndex } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemapIndex({ + baseUrl: "https://example.com", + sitemapsPerFile: 10000, + }); +} +``` + +## Type Exports + +पैकेज सुविधा के लिए TypeScript प्रकारों का निर्यात करता है: + +```tsx +import type { + SitemapEntry, + SitemapOptions, + RobotsOptions, + RobotsRule, + ChangeFrequency, +} from "@onruntime/next-sitemap"; +``` + + + सभी फ़ंक्शन और विकल्प पूरी तरह से टाइप किए गए हैं। आपकी IDE ऑटो-कंप्लीट और प्रकार जांच प्रदान करेगी। + diff --git a/apps/web/src/content/hi/docs/next-sitemap/configuration.mdx b/apps/web/src/content/hi/docs/next-sitemap/configuration.mdx new file mode 100644 index 000000000..00e37bae0 --- /dev/null +++ b/apps/web/src/content/hi/docs/next-sitemap/configuration.mdx @@ -0,0 +1,176 @@ +--- +title: कॉन्फ़िगरेशन +description: आपकी ज़रूरतों के अनुसार @onruntime/next-sitemap को कॉन्फ़िगर करें +--- +## बेसिक कॉन्फ़िगरेशन + +सर्वाधिक सरल कॉन्फ़िगरेशन केवल आपकी बेस URL की आवश्यकता होती है: + +```tsx +// app/sitemap.ts +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + }); +} +``` + +## उन्नत कॉन्फ़िगरेशन + +### कस्टम रूट्स + +कस्टम रूट्स या डायनामिक सामग्री जोड़ें: + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + // डायनामिक सामग्री लाएं + const posts = await fetchBlogPosts(); + + return generateSitemap({ + baseUrl: "https://example.com", + additionalPaths: posts.map((post) => ({ + url: `/blog/${post.slug}`, + lastModified: post.updatedAt, + changeFrequency: "weekly", + priority: 0.7, + })), + }); +} +``` + +### रूट्स को बाहर करना + +साइटमैप से विशिष्ट रूट्स को बाहर करें: + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + exclude: [ + "/admin/*", + "/api/*", + "/private/*", + ], + }); +} +``` + +### प्राथमिकता और परिवर्तन आवृत्ति + +सभी पृष्ठों के लिए डिफ़ॉल्ट मान सेट करें: + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + defaults: { + changeFrequency: "weekly", + priority: 0.7, + }, + }); +} +``` + +## robots.txt कॉन्फ़िगरेशन + +### बेसिक robots.txt + +```tsx +// app/robots.ts +import { generateRobots } from "@onruntime/next-sitemap/app"; + +export default function robots() { + return generateRobots({ + baseUrl: "https://example.com", + }); +} +``` + +### कस्टम नियम + +```tsx +import { generateRobots } from "@onruntime/next-sitemap/app"; + +export default function robots() { + return generateRobots({ + baseUrl: "https://example.com", + rules: [ + { + userAgent: "*", + allow: "/", + disallow: ["/admin/", "/private/"], + }, + { + userAgent: "Googlebot", + allow: "/", + }, + ], + }); +} +``` + +## इंटरनैशनलाइज़ेशन + +### मल्टी-लैंग्वेज साइटमैप्स + +वैकल्पिक के साथ कई भाषाओं का समर्थन करें: + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +const locales = ["en", "fr", "de"]; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + locales, + defaultLocale: "en", + }); +} +``` + +यह `hreflang` वैकल्पिक के साथ URLs उत्पन्न करता है: + +```xml + + https://example.com/en/about + + + + +``` + +## स्प्लिट साइटमैप्स + +बड़े साइटों के लिए, अपने साइटमैप को कई फ़ाइलों में विभाजित करें: + +```tsx +// app/sitemap/[id]/route.ts +import { generateSitemapIndex } from "@onruntime/next-sitemap/app"; + +export async function GET( + request: Request, + { params }: { params: { id: string } } +) { + const sitemaps = await generateSitemapIndex({ + baseUrl: "https://example.com", + sitemapsPerFile: 5000, + }); + + return new Response(sitemaps[parseInt(params.id)], { + headers: { "Content-Type": "application/xml" }, + }); +} +``` + + + Google 50MB और 50,000 URLs से कम साइटमैप रखने की सिफारिश करता है। बड़े साइटों के लिए स्प्लिट साइटमैप का उपयोग करें। + diff --git a/apps/web/src/content/hi/docs/next-sitemap/getting-started.mdx b/apps/web/src/content/hi/docs/next-sitemap/getting-started.mdx new file mode 100644 index 000000000..fff103998 --- /dev/null +++ b/apps/web/src/content/hi/docs/next-sitemap/getting-started.mdx @@ -0,0 +1,86 @@ +--- +title: शुरुआत करना +description: Next.js एप्लिकेशन के लिए एक साइटमैप जनरेटर +--- +## @onruntime/next-sitemap क्या है? + +`@onruntime/next-sitemap` एक शक्तिशाली साइटमैप जनरेटर है जो विशेष रूप से Next.js एप्लिकेशन के लिए डिज़ाइन किया गया है। यह आपके Next.js साइट के लिए स्वचालित रूप से `sitemap.xml` और `robots.txt` फ़ाइलें उत्पन्न करता है। + + + - ऐप राउटर के लिए स्वचालित साइटमैप निर्माण + - डायनामिक रूट्स के लिए समर्थन + - कॉन्फ़िगरेबल प्राथमिकता और परिवर्तन आवृत्ति + - robots.txt निर्माण + - बहु-भाषा साइटमैप समर्थन + + +## इसका उपयोग क्यों करें? + +### SEO अनुकूलन + +साइटमैप खोज इंजनों को आपकी पृष्ठों का पता लगाने और उन्हें अधिक कुशलता से अनुक्रमित करने में मदद करते हैं: + +- **तेज़ अनुक्रमण** - खोज इंजन आपके सभी पृष्ठों को खोज सकते हैं +- **बेहतर क्रॉलिंग** - क्रॉलर्स को पृष्ठ अपडेट के बारे में सूचित करें +- **प्राथमिकता संकेत** - क्रॉलर्स को महत्वपूर्ण पृष्ठों की दिशा दिखाएं + +### Next.js एकीकरण + +विशेष रूप से Next.js के लिए निर्मित, यह समझता है: + +- ऐप राउटर संरचना +- डायनामिक रूट्स +- स्थिर निर्माण +- अंतर्राष्ट्रीयकरण रूटिंग + +## त्वरित उदाहरण + +```tsx +// app/sitemap.ts +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + }); +} +``` + +यह आपके सभी स्थिर और डायनामिक पृष्ठों सहित एक पूर्ण साइटमैप उत्पन्न करता है। + +## उत्पन्न आउटपुट + +पैकेज मानक XML साइटमैप उत्पन्न करता है: + +```xml + + + + https://example.com/ + 2024-01-15 + daily + 1.0 + + + https://example.com/about + 2024-01-10 + monthly + 0.8 + + +``` + +## अगला कदम + + + + + diff --git a/apps/web/src/content/hi/docs/next-sitemap/installation.mdx b/apps/web/src/content/hi/docs/next-sitemap/installation.mdx new file mode 100644 index 000000000..b95499e60 --- /dev/null +++ b/apps/web/src/content/hi/docs/next-sitemap/installation.mdx @@ -0,0 +1,121 @@ +--- +title: इंस्टॉलेशन +description: '@onruntime/next-sitemap को इंस्टॉल और सेट अप करें' +--- +## स्थापना + +अपने पसंदीदा पैकेज प्रबंधक का उपयोग करके पैकेज स्थापित करें: + +```bash +# npm +npm install @onruntime/next-sitemap + +# yarn +yarn add @onruntime/next-sitemap + +# pnpm +pnpm add @onruntime/next-sitemap +``` + +## बुनियादी सेटअप + +### ऐप राउटर (Next.js 13+) + +अपने `app` निर्देशिका में एक `sitemap.ts` फ़ाइल बनाएं: + +```tsx +// app/sitemap.ts +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://your-domain.com", + }); +} +``` + +### robots.txt + +robots.txt जेनरेशन के लिए `robots.ts` फ़ाइल बनाएं: + +```tsx +// app/robots.ts +import { generateRobots } from "@onruntime/next-sitemap/app"; + +export default function robots() { + return generateRobots({ + baseUrl: "https://your-domain.com", + }); +} +``` + +## परियोजना संरचना + +सेटअप के बाद, आपकी परियोजना इस तरह दिखनी चाहिए: + + + + + + + + + + + + + + + + + + +## स्थापना की पुष्टि करें + +अपने विकास सर्वर को शुरू करें और देखें: + +- `http://localhost:3000/sitemap.xml` - आपकी साइटमैप +- `http://localhost:3000/robots.txt` - आपका robots.txt + +आपको अपनी साइटमैप के लिए जनरेट किया गया XML और robots.txt के लिए टेक्स्ट सामग्री देखनी चाहिए। + + + साइटमैप में सभी रूट शामिल होंगे जो निर्माण के समय खोजे गए थे। विकास में, यह आपकी वर्तमान रूट संरचना को दर्शाता है। + + +## पर्यावरण चर + +उत्पादन के लिए, अपना बेस URL सेट करें: + +```env +# .env.production +NEXT_PUBLIC_SITE_URL=https://your-domain.com +``` + +फिर इसे अपनी कॉन्फ़िगरेशन में उपयोग करें: + +```tsx +// app/sitemap.ts +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: process.env.NEXT_PUBLIC_SITE_URL || "https://your-domain.com", + }); +} +``` + +## अगले कदम + + + + + diff --git a/apps/web/src/content/hi/docs/translations/api.mdx b/apps/web/src/content/hi/docs/translations/api.mdx new file mode 100644 index 000000000..1d62e9b0d --- /dev/null +++ b/apps/web/src/content/hi/docs/translations/api.mdx @@ -0,0 +1,194 @@ +--- +title: एपीआई संदर्भ +description: '@onruntime/translations के लिए पूरी एपीआई दस्तावेज़ीकरण' +--- +## TranslationsProvider + +आपके एप्लिकेशन को लपेटने वाला प्रोवाइडर कंपोनेंट। + +```tsx +import { TranslationsProvider } from "@onruntime/translations/react"; + + + {children} + +``` + +### Props + +| Prop | Type | Required | Description | +|------|------|----------|-------------| +| `locale` | `string` | हाँ | वर्तमान सक्रिय लोकेल | +| `locales` | `Record` | हाँ | सभी लोकेल अनुवादों को शामिल करने वाला ऑब्जेक्ट | +| `fallbackLocale` | `string` | नहीं | जब कुंजी गायब हो तो फॉलबैक लोकेल | +| `children` | `ReactNode` | हाँ | चाइल्ड कंपोनेंट्स | + +## useTranslation + +क्लाइंट कंपोनेंट्स में अनुवादों तक पहुंचने के लिए हुक। + +```tsx +const { t, locale, setLocale } = useTranslation("namespace"); +``` + +### Parameters + +| Parameter | Type | Required | Description | +|-----------|------|----------|-------------| +| `namespace` | `string` | हाँ | उपयोग करने के लिए अनुवाद नामक्षेत्र | + +### Returns + +| Property | Type | Description | +|----------|------|-------------| +| `t` | `(key: string, vars?: object) => string` | अनुवाद कार्य | +| `locale` | `string` | वर्तमान लोकेल | +| `setLocale` | `(locale: string) => void` | लोकेल बदलने के लिए कार्य | + +### Example + +```tsx +const { t, locale, setLocale } = useTranslation("common"); + +// बुनियादी उपयोग +t("greeting"); // "नमस्ते" + +// वेरिएबल के साथ +t("greeting_name", { name: "John" }); // "नमस्ते, John!" + +// नेस्टेड कीज +t("nav.home"); // "गृह" + +// लोकेल बदलें +setLocale("fr"); +``` + +## getTranslation + +सर्वर कंपोनेंट्स (Next.js) में अनुवादों तक पहुंचने के लिए ऐसिंक कार्य। + +```tsx +const { t } = await getTranslation("namespace"); +``` + +### Parameters + +| Parameter | Type | Required | Description | +|-----------|------|----------|-------------| +| `namespace` | `string` | हाँ | उपयोग करने के लिए अनुवाद नामक्षेत्र | + +### Returns + +| Property | Type | Description | +|----------|------|-------------| +| `t` | `(key: string, vars?: object) => string` | अनुवाद कार्य | +| `locale` | `string` | वर्तमान लोकेल | + +### Example + +```tsx +// सर्वर कंपोनेंट +export default async function Page() { + const { t } = await getTranslation("common"); + + return

{t("title")}

; +} +``` + +## Link Component + +Next.js के लिए लोकेल-जानकारी लिंक कंपोनेंट। + +```tsx +import { Link } from "@onruntime/translations/next"; + +About +``` + +### Props + +Next.js `Link` कंपोनेंट के सभी प्रॉप्स, साथ में: + +| Prop | Type | Default | Description | +|------|------|---------|-------------| +| `locale` | `string` | वर्तमान लोकेल | लिंक लोकेल को ओवरराइड करें | + +### Example + +```tsx +// वर्तमान लोकेल का उपयोग करता है +About + +// विशेष लोकेल जबरदस्ती +À propos +``` + +## Translation Function (t) + +`t` कार्य अनुवादित स्ट्रिंग प्राप्त करने के लिए उपयोग किया जाता है। + +### Signature + +```tsx +t(key: string, variables?: Record): string +``` + +### Parameters + +| Parameter | Type | Description | +|-----------|------|-------------| +| `key` | `string` | अनुवाद कुंजी (डॉट नोटेशन का समर्थन करता है) | +| `variables` | `object` | इंटरपोलेट करने के लिए वेरिएबल्स | + +### Variable Interpolation + +```json +{ + "greeting": "नमस्ते, {name}!", + "items": "आपके पास {count} आइटम हैं" +} +``` + +```tsx +t("greeting", { name: "Alice" }); // "नमस्ते, Alice!" +t("items", { count: 5 }); // "आपके पास 5 आइटम हैं" +``` + +### Nested Keys + +```json +{ + "user": { + "profile": { + "title": "प्रोफ़ाइल" + } + } +} +``` + +```tsx +t("user.profile.title"); // "प्रोफ़ाइल" +``` + +## Type Definitions + +### TranslationNamespaces + +टाइप-सेफ अनुवादों के लिए इस इंटरफेस को बढ़ाएं: + +```tsx +declare module "@onruntime/translations" { + interface TranslationNamespaces { + common: typeof import("./locales/en/common.json"); + auth: typeof import("./locales/en/auth.json"); + } +} +``` + + + सही टाइप डेफिनिशन्स के साथ, आपको अनुवाद कुंजियों के लिए ऑटो-कम्प्लीट मिलेगा और अमान्य कुंजियों के लिए कम्पाइल-टाइम त्रुटियाँ। + diff --git a/apps/web/src/content/hi/docs/translations/getting-started.mdx b/apps/web/src/content/hi/docs/translations/getting-started.mdx new file mode 100644 index 000000000..de85313a8 --- /dev/null +++ b/apps/web/src/content/hi/docs/translations/getting-started.mdx @@ -0,0 +1,92 @@ +--- +title: शुरू करना +description: 'React और Next.js के लिए एक हल्की, टाइप-सुरक्षित अंतर्राष्ट्रीयकरण लाइब्रेरी' +--- +## @onruntime/translations क्या है? + +`@onruntime/translations` एक हल्का, प्रकार-सुरक्षित अंतर्राष्ट्रीयकरण (i18n) पुस्तकालय है जिसे React और Next.js अनुप्रयोगों के लिए डिज़ाइन किया गया है। यह पूर्ण TypeScript समर्थन के साथ अनुवादों को प्रबंधित करने के लिए एक सरल API प्रदान करता है। + + + - TypeScript के साथ प्रकार-सुरक्षित अनुवाद + - React और Next.js (ऐप राउटर) के लिए समर्थन + - नामस्थान-आधारित संगठन + - चर अंतर्संबंध + - हल्का और सक्षम + + +## इसका उपयोग क्यों करें? + +### प्रकार सुरक्षा + +अवैध अनुवाद कुंजी का उपयोग करने पर संकलन-समय में त्रुटियाँ प्राप्त करें: + +```typescript +const { t } = useTranslation("common"); + +t("greeting"); // ✅ वैध कुंजी +t("invalid_key"); // ❌ TypeScript त्रुटि +``` + +### सरल API + +आपकी सभी अनुवाद आवश्यकताओं के लिए दो केवल हुक: + +```typescript +// क्लाइंट घटक +const { t } = useTranslation("namespace"); + +// सर्वर घटक (Next.js) +const { t } = await getTranslation("namespace"); +``` + +### संगठित अनुवाद + +अपने अनुवादों को नामस्थान के साथ संगठित रखें: + + + + + + + + + + + + + + + + +## त्वरित उदाहरण + +```tsx +// locales/en/common.json +{ + "greeting": "Hello, {name}!" +} + +// घटक +import { useTranslation } from "@onruntime/translations/react"; + +function Welcome({ name }) { + const { t } = useTranslation("common"); + + return

{t("greeting", { name })}

; +} +``` + +## अगले कदम + + + + + diff --git a/apps/web/src/content/hi/docs/translations/installation.mdx b/apps/web/src/content/hi/docs/translations/installation.mdx new file mode 100644 index 000000000..e709b2171 --- /dev/null +++ b/apps/web/src/content/hi/docs/translations/installation.mdx @@ -0,0 +1,127 @@ +--- +title: इंस्टॉलेशन +description: '@onruntime/translations को स्थापित और कॉन्फ़िगर करें' +--- +## स्थापना + +अपने पसंदीदा पैकेज प्रबंधक का उपयोग करके पैकेज स्थापित करें: + +```bash +# npm +npm install @onruntime/translations + +# yarn +yarn add @onruntime/translations + +# pnpm +pnpm add @onruntime/translations +``` + +## प्रोजेक्ट सेटअप + +### 1. अनुवाद फ़ाइलें बनाएं + +हर भाषा के लिए अनुवाद फ़ाइलों के साथ अपने प्रोजेक्ट में एक `locales` निर्देशिका बनाएं: + + + + + + + + + + + + + + +उदाहरण `locales/en/common.json`: + +```json +{ + "title": "स्वागत है", + "greeting": "नमस्ते, {name}!", + "items": { + "one": "{count} आइटम", + "other": "{count} आइटम" + } +} +``` + +### 2. TypeScript कॉन्फ़िगर करें (वैकल्पिक) + +कृत्रिम रूप से सुरक्षित अनुवाद के लिए, एक प्रकार परिभाषा फ़ाइल बनाएं: + +```typescript +// types/translations.d.ts +import "onruntime/translations"; + +declare module "@onruntime/translations" { + interface TranslationNamespaces { + common: typeof import("../locales/en/common.json"); + auth: typeof import("../locales/en/auth.json"); + } +} +``` + +### 3. प्रदाता सेट करें + +अपने ऐप को `TranslationsProvider` के साथ लपेटें: + +```tsx +// For React +import { TranslationsProvider } from "@onruntime/translations/react"; +import en from "./locales/en"; +import fr from "./locales/fr"; + +const locales = { en, fr }; + +function App() { + return ( + + + + ); +} +``` + + + Next.js के लिए ऐप राउटर के साथ, अनुशंसित सेटअप के लिए [Next.js उपयोग](/docs/translations/nextjs) गाइड देखें. + + +## स्थापना की पुष्टि + +एक सरल घटक के साथ अपने सेटअप का परीक्षण करें: + +```tsx +import { useTranslation } from "@onruntime/translations/react"; + +function TestComponent() { + const { t } = useTranslation("common"); + + return ( +
+

{t("title")}

+

{t("greeting", { name: "विश्व" })}

+
+ ); +} +``` + +यदि आप अपने अनुवादों को दिखते हुए देखते हैं, तो आप पूरी तरह तैयार हैं! + +## अगले कदम + + + + + diff --git a/apps/web/src/content/hi/docs/translations/nextjs.mdx b/apps/web/src/content/hi/docs/translations/nextjs.mdx new file mode 100644 index 000000000..f516f46cc --- /dev/null +++ b/apps/web/src/content/hi/docs/translations/nextjs.mdx @@ -0,0 +1,191 @@ +--- +title: नेक्स्ट.जेएस उपयोग +description: नेक्स्ट.जेएस ऐप राउटर के साथ @onruntime/translations का उपयोग करना +--- +## App राउटर के लिए सेटअप + +### 1. प्रदाता कॉन्फ़िगर करें + +अनुवादों को सेट करने के लिए एक प्रदाता फ़ाइल बनाएं: + +```tsx +// app/providers.tsx +"use client"; + +import { TranslationsProvider } from "@onruntime/translations/react"; +import { ReactNode } from "react"; + +import en from "@/locales/en"; +import fr from "@/locales/fr"; + +const locales = { en, fr }; + +interface ProvidersProps { + children: ReactNode; + locale: string; +} + +export function Providers({ children, locale }: ProvidersProps) { + return ( + + {children} + + ); +} +``` + +### 2. रूट लेआउट सेट करें + +अपने रूट लेआउट में प्रदाता का उपयोग करें: + +```tsx +// app/[locale]/layout.tsx +import { Providers } from "../providers"; + +export default function LocaleLayout({ + children, + params, +}: { + children: React.ReactNode; + params: { locale: string }; +}) { + return ( + + {children} + + ); +} +``` + +## सर्वर कॉम्पोनेंट्स + +सर्वर कॉम्पोनेंट्स के लिए `getTranslation` का उपयोग करें: + +```tsx +// app/[locale]/page.tsx +import { getTranslation } from "@/lib/translations.server"; + +export default async function HomePage() { + const { t } = await getTranslation("common"); + + return ( +
+

{t("title")}

+

{t("description")}

+
+ ); +} +``` + + + सर्वर कॉम्पोनेंट्स में `getTranslation` का उपयोग करें और क्लाइंट कॉम्पोनेंट्स में `useTranslation` का उपयोग करें। + + +## क्लाइंट कॉम्पोनेंट्स + +क्लाइंट कॉम्पोनेंट्स के लिए `useTranslation` का उपयोग करें: + +```tsx +"use client"; + +import { useTranslation } from "@onruntime/translations/react"; + +export function LanguageSwitcher() { + const { locale, setLocale } = useTranslation("common"); + + return ( + + ); +} +``` + +## लोकल-आधारित रूटिंग + +### मिडलवेयर सेटअप + +लोकल डिटेक्शन को संभालने के लिए मिडलवेयर सेट करें: + +```tsx +// middleware.ts +import { NextRequest, NextResponse } from "next/server"; + +const locales = ["en", "fr"]; +const defaultLocale = "en"; + +export function middleware(request: NextRequest) { + const pathname = request.nextUrl.pathname; + + // चेक करें कि क्या pathname में एक लोकल है + const pathnameHasLocale = locales.some( + (locale) => pathname.startsWith(`/${locale}/`) || pathname === `/${locale}` + ); + + if (pathnameHasLocale) return; + + // डिफ़ॉल्ट लोकल पर रीडायरेक्ट करें + return NextResponse.redirect( + new URL(`/${defaultLocale}${pathname}`, request.url) + ); +} + +export const config = { + matcher: ["/((?!api|_next|.*\\..*).*)"], +}; +``` + +## स्टैटिक जेनरेशन + +सभी लोकल के लिए स्टैटिक पेज जनरेट करें: + +```tsx +// app/[locale]/page.tsx +export async function generateStaticParams() { + return [{ locale: "en" }, { locale: "fr" }]; +} +``` + +## लिंक कॉम्पोनेंट + +नेविगेशन के लिए अनुवादित लिंक कॉम्पोनेंट का उपयोग करें: + +```tsx +import { Link } from "@onruntime/translations/next"; + +function Navigation() { + return ( + + ); +} +``` + +`Link` कॉम्पोनेंट स्वत: लोकल प्रीफिक्सिंग का प्रबंधन करता है। + +## उदाहरण प्रोजेक्ट संरचना + + + + + + + + + + + + + + + + + + + + + + diff --git a/apps/web/src/content/hi/docs/translations/react.mdx b/apps/web/src/content/hi/docs/translations/react.mdx new file mode 100644 index 000000000..663771005 --- /dev/null +++ b/apps/web/src/content/hi/docs/translations/react.mdx @@ -0,0 +1,157 @@ +--- +title: रेएक्ट उपयोग +description: React अनुप्रयोगों में @onruntime/translations का उपयोग करना +--- +## बेसिक उपयोग + +### useTranslation हुक + +`useTranslation` हुक आपके React कंपोनेंट्स में अनुवादों तक पहुंचने का प्रमुख तरीका है: + +```tsx +import { useTranslation } from "@onruntime/translations/react"; + +function MyComponent() { + const { t, locale } = useTranslation("common"); + + return ( +
+

वर्तमान स्थानीय भाषा: {locale}

+

{t("title")}

+
+ ); +} +``` + +### वेरिएबल इंटरपोलेशन + +अपने अनुवादों में वेरिएबल पास करें: + +```json +// locales/en/common.json +{ + "greeting": "नमस्ते, {name}!", + "items_count": "आपके पास {count} आइटम हैं" +} +``` + +```tsx +function Greeting({ name, itemCount }) { + const { t } = useTranslation("common"); + + return ( + <> +

{t("greeting", { name })}

+

{t("items_count", { count: itemCount })}

+ + ); +} +``` + +## कई नेमस्पेस + +आप एक ही कंपोनेंट में कई नेमस्पेस का उपयोग कर सकते हैं: + +```tsx +function Dashboard() { + const { t: tCommon } = useTranslation("common"); + const { t: tDashboard } = useTranslation("dashboard"); + + return ( +
+

{tDashboard("title")}

+ +
+ ); +} +``` + +## स्थानीय भाषा बदलना + +वर्तमान स्थानीय भाषा बदलने के लिए `setLocale` फ़ंक्शन का उपयोग करें: + +```tsx +import { useTranslation } from "@onruntime/translations/react"; + +function LanguageSwitcher() { + const { locale, setLocale } = useTranslation("common"); + + return ( + + ); +} +``` + +## नेस्टेड कीज़ + +डॉट नोटेशन का उपयोग करके नेस्टेड ट्रांसलेशन कीज़ तक पहुंचें: + +```json +// locales/en/common.json +{ + "nav": { + "home": "होम", + "about": "हमारे बारे में", + "contact": "संपर्क करें" + } +} +``` + +```tsx +function Navigation() { + const { t } = useTranslation("common"); + + return ( + + ); +} +``` + +## बेस्ट प्रैक्टिसेज + + + सब कुछ एक फ़ाइल में रखने के बजाय अनुवादों को विशेषता या पृष्ठ के अनुसार व्यवस्थित करें। + + +### अनुशंसित संरचना + + + + + + + + + + + + +### कुंजी को स्थिर रखें + +सभी भाषाओं में लगातार नामकरण प्रथाओं का उपयोग करें: + +```json +// ✅ अच्छा - स्थिर संरचना +{ + "page_title": "डैशबोर्ड", + "actions": { + "save": "सहेजें", + "cancel": "रद्द करें" + } +} + +// ❌ बचें - असंगत +{ + "pageTitle": "डैशबोर्ड", + "save_button": "सहेजें", + "cancelBtn": "रद्द करें" +} +``` diff --git a/apps/web/src/content/it/docs/gitmoji/emojis.mdx b/apps/web/src/content/it/docs/gitmoji/emojis.mdx new file mode 100644 index 000000000..3f4c1c728 --- /dev/null +++ b/apps/web/src/content/it/docs/gitmoji/emojis.mdx @@ -0,0 +1,11 @@ +--- +title: Riferimento Emoji +description: Elenco completo di gitmoji +--- +Usiamo [gitmoji](https://gitmoji.dev) per categorizzare i nostri commit. Ecco l'elenco completo delle emoji, il loro codice e la descrizione: + + + + + Usa il [gitmoji-cli](https://github.com/carloscuesta/gitmoji-cli) o l'[estensione per VS Code](https://marketplace.visualstudio.com/items?itemName=seatonjiang.gitmoji-vscode) per un'esperienza di commit interattiva. + diff --git a/apps/web/src/content/it/docs/gitmoji/getting-started.mdx b/apps/web/src/content/it/docs/gitmoji/getting-started.mdx new file mode 100644 index 000000000..fb77e7c2d --- /dev/null +++ b/apps/web/src/content/it/docs/gitmoji/getting-started.mdx @@ -0,0 +1,91 @@ +--- +title: Iniziare +description: Scopri la nostra convenzione di commit +--- +Ci piace avere una cronologia del progetto pulita. La nostra convenzione sui commit è ispirata ai [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0) ma personalizzata con [gitmoji](https://gitmoji.dev) per renderla più visiva e divertente. + +## Struttura + +Il messaggio del commit dovrebbe essere strutturato come segue e **in minuscolo**: + +``` + [(#)] + +[corpo facoltativo] + +[footer(e) facoltativi] +``` + +### Esempio + +```bash +📝 aggiorna i contributori della documentazione + +- Aggiungi @jerembdn come contributore +- Aggiungi @younesbessa come contributore + +Co-autore: Younes Bessa +``` + +La maggior parte delle volte, una semplice riga è sufficiente: + +```bash +📝 aggiorna i contributori della documentazione +``` + +## Tipi + +Utilizziamo i seguenti tipi di commit: + +| Tipo | Descrizione | +| --- | --- | +| `add` | Aggiungi una nuova funzionalità | +| `fix` | Risolvi un bug | +| `improve` | Migliora qualcosa | +| `update` | Aggiorna qualcosa | +| `remove` | Rimuovi qualcosa | +| `refactor` | Rifattorizza qualcosa | +| `rename` | Rinomina qualcosa | +| `move` | Sposta un file o una cartella | +| `upgrade` | Aggiorna le dipendenze | +| `downgrade` | Downgrada le dipendenze | + +## Descrizione + +Scrivi le descrizioni in **modo imperativo** e **in minuscolo**: + +```bash +# Buono +📝 aggiorna i contributori della documentazione + +# Cattivo +📝 aggiornato i contributori della documentazione + +# Cattivo +📝 Aggiorna i contributori della documentazione +``` + +## Numero dell'Issue + +Collega i commit alle issue aggiungendo il numero dell'issue: + +```bash +📝 aggiorna i contributori della documentazione (#123) +``` + +## Corpo + +Usa il corpo per contesto e motivazione: + +```bash +📝 aggiorna i contributori della documentazione + +- Aggiungi @jerembdn come contributore +- Aggiungi @younesbessa come contributore + +Co-autore: Younes Bessa +``` + + + Ogni commit dovrebbe rappresentare un singolo cambiamento logico. Non mescolare cambiamenti non correlati. + diff --git a/apps/web/src/content/it/docs/gitmoji/with-ai.mdx b/apps/web/src/content/it/docs/gitmoji/with-ai.mdx new file mode 100644 index 000000000..151aae522 --- /dev/null +++ b/apps/web/src/content/it/docs/gitmoji/with-ai.mdx @@ -0,0 +1,63 @@ +--- +title: Con l'AI +description: Usa gitmoji con Claude Code +--- +Installa il nostro plugin gitmoji per [Claude Code](https://claude.ai/code) per generare commit seguendo la convenzione. + +## Installa il Plugin + +Aggiungi il marketplace di onRuntime e installa il plugin: + +```bash +# Aggiungi il marketplace di onRuntime +/plugin marketplace add https://onruntime.com/plugins + +# Installa il plugin gitmoji +/plugin install gitmoji@onruntime +``` + +Oppure installa direttamente dal menu: + +1. Esegui `/plugin` in Claude Code +2. Vai alla scheda **Discover** +3. Aggiungi il marketplace: `https://onruntime.com/plugins` +4. Cerca "gitmoji" e installa + +## Utilizzo + +Esegui il comando `/commit` per creare un commit: + +``` +/commit +``` + +``` +/commit fix the login bug +``` + +Claude Code analizzerà le tue modifiche e creerà un commit seguendo la convenzione gitmoji. + + + Il comando `/commit` recupera automaticamente il tuo stato git e il diff per generare il messaggio di commit appropriato. + + +## Alternativa: CLAUDE.md + +Se preferisci non installare il plugin, aggiungi questo al `CLAUDE.md` del tuo progetto: + +```markdown +## Convenzione Commit + +Usa i commit convenzionali gitmoji: + +\`\`\` + +\`\`\` + +Tipi: add, fix, improve, update, remove, refactor, rename, move, upgrade, downgrade + +Regole: +- Scrivi in minuscolo +- Usa il modo imperativo ("add" non "added") +- Una modifica logica per commit +``` diff --git a/apps/web/src/content/it/docs/next-sitemap/api.mdx b/apps/web/src/content/it/docs/next-sitemap/api.mdx new file mode 100644 index 000000000..68bdbfd93 --- /dev/null +++ b/apps/web/src/content/it/docs/next-sitemap/api.mdx @@ -0,0 +1,169 @@ +--- +title: Riferimento API +description: Documentazione completa dell'API per @onruntime/next-sitemap +--- +## generateSitemap + +Genera una mappa del sito per la tua applicazione Next.js. + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +const sitemap = await generateSitemap(options); +``` + +### Options + +| Opzione | Tipo | Richiesta | Descrizione | +|---------|------|-----------|-------------| +| `baseUrl` | `string` | Sì | L'URL di base del tuo sito | +| `additionalPaths` | `SitemapEntry[]` | No | URL aggiuntivi da includere | +| `exclude` | `string[]` | No | Modelli glob da escludere | +| `defaults` | `SitemapDefaults` | No | Valori predefiniti per tutte le voci | +| `locales` | `string[]` | No | Localizzazioni supportate | +| `defaultLocale` | `string` | No | Localizzazione predefinita | + +### SitemapEntry + +| Proprietà | Tipo | Descrizione | +|-----------|------|-------------| +| `url` | `string` | URL della pagina (relativo o assoluto) | +| `lastModified` | `Date \| string` | Data dell'ultima modifica | +| `changeFrequency` | `ChangeFrequency` | Quanto spesso cambia la pagina | +| `priority` | `number` | Priorità (0.0 - 1.0) | + +### ChangeFrequency + +```tsx +type ChangeFrequency = + | "always" + | "hourly" + | "daily" + | "weekly" + | "monthly" + | "yearly" + | "never"; +``` + +### Example + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + const blogPosts = await fetchPosts(); + + return generateSitemap({ + baseUrl: "https://example.com", + defaults: { + changeFrequency: "weekly", + priority: 0.7, + }, + additionalPaths: blogPosts.map((post) => ({ + url: `/blog/${post.slug}`, + lastModified: post.updatedAt, + priority: 0.8, + })), + exclude: ["/admin/*", "/api/*"], + }); +} +``` + +## generateRobots + +Genera un file robots.txt. + +```tsx +import { generateRobots } from "@onruntime/next-sitemap/app"; + +const robots = generateRobots(options); +``` + +### Options + +| Opzione | Tipo | Richiesta | Descrizione | +|---------|------|-----------|-------------| +| `baseUrl` | `string` | Sì | L'URL di base del tuo sito | +| `rules` | `RobotsRule[]` | No | Regole robot personalizzate | +| `sitemap` | `string \| boolean` | No | URL della mappa del sito o `false` per escludere | + +### RobotsRule + +| Proprietà | Tipo | Descrizione | +|-----------|------|-------------| +| `userAgent` | `string` | User agent target | +| `allow` | `string \| string[]` | Percorsi consentiti | +| `disallow` | `string \| string[]` | Percorsi non consentiti | +| `crawlDelay` | `number` | Ritardo di scansione in secondi | + +### Example + +```tsx +import { generateRobots } from "@onruntime/next-sitemap/app"; + +export default function robots() { + return generateRobots({ + baseUrl: "https://example.com", + rules: [ + { + userAgent: "*", + allow: "/", + disallow: ["/admin/", "/private/"], + }, + { + userAgent: "Googlebot", + allow: "/", + crawlDelay: 1, + }, + ], + }); +} +``` + +## generateSitemapIndex + +Genera un indice della mappa del sito per siti di grandi dimensioni. + +```tsx +import { generateSitemapIndex } from "@onruntime/next-sitemap/app"; + +const index = await generateSitemapIndex(options); +``` + +### Options + +| Opzione | Tipo | Richiesta | Descrizione | +|---------|------|-----------|-------------| +| `baseUrl` | `string` | Sì | L'URL di base del tuo sito | +| `sitemapsPerFile` | `number` | No | URL per mappa del sito (predefinito: 5000) | + +### Example + +```tsx +import { generateSitemapIndex } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemapIndex({ + baseUrl: "https://example.com", + sitemapsPerFile: 10000, + }); +} +``` + +## Type Exports + +Il pacchetto esporta tipi TypeScript per comodità: + +```tsx +import type { + SitemapEntry, + SitemapOptions, + RobotsOptions, + RobotsRule, + ChangeFrequency, +} from "@onruntime/next-sitemap"; +``` + + + Tutte le funzioni e opzioni sono completamente tipizzate. Il tuo IDE fornirà completamento automatico e controllo dei tipi. + diff --git a/apps/web/src/content/it/docs/next-sitemap/configuration.mdx b/apps/web/src/content/it/docs/next-sitemap/configuration.mdx new file mode 100644 index 000000000..71289a368 --- /dev/null +++ b/apps/web/src/content/it/docs/next-sitemap/configuration.mdx @@ -0,0 +1,176 @@ +--- +title: Configurazione +description: Configura @onruntime/next-sitemap per le tue esigenze +--- +## Configurazione di Base + +La configurazione più semplice richiede solo il tuo URL di base: + +```tsx +// app/sitemap.ts +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + }); +} +``` + +## Configurazione Avanzata + +### Percorsi Personalizzati + +Aggiungi percorsi personalizzati o contenuti dinamici: + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + // Recupera contenuti dinamici + const posts = await fetchBlogPosts(); + + return generateSitemap({ + baseUrl: "https://example.com", + additionalPaths: posts.map((post) => ({ + url: `/blog/${post.slug}`, + lastModified: post.updatedAt, + changeFrequency: "weekly", + priority: 0.7, + })), + }); +} +``` + +### Esclusione dei Percorsi + +Escludi percorsi specifici dalla mappa del sito: + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + exclude: [ + "/admin/*", + "/api/*", + "/private/*", + ], + }); +} +``` + +### Priorità e Frequenza di Cambio + +Imposta valori predefiniti per tutte le pagine: + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + defaults: { + changeFrequency: "weekly", + priority: 0.7, + }, + }); +} +``` + +## Configurazione di robots.txt + +### robots.txt di Base + +```tsx +// app/robots.ts +import { generateRobots } from "@onruntime/next-sitemap/app"; + +export default function robots() { + return generateRobots({ + baseUrl: "https://example.com", + }); +} +``` + +### Regole Personalizzate + +```tsx +import { generateRobots } from "@onruntime/next-sitemap/app"; + +export default function robots() { + return generateRobots({ + baseUrl: "https://example.com", + rules: [ + { + userAgent: "*", + allow: "/", + disallow: ["/admin/", "/private/"], + }, + { + userAgent: "Googlebot", + allow: "/", + }, + ], + }); +} +``` + +## Internazionalizzazione + +### Sitemap Multilingue + +Supporta più lingue con alternative: + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +const locales = ["en", "fr", "de"]; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + locales, + defaultLocale: "en", + }); +} +``` + +Questo genera URL con alternative `hreflang`: + +```xml + + https://example.com/en/about + + + + +``` + +## Sitemap Divise + +Per siti grandi, dividi la tua mappa del sito in più file: + +```tsx +// app/sitemap/[id]/route.ts +import { generateSitemapIndex } from "@onruntime/next-sitemap/app"; + +export async function GET( + request: Request, + { params }: { params: { id: string } } +) { + const sitemaps = await generateSitemapIndex({ + baseUrl: "https://example.com", + sitemapsPerFile: 5000, + }); + + return new Response(sitemaps[parseInt(params.id)], { + headers: { "Content-Type": "application/xml" }, + }); +} +``` + + + Google consiglia di mantenere le sitemap sotto i 50MB e 50.000 URL. Usa sitemap divise per siti più grandi. + diff --git a/apps/web/src/content/it/docs/next-sitemap/getting-started.mdx b/apps/web/src/content/it/docs/next-sitemap/getting-started.mdx new file mode 100644 index 000000000..8e7d8d447 --- /dev/null +++ b/apps/web/src/content/it/docs/next-sitemap/getting-started.mdx @@ -0,0 +1,86 @@ +--- +title: Iniziare +description: Un generatore di sitemap per applicazioni Next.js +--- +## Cos'è @onruntime/next-sitemap? + +`@onruntime/next-sitemap` è un potente generatore di sitemap progettato specificamente per le applicazioni Next.js. Genera automaticamente i file `sitemap.xml` e `robots.txt` per il tuo sito Next.js. + + + - Generazione automatica della sitemap per App Router + - Supporto per percorsi dinamici + - Priorità e changefreq configurabili + - Generazione di robots.txt + - Supporto per sitemap multilingue + + +## Perché Usarlo? + +### Ottimizzazione SEO + +Le sitemap aiutano i motori di ricerca a scoprire e indicizzare le tue pagine in modo più efficiente: + +- **Indicizzazione più veloce** - I motori di ricerca possono trovare tutte le tue pagine +- **Migliore crawling** - Informa i crawler sugli aggiornamenti delle pagine +- **Suggerimenti sulla priorità** - Guida i crawler verso le pagine importanti + +### Integrazione con Next.js + +Costruito specificamente per Next.js, capisce: + +- Struttura dell'App Router +- Percorsi dinamici +- Generazione statica +- Routing internazionalizzato + +## Esempio Veloce + +```tsx +// app/sitemap.ts +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + }); +} +``` + +Questo genera una sitemap completa che include tutte le tue pagine statiche e dinamiche. + +## Output Generato + +Il pacchetto genera sitemap XML standard: + +```xml + + + + https://example.com/ + 2024-01-15 + daily + 1.0 + + + https://example.com/about + 2024-01-10 + monthly + 0.8 + + +``` + +## Passi Successivi + + + + + diff --git a/apps/web/src/content/it/docs/next-sitemap/installation.mdx b/apps/web/src/content/it/docs/next-sitemap/installation.mdx new file mode 100644 index 000000000..caf42a373 --- /dev/null +++ b/apps/web/src/content/it/docs/next-sitemap/installation.mdx @@ -0,0 +1,121 @@ +--- +title: Installazione +description: Installa e configura @onruntime/next-sitemap +--- +## Installazione + +Installa il pacchetto usando il tuo gestore di pacchetti preferito: + +```bash +# npm +npm install @onruntime/next-sitemap + +# yarn +yarn add @onruntime/next-sitemap + +# pnpm +pnpm add @onruntime/next-sitemap +``` + +## Configurazione di base + +### App Router (Next.js 13+) + +Crea un file `sitemap.ts` nella tua directory `app`: + +```tsx +// app/sitemap.ts +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://tuo-dominio.com", + }); +} +``` + +### robots.txt + +Crea un file `robots.ts` per la generazione di robots.txt: + +```tsx +// app/robots.ts +import { generateRobots } from "@onruntime/next-sitemap/app"; + +export default function robots() { + return generateRobots({ + baseUrl: "https://tuo-dominio.com", + }); +} +``` + +## Struttura del Progetto + +Dopo la configurazione, il tuo progetto dovrebbe apparire così: + + + + + + + + + + + + + + + + + + +## Verifica Installazione + +Avvia il tuo server di sviluppo e visita: + +- `http://localhost:3000/sitemap.xml` - Il tuo sitemap +- `http://localhost:3000/robots.txt` - Il tuo robots.txt + +Dovresti vedere XML generato per il tuo sitemap e contenuto testuale per robots.txt. + + + Il sitemap includerà tutte le route scoperte durante il build. In sviluppo, riflette la tua attuale struttura delle route. + + +## Variabili d'Ambiente + +Per la produzione, imposta il tuo URL di base: + +```env +# .env.production +NEXT_PUBLIC_SITE_URL=https://tuo-dominio.com +``` + +Poi usalo nella tua configurazione: + +```tsx +// app/sitemap.ts +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: process.env.NEXT_PUBLIC_SITE_URL || "https://tuo-dominio.com", + }); +} +``` + +## Prossimi Passi + + + + + diff --git a/apps/web/src/content/it/docs/translations/api.mdx b/apps/web/src/content/it/docs/translations/api.mdx new file mode 100644 index 000000000..b6fe04397 --- /dev/null +++ b/apps/web/src/content/it/docs/translations/api.mdx @@ -0,0 +1,194 @@ +--- +title: Riferimento API +description: Documentazione completa dell'API per @onruntime/translations +--- +## TranslationsProvider + +Il componente provider che avvolge la tua applicazione. + +```tsx +import { TranslationsProvider } from "@onruntime/translations/react"; + + + {children} + +``` + +### Props + +| Prop | Tipo | Richiesto | Descrizione | +|------|------|----------|-------------| +| `locale` | `string` | Sì | Locale attivo corrente | +| `locales` | `Record` | Sì | Oggetto che contiene tutte le traduzioni per locale | +| `fallbackLocale` | `string` | No | Locale di fallback quando la chiave è mancante | +| `children` | `ReactNode` | Sì | Componenti figli | + +## useTranslation + +Hook per accedere alle traduzioni nei componenti client. + +```tsx +const { t, locale, setLocale } = useTranslation("namespace"); +``` + +### Parametri + +| Parametro | Tipo | Richiesto | Descrizione | +|-----------|------|----------|-------------| +| `namespace` | `string` | Sì | Namespace di traduzione da usare | + +### Ritorna + +| Proprietà | Tipo | Descrizione | +|----------|------|-------------| +| `t` | `(key: string, vars?: object) => string` | Funzione di traduzione | +| `locale` | `string` | Locale corrente | +| `setLocale` | `(locale: string) => void` | Funzione per cambiare locale | + +### Esempio + +```tsx +const { t, locale, setLocale } = useTranslation("common"); + +// Utilizzo base +t("greeting"); // "Ciao" + +// Con variabili +t("greeting_name", { name: "John" }); // "Ciao, John!" + +// Chiavi annidate +t("nav.home"); // "Home" + +// Cambia locale +setLocale("fr"); +``` + +## getTranslation + +Funzione asincrona per accedere alle traduzioni nei componenti server (Next.js). + +```tsx +const { t } = await getTranslation("namespace"); +``` + +### Parametri + +| Parametro | Tipo | Richiesto | Descrizione | +|-----------|------|----------|-------------| +| `namespace` | `string` | Sì | Namespace di traduzione da usare | + +### Ritorna + +| Proprietà | Tipo | Descrizione | +|----------|------|-------------| +| `t` | `(key: string, vars?: object) => string` | Funzione di traduzione | +| `locale` | `string` | Locale corrente | + +### Esempio + +```tsx +// Componente Server +export default async function Page() { + const { t } = await getTranslation("common"); + + return

{t("title")}

; +} +``` + +## Link Component + +Componente Link consapevole del locale per Next.js. + +```tsx +import { Link } from "@onruntime/translations/next"; + +About +``` + +### Props + +Tutti i props del componente `Link` di Next.js, più: + +| Prop | Tipo | Predefinito | Descrizione | +|------|------|---------|-------------| +| `locale` | `string` | Locale corrente | Override del locale del link | + +### Esempio + +```tsx +// Usa il locale corrente +About + +// Forza un locale specifico +À propos +``` + +## Translation Function (t) + +La funzione `t` è usata per recuperare stringhe tradotte. + +### Firma + +```tsx +t(key: string, variables?: Record): string +``` + +### Parametri + +| Parametro | Tipo | Descrizione | +|-----------|------|-------------| +| `key` | `string` | Chiave di traduzione (supporta notazione a punto) | +| `variables` | `object` | Variabili da interpolare | + +### Interpolazione di variabili + +```json +{ + "greeting": "Ciao, {name}!", + "items": "Hai {count} articoli" +} +``` + +```tsx +t("greeting", { name: "Alice" }); // "Ciao, Alice!" +t("items", { count: 5 }); // "Hai 5 articoli" +``` + +### Chiavi annidate + +```json +{ + "user": { + "profile": { + "title": "Profilo" + } + } +} +``` + +```tsx +t("user.profile.title"); // "Profilo" +``` + +## Type Definitions + +### TranslationNamespaces + +Estendi questa interfaccia per traduzioni sicure nel tipo: + +```tsx +declare module "@onruntime/translations" { + interface TranslationNamespaces { + common: typeof import("./locales/en/common.json"); + auth: typeof import("./locales/en/auth.json"); + } +} +``` + + + Con le definizioni di tipo corrette, avrai autocompletamento per le chiavi di traduzione e errori di compilazione per chiavi non valide. + diff --git a/apps/web/src/content/it/docs/translations/getting-started.mdx b/apps/web/src/content/it/docs/translations/getting-started.mdx new file mode 100644 index 000000000..f6771fc2d --- /dev/null +++ b/apps/web/src/content/it/docs/translations/getting-started.mdx @@ -0,0 +1,94 @@ +--- +title: Iniziare +description: >- + Una libreria di internazionalizzazione leggera e sicura per il tipo per React + e Next.js +--- +## Cos'è @onruntime/translations? + +`@onruntime/translations` è una libreria di internazionalizzazione (i18n) leggera e tipizzata progettata per applicazioni React e Next.js. Fornisce una semplice API per gestire le traduzioni con supporto completo per TypeScript. + + + - Traduzioni tipizzate con TypeScript + - Supporto per React e Next.js (App Router) + - Organizzazione basata su namespace + - Interpolazione di variabili + - Leggera e performante + + +## Perché Usarla? + +### Sicurezza dei Tipi + +Ricevi errori di compilazione quando usi chiavi di traduzione non valide: + +```typescript +const { t } = useTranslation("common"); + +t("greeting"); // ✅ Chiave valida +t("invalid_key"); // ❌ Errore TypeScript +``` + +### API Semplice + +Solo due hook per tutte le tue necessità di traduzione: + +```typescript +// Client Components +const { t } = useTranslation("namespace"); + +// Server Components (Next.js) +const { t } = await getTranslation("namespace"); +``` + +### Traduzioni Organizzate + +Tieni le tue traduzioni organizzate con i namespace: + + + + + + + + + + + + + + + + +## Esempio Veloce + +```tsx +// locales/en/common.json +{ + "greeting": "Ciao, {name}!" +} + +// Component +import { useTranslation } from "@onruntime/translations/react"; + +function Welcome({ name }) { + const { t } = useTranslation("common"); + + return

{t("greeting", { name })}

; +} +``` + +## Passi Successivi + + + + + diff --git a/apps/web/src/content/it/docs/translations/installation.mdx b/apps/web/src/content/it/docs/translations/installation.mdx new file mode 100644 index 000000000..efb7153c3 --- /dev/null +++ b/apps/web/src/content/it/docs/translations/installation.mdx @@ -0,0 +1,127 @@ +--- +title: Installazione +description: Installa e configura @onruntime/translations +--- +## Installazione + +Installa il pacchetto usando il tuo gestore di pacchetti preferito: + +```bash +# npm +npm install @onruntime/translations + +# yarn +yarn add @onruntime/translations + +# pnpm +pnpm add @onruntime/translations +``` + +## Impostazione del Progetto + +### 1. Crea i File di Traduzione + +Crea una directory `locales` nel tuo progetto con i file di traduzione per ogni lingua: + + + + + + + + + + + + + + +Esempio `locales/en/common.json`: + +```json +{ + "title": "Benvenuto", + "greeting": "Ciao, {name}!", + "items": { + "one": "{count} elemento", + "other": "{count} elementi" + } +} +``` + +### 2. Configura TypeScript (Opzionale) + +Per traduzioni sicure per i tipi, crea un file di definizione dei tipi: + +```typescript +// types/translations.d.ts +import "onruntime/translations"; + +declare module "@onruntime/translations" { + interface TranslationNamespaces { + common: typeof import("../locales/en/common.json"); + auth: typeof import("../locales/en/auth.json"); + } +} +``` + +### 3. Imposta il Provider + +Avvolgi la tua app con il `TranslationsProvider`: + +```tsx +// Per React +import { TranslationsProvider } from "@onruntime/translations/react"; +import en from "./locales/en"; +import fr from "./locales/fr"; + +const locales = { en, fr }; + +function App() { + return ( + + + + ); +} +``` + + + Per Next.js con App Router, controlla la guida [Next.js Usage](/docs/translations/nextjs) per la configurazione raccomandata. + + +## Verifica dell'Installazione + +Metti alla prova la tua configurazione con un componente semplice: + +```tsx +import { useTranslation } from "@onruntime/translations/react"; + +function TestComponent() { + const { t } = useTranslation("common"); + + return ( +
+

{t("title")}

+

{t("greeting", { name: "World" })}

+
+ ); +} +``` + +Se vedi le tue traduzioni visualizzate, sei a posto! + +## Prossimi Passi + + + + + diff --git a/apps/web/src/content/it/docs/translations/nextjs.mdx b/apps/web/src/content/it/docs/translations/nextjs.mdx new file mode 100644 index 000000000..600e66794 --- /dev/null +++ b/apps/web/src/content/it/docs/translations/nextjs.mdx @@ -0,0 +1,191 @@ +--- +title: Uso di Next.js +description: Usando @onruntime/translations con il router dell'app di Next.js +--- +## Configurazione per l'App Router + +### 1. Configura il Provider + +Crea un file provider per impostare le traduzioni: + +```tsx +// app/providers.tsx +"use client"; + +import { TranslationsProvider } from "@onruntime/translations/react"; +import { ReactNode } from "react"; + +import en from "@/locales/en"; +import fr from "@/locales/fr"; + +const locales = { en, fr }; + +interface ProvidersProps { + children: ReactNode; + locale: string; +} + +export function Providers({ children, locale }: ProvidersProps) { + return ( + + {children} + + ); +} +``` + +### 2. Imposta il Layout Radice + +Usa il provider nel tuo layout radice: + +```tsx +// app/[locale]/layout.tsx +import { Providers } from "../providers"; + +export default function LocaleLayout({ + children, + params, +}: { + children: React.ReactNode; + params: { locale: string }; +}) { + return ( + + {children} + + ); +} +``` + +## Componenti Server + +Usa `getTranslation` per i Componenti Server: + +```tsx +// app/[locale]/page.tsx +import { getTranslation } from "@/lib/translations.server"; + +export default async function HomePage() { + const { t } = await getTranslation("common"); + + return ( +
+

{t("title")}

+

{t("description")}

+
+ ); +} +``` + + + Usa `getTranslation` nei Componenti Server e `useTranslation` nei Componenti Client. + + +## Componenti Client + +Usa `useTranslation` per i Componenti Client: + +```tsx +"use client"; + +import { useTranslation } from "@onruntime/translations/react"; + +export function LanguageSwitcher() { + const { locale, setLocale } = useTranslation("common"); + + return ( + + ); +} +``` + +## Routing Basato sulla Locale + +### Configurazione Middleware + +Configura il middleware per gestire il rilevamento della locale: + +```tsx +// middleware.ts +import { NextRequest, NextResponse } from "next/server"; + +const locales = ["en", "fr"]; +const defaultLocale = "en"; + +export function middleware(request: NextRequest) { + const pathname = request.nextUrl.pathname; + + // Controlla se il pathname ha una locale + const pathnameHasLocale = locales.some( + (locale) => pathname.startsWith(`/${locale}/`) || pathname === `/${locale}` + ); + + if (pathnameHasLocale) return; + + // Redirect alla locale predefinita + return NextResponse.redirect( + new URL(`/${defaultLocale}${pathname}`, request.url) + ); +} + +export const config = { + matcher: ["/((?!api|_next|.*\\..*).*)"], +}; +``` + +## Generazione Statica + +Genera pagine statiche per tutte le localizzazioni: + +```tsx +// app/[locale]/page.tsx +export async function generateStaticParams() { + return [{ locale: "en" }, { locale: "fr" }]; +} +``` + +## Componente Link + +Usa il componente Link tradotto per la navigazione: + +```tsx +import { Link } from "@onruntime/translations/next"; + +function Navigation() { + return ( + + ); +} +``` + +Il componente `Link` gestisce automaticamente il prefisso della locale. + +## Struttura del Progetto Esempio + + + + + + + + + + + + + + + + + + + + + + diff --git a/apps/web/src/content/it/docs/translations/react.mdx b/apps/web/src/content/it/docs/translations/react.mdx new file mode 100644 index 000000000..5b1d769e7 --- /dev/null +++ b/apps/web/src/content/it/docs/translations/react.mdx @@ -0,0 +1,157 @@ +--- +title: Utilizzo di React +description: Utilizzare @onruntime/translations nelle applicazioni React +--- +## Utilizzo di Base + +### Il Hook useTranslation + +Il hook `useTranslation` è il tuo modo principale per accedere alle traduzioni nei componenti React: + +```tsx +import { useTranslation } from "@onruntime/translations/react"; + +function MyComponent() { + const { t, locale } = useTranslation("common"); + + return ( +
+

Locale attuale: {locale}

+

{t("title")}

+
+ ); +} +``` + +### Interpolazione delle Variabili + +Passa variabili alle tue traduzioni: + +```json +// locales/en/common.json +{ + "greeting": "Ciao, {name}!", + "items_count": "Hai {count} oggetti" +} +``` + +```tsx +function Greeting({ name, itemCount }) { + const { t } = useTranslation("common"); + + return ( + <> +

{t("greeting", { name })}

+

{t("items_count", { count: itemCount })}

+ + ); +} +``` + +## Nomi di Spazi Multipli + +Puoi usare più nomi di spazi nello stesso componente: + +```tsx +function Dashboard() { + const { t: tCommon } = useTranslation("common"); + const { t: tDashboard } = useTranslation("dashboard"); + + return ( +
+

{tDashboard("title")}

+ +
+ ); +} +``` + +## Cambiare Lingua + +Usa la funzione `setLocale` per cambiare la lingua attuale: + +```tsx +import { useTranslation } from "@onruntime/translations/react"; + +function LanguageSwitcher() { + const { locale, setLocale } = useTranslation("common"); + + return ( + + ); +} +``` + +## Chiavi Annidate + +Accedi alle chiavi di traduzione annidate usando la notazione a punto: + +```json +// locales/en/common.json +{ + "nav": { + "home": "Home", + "about": "About", + "contact": "Contact" + } +} +``` + +```tsx +function Navigation() { + const { t } = useTranslation("common"); + + return ( + + ); +} +``` + +## Migliori Pratiche + + + Organizza le traduzioni per caratteristica o pagina piuttosto che mettere tutto in un solo file. + + +### Struttura Raccomandata + + + + + + + + + + + + +### Mantieni le Chiavi Consistenti + +Usa convenzioni di denominazione coerenti tra tutte le lingue: + +```json +// ✅ Buono - struttura coerente +{ + "page_title": "Dashboard", + "actions": { + "save": "Salva", + "cancel": "Annulla" + } +} + +// ❌ Evita - incoerente +{ + "pageTitle": "Dashboard", + "save_button": "Salva", + "cancelBtn": "Annulla" +} +``` diff --git a/apps/web/src/content/ja/docs/gitmoji/emojis.mdx b/apps/web/src/content/ja/docs/gitmoji/emojis.mdx new file mode 100644 index 000000000..935c5341a --- /dev/null +++ b/apps/web/src/content/ja/docs/gitmoji/emojis.mdx @@ -0,0 +1,11 @@ +--- +title: 絵文字リファレンス +description: gitmojiの完全リスト +--- +私たちは[gitmoji](https://gitmoji.dev)を使ってコミットをカテゴリー分けしています。絵文字の完全なリスト、コード、説明は次のとおりです: + + + + + インタラクティブなコミット体験のために、[gitmoji-cli](https://github.com/carloscuesta/gitmoji-cli)や[VS Code拡張機能](https://marketplace.visualstudio.com/items?itemName=seatonjiang.gitmoji-vscode)を使ってみてね。 + diff --git a/apps/web/src/content/ja/docs/gitmoji/getting-started.mdx b/apps/web/src/content/ja/docs/gitmoji/getting-started.mdx new file mode 100644 index 000000000..e29f4e5ce --- /dev/null +++ b/apps/web/src/content/ja/docs/gitmoji/getting-started.mdx @@ -0,0 +1,91 @@ +--- +title: 始める +description: 私たちのコミットのルールを学ぼう +--- +私たちはクリーンなプロジェクトの履歴を大切にしています。私たちのコミットの規則は、[Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0) に触発されていますが、より視覚的で楽しいものにするために [gitmoji](https://gitmoji.dev) でカスタマイズされています。 + +## 構造 + +コミットメッセージは以下のように構成され、**小文字**であるべきです: + +``` + [(#)] + +[optional body] + +[optional footer(s)] +``` + +### 例 + +```bash +📝 update documentation contributors + +- @jerembdn をコントリビューターとして追加 +- @younesbessa をコントリビューターとして追加 + +Co-authored-by: Younes Bessa +``` + +ほとんどの場合、シンプルなワンライナーで足ります: + +```bash +📝 update documentation contributors +``` + +## タイプ + +私たちは以下のコミットタイプを使用します: + +| タイプ | 説明 | +| --- | --- | +| `add` | 新機能を追加 | +| `fix` | バグを修正 | +| `improve` | 何かを改善 | +| `update` | 何かを更新 | +| `remove` | 何かを削除 | +| `refactor` | 何かをリファクタリング | +| `rename` | 何かの名前を変更 | +| `move` | ファイルやフォルダを移動 | +| `upgrade` | 依存関係をアップグレード | +| `downgrade` | 依存関係をダウングレード | + +## 説明 + +説明は **命令形** と **小文字** で書いてください: + +```bash +# Good +📝 update documentation contributors + +# Bad +📝 updated documentation contributors + +# Bad +📝 Update documentation contributors +``` + +## イシュー番号 + +イシュー番号を追加してコミットをイシューにリンクさせる: + +```bash +📝 update documentation contributors (#123) +``` + +## 本文 + +文脈や動機のために本文を使用: + +```bash +📝 update documentation contributors + +- @jerembdn をコントリビューターとして追加 +- @younesbessa をコントリビューターとして追加 + +Co-authored-by: Younes Bessa +``` + + + 各コミットは単一の論理的変更を表すべきです。無関係な変更を混ぜないでください。 + diff --git a/apps/web/src/content/ja/docs/gitmoji/with-ai.mdx b/apps/web/src/content/ja/docs/gitmoji/with-ai.mdx new file mode 100644 index 000000000..0475d6877 --- /dev/null +++ b/apps/web/src/content/ja/docs/gitmoji/with-ai.mdx @@ -0,0 +1,63 @@ +--- +title: AIを使って +description: Claude Codeでgitmojiを使おう +--- +私たちのgitmojiプラグインを[Claude Code](https://claude.ai/code)にインストールして、慣習に従ったコミットを生成しましょう。 + +## プラグインのインストール + +onRuntimeマーケットプレイスを追加して、プラグインをインストールします: + +```bash +# onRuntimeマーケットプレイスを追加 +/plugin marketplace add https://onruntime.com/plugins + +# gitmojiプラグインをインストール +/plugin install gitmoji@onruntime +``` + +またはメニューから直接インストールします: + +1. Claude Codeで`/plugin`を実行 +2. **Discover**タブに移動 +3. マーケットプレイスを追加:`https://onruntime.com/plugins` +4. "gitmoji"を検索してインストール + +## 使い方 + +`/commit`コマンドを実行してコミットを作成します: + +``` +/commit +``` + +``` +/commit fix the login bug +``` + +Claude Codeはあなたの変更を分析し、gitmojiの慣習に従ったコミットを作成します。 + + + `/commit`コマンドは自動的にあなたのgitステータスとdiffを取得して、適切なコミットメッセージを生成します。 + + +## 代替:CLAUDE.md + +プラグインをインストールしたくない場合は、プロジェクトの`CLAUDE.md`にこれを追加します: + +```markdown +## コミットの慣習 + +gitmojiの従来のコミットを使ってください: + +\`\`\` + +\`\`\` + +タイプ:add, fix, improve, update, remove, refactor, rename, move, upgrade, downgrade + +ルール: +- 小文字で書く +- 命令形を使う("add"ではなく"added") +- コミットごとに一つの論理的変更 +``` diff --git a/apps/web/src/content/ja/docs/next-sitemap/api.mdx b/apps/web/src/content/ja/docs/next-sitemap/api.mdx new file mode 100644 index 000000000..9b6c4b374 --- /dev/null +++ b/apps/web/src/content/ja/docs/next-sitemap/api.mdx @@ -0,0 +1,169 @@ +--- +title: APIリファレンス +description: '@onruntime/next-sitemap の完全なAPIドキュメント' +--- +## generateSitemap + +あなたのNext.jsアプリケーションのためのサイトマップを生成します。 + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +const sitemap = await generateSitemap(options); +``` + +### Options + +| Option | Type | Required | Description | +|--------|------|----------|-------------| +| `baseUrl` | `string` | はい | あなたのサイトのベースURL | +| `additionalPaths` | `SitemapEntry[]` | いいえ | 含める追加のURL | +| `exclude` | `string[]` | いいえ | 除外するグロブパターン | +| `defaults` | `SitemapDefaults` | いいえ | すべてのエントリのデフォルト値 | +| `locales` | `string[]` | いいえ | サポートされているロケール | +| `defaultLocale` | `string` | いいえ | デフォルトロケール | + +### SitemapEntry + +| Property | Type | Description | +|----------|------|-------------| +| `url` | `string` | ページのURL(相対または絶対) | +| `lastModified` | `Date \| string` | 最終変更日 | +| `changeFrequency` | `ChangeFrequency` | ページが変更される頻度 | +| `priority` | `number` | 優先度(0.0 - 1.0) | + +### ChangeFrequency + +```tsx +type ChangeFrequency = + | "always" + | "hourly" + | "daily" + | "weekly" + | "monthly" + | "yearly" + | "never"; +``` + +### Example + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + const blogPosts = await fetchPosts(); + + return generateSitemap({ + baseUrl: "https://example.com", + defaults: { + changeFrequency: "weekly", + priority: 0.7, + }, + additionalPaths: blogPosts.map((post) => ({ + url: `/blog/${post.slug}`, + lastModified: post.updatedAt, + priority: 0.8, + })), + exclude: ["/admin/*", "/api/*"], + }); +} +``` + +## generateRobots + +robots.txtファイルを生成します。 + +```tsx +import { generateRobots } from "@onruntime/next-sitemap/app"; + +const robots = generateRobots(options); +``` + +### Options + +| Option | Type | Required | Description | +|--------|------|----------|-------------| +| `baseUrl` | `string` | はい | あなたのサイトのベースURL | +| `rules` | `RobotsRule[]` | いいえ | カスタムロボットルール | +| `sitemap` | `string \| boolean` | いいえ | サイトマップのURLまたは除外するための`false` | + +### RobotsRule + +| Property | Type | Description | +|----------|------|-------------| +| `userAgent` | `string` | ターゲットユーザーエージェント | +| `allow` | `string \| string[]` | 許可されたパス | +| `disallow` | `string \| string[]` | 拒否されたパス | +| `crawlDelay` | `number` | クロールの遅延(秒) | + +### Example + +```tsx +import { generateRobots } from "@onruntime/next-sitemap/app"; + +export default function robots() { + return generateRobots({ + baseUrl: "https://example.com", + rules: [ + { + userAgent: "*", + allow: "/", + disallow: ["/admin/", "/private/"], + }, + { + userAgent: "Googlebot", + allow: "/", + crawlDelay: 1, + }, + ], + }); +} +``` + +## generateSitemapIndex + +大きなサイトのためのサイトマップインデックスを生成します。 + +```tsx +import { generateSitemapIndex } from "@onruntime/next-sitemap/app"; + +const index = await generateSitemapIndex(options); +``` + +### Options + +| Option | Type | Required | Description | +|--------|------|----------|-------------| +| `baseUrl` | `string` | はい | あなたのサイトのベースURL | +| `sitemapsPerFile` | `number` | いいえ | サイトマップごとのURL数(デフォルト: 5000) | + +### Example + +```tsx +import { generateSitemapIndex } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemapIndex({ + baseUrl: "https://example.com", + sitemapsPerFile: 10000, + }); +} +``` + +## Type Exports + +パッケージは便利のためにTypeScriptタイプをエクスポートします: + +```tsx +import type { + SitemapEntry, + SitemapOptions, + RobotsOptions, + RobotsRule, + ChangeFrequency, +} from "@onruntime/next-sitemap"; +``` + + + すべての関数とオプションは完全に型付けされています。あなたのIDEはオートコンプリートと型チェックを提供します。 + diff --git a/apps/web/src/content/ja/docs/next-sitemap/configuration.mdx b/apps/web/src/content/ja/docs/next-sitemap/configuration.mdx new file mode 100644 index 000000000..74a286ff9 --- /dev/null +++ b/apps/web/src/content/ja/docs/next-sitemap/configuration.mdx @@ -0,0 +1,176 @@ +--- +title: 設定 +description: '@onruntime/next-sitemapを自分のニーズに合わせて設定する' +--- +## 基本設定 + +最も簡単な設定は、基本URLのみが必要です: + +```tsx +// app/sitemap.ts +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + }); +} +``` + +## 高度な設定 + +### カスタムルート + +カスタムルートや動的コンテンツを追加: + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + // 動的コンテンツを取得 + const posts = await fetchBlogPosts(); + + return generateSitemap({ + baseUrl: "https://example.com", + additionalPaths: posts.map((post) => ({ + url: `/blog/${post.slug}`, + lastModified: post.updatedAt, + changeFrequency: "weekly", + priority: 0.7, + })), + }); +} +``` + +### ルートの除外 + +特定のルートをサイトマップから除外: + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + exclude: [ + "/admin/*", + "/api/*", + "/private/*", + ], + }); +} +``` + +### プライオリティと変更頻度 + +すべてのページのデフォルト値を設定: + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + defaults: { + changeFrequency: "weekly", + priority: 0.7, + }, + }); +} +``` + +## robots.txtの設定 + +### 基本のrobots.txt + +```tsx +// app/robots.ts +import { generateRobots } from "@onruntime/next-sitemap/app"; + +export default function robots() { + return generateRobots({ + baseUrl: "https://example.com", + }); +} +``` + +### カスタムルール + +```tsx +import { generateRobots } from "@onruntime/next-sitemap/app"; + +export default function robots() { + return generateRobots({ + baseUrl: "https://example.com", + rules: [ + { + userAgent: "*", + allow: "/", + disallow: ["/admin/", "/private/"], + }, + { + userAgent: "Googlebot", + allow: "/", + }, + ], + }); +} +``` + +## 国際化 + +### 多言語サイトマップ + +オルタネートを使って複数の言語をサポート: + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +const locales = ["en", "fr", "de"]; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + locales, + defaultLocale: "en", + }); +} +``` + +これは`hreflang`オルタネートを持つURLsを生成します: + +```xml + + https://example.com/en/about + + + + +``` + +## 分割サイトマップ + +大規模なサイトの場合、サイトマップを複数のファイルに分割: + +```tsx +// app/sitemap/[id]/route.ts +import { generateSitemapIndex } from "@onruntime/next-sitemap/app"; + +export async function GET( + request: Request, + { params }: { params: { id: string } } +) { + const sitemaps = await generateSitemapIndex({ + baseUrl: "https://example.com", + sitemapsPerFile: 5000, + }); + + return new Response(sitemaps[parseInt(params.id)], { + headers: { "Content-Type": "application/xml" }, + }); +} +``` + + + Googleは、サイトマップを50MB未満かつ50,000URLs以下に保つことを推奨しています。大規模サイトには分割サイトマップを使用してください。 + diff --git a/apps/web/src/content/ja/docs/next-sitemap/getting-started.mdx b/apps/web/src/content/ja/docs/next-sitemap/getting-started.mdx new file mode 100644 index 000000000..652620ce6 --- /dev/null +++ b/apps/web/src/content/ja/docs/next-sitemap/getting-started.mdx @@ -0,0 +1,86 @@ +--- +title: 始めに +description: Next.js アプリケーション用のサイトマップジェネレーター +--- +## what is @onruntime/next-sitemap? + +`@onruntime/next-sitemap`は、Next.jsアプリケーション向けに特別に設計されたパワフルなサイトマップジェネレーターです。これを使うと、Next.jsサイトの`sitemap.xml`と`robots.txt`ファイルを自動的に生成できます。 + + + - App Routerのための自動サイトマップ生成 + - 動的ルートのサポート + - 優先度と変更頻度の設定 + - robots.txtの生成 + - 多言語サイトマップのサポート + + +## なんで使うの? + +### SEO最適化 + +サイトマップは、検索エンジンがあなたのページをもっと効率的に発見してインデックスするのを助けます: + +- **インデックスが速い** - 検索エンジンはすべてのページを見つけられる +- **クローリングが良い** - ページの更新についてクローラーに通知 +- **優先度のヒント** - 重要なページにクローラーを誘導 + +### Next.jsとの統合 + +Next.js向けに特別に構築されているので、以下を理解しています: + +- App Routerの構造 +- 動的ルート +- 静的生成 +- 国際化されたルーティング + +## クイック例 + +```tsx +// app/sitemap.ts +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + }); +} +``` + +これにより、すべての静的および動的ページを含む完全なサイトマップが生成されます。 + +## 生成された出力 + +このパッケージは標準的なXMLサイトマップを生成します: + +```xml + + + + https://example.com/ + 2024-01-15 + daily + 1.0 + + + https://example.com/about + 2024-01-10 + monthly + 0.8 + + +``` + +## 次のステップ + + + + + diff --git a/apps/web/src/content/ja/docs/next-sitemap/installation.mdx b/apps/web/src/content/ja/docs/next-sitemap/installation.mdx new file mode 100644 index 000000000..c2c7faeec --- /dev/null +++ b/apps/web/src/content/ja/docs/next-sitemap/installation.mdx @@ -0,0 +1,121 @@ +--- +title: インストール +description: '@onruntime/next-sitemapをインストールして設定する' +--- +## インストール + +お好みのパッケージマネージャーを使ってパッケージをインストールしてね: + +```bash +# npm +npm install @onruntime/next-sitemap + +# yarn +yarn add @onruntime/next-sitemap + +# pnpm +pnpm add @onruntime/next-sitemap +``` + +## 基本設定 + +### App Router (Next.js 13+) + +`app` ディレクトリに `sitemap.ts` ファイルを作成してね: + +```tsx +// app/sitemap.ts +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://your-domain.com", + }); +} +``` + +### robots.txt + +robots.txt の生成のために `robots.ts` ファイルを作成してね: + +```tsx +// app/robots.ts +import { generateRobots } from "@onruntime/next-sitemap/app"; + +export default function robots() { + return generateRobots({ + baseUrl: "https://your-domain.com", + }); +} +``` + +## プロジェクト構造 + +セットアップが完了すると、プロジェクトはこんな感じになるよ: + + + + + + + + + + + + + + + + + + +## インストール確認 + +開発サーバーを起動して、以下にアクセスしてね: + +- `http://localhost:3000/sitemap.xml` - あなたのサイトマップ +- `http://localhost:3000/robots.txt` - あなたの robots.txt + +サイトマップのための生成された XML と robots.txt のためのテキストコンテンツを見ることができるよ。 + + + サイトマップにはビルド時に発見された全てのルートが含まれるよ。開発中は、現在のルート構造を反映しているよ。 + + +## 環境変数 + +本番用に基本URLを設定してね: + +```env +# .env.production +NEXT_PUBLIC_SITE_URL=https://your-domain.com +``` + +それから、設定に使ってね: + +```tsx +// app/sitemap.ts +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: process.env.NEXT_PUBLIC_SITE_URL || "https://your-domain.com", + }); +} +``` + +## 次のステップ + + + + + diff --git a/apps/web/src/content/ja/docs/translations/api.mdx b/apps/web/src/content/ja/docs/translations/api.mdx new file mode 100644 index 000000000..10b891772 --- /dev/null +++ b/apps/web/src/content/ja/docs/translations/api.mdx @@ -0,0 +1,194 @@ +--- +title: APIリファレンス +description: '@onruntime/translationsの完全なAPIドキュメント' +--- +## TranslationsProvider + +アプリケーションをラップするプロバイダーコンポーネント。 + +```tsx +import { TranslationsProvider } from "@onruntime/translations/react"; + + + {children} + +``` + +### Props + +| Prop | Type | Required | Description | +|------|------|----------|-------------| +| `locale` | `string` | はい | 現在アクティブなロケール | +| `locales` | `Record` | はい | すべてのロケール翻訳を含むオブジェクト | +| `fallbackLocale` | `string` | いいえ | キーが欠落しているときのフォールバックロケール | +| `children` | `ReactNode` | はい | 子コンポーネント | + +## useTranslation + +クライアントコンポーネントで翻訳にアクセスするためのフック。 + +```tsx +const { t, locale, setLocale } = useTranslation("namespace"); +``` + +### Parameters + +| Parameter | Type | Required | Description | +|-----------|------|----------|-------------| +| `namespace` | `string` | はい | 使用する翻訳ネームスペース | + +### Returns + +| Property | Type | Description | +|----------|------|-------------| +| `t` | `(key: string, vars?: object) => string` | 翻訳関数 | +| `locale` | `string` | 現在のロケール | +| `setLocale` | `(locale: string) => void` | ロケールを変更するための関数 | + +### Example + +```tsx +const { t, locale, setLocale } = useTranslation("common"); + +// 基本的な使い方 +t("greeting"); // "Hello" + +// 変数を使って +t("greeting_name", { name: "John" }); // "Hello, John!" + +// ネストされたキー +t("nav.home"); // "Home" + +// ロケールを変更 +setLocale("fr"); +``` + +## getTranslation + +サーバーコンポーネントで翻訳にアクセスするための非同期関数 (Next.js)。 + +```tsx +const { t } = await getTranslation("namespace"); +``` + +### Parameters + +| Parameter | Type | Required | Description | +|-----------|------|----------|-------------| +| `namespace` | `string` | はい | 使用する翻訳ネームスペース | + +### Returns + +| Property | Type | Description | +|----------|------|-------------| +| `t` | `(key: string, vars?: object) => string` | 翻訳関数 | +| `locale` | `string` | 現在のロケール | + +### Example + +```tsx +// サーバーコンポーネント +export default async function Page() { + const { t } = await getTranslation("common"); + + return

{t("title")}

; +} +``` + +## Link Component + +Next.js 用のロケール対応リンクコンポーネント。 + +```tsx +import { Link } from "@onruntime/translations/next"; + +About +``` + +### Props + +Next.js の `Link` コンポーネントからのすべての props、プラス: + +| Prop | Type | Default | Description | +|------|------|---------|-------------| +| `locale` | `string` | 現在のロケール | リンクのロケールを上書き | + +### Example + +```tsx +// 現在のロケールを使用 +About + +// 特定のロケールを強制 +À propos +``` + +## Translation Function (t) + +`t` 関数は翻訳された文字列を取得するために使用されます。 + +### Signature + +```tsx +t(key: string, variables?: Record): string +``` + +### Parameters + +| Parameter | Type | Description | +|-----------|------|-------------| +| `key` | `string` | 翻訳キー (ドット表記をサポート) | +| `variables` | `object` | 補完する変数 | + +### Variable Interpolation + +```json +{ + "greeting": "Hello, {name}!", + "items": "You have {count} items" +} +``` + +```tsx +t("greeting", { name: "Alice" }); // "Hello, Alice!" +t("items", { count: 5 }); // "You have 5 items" +``` + +### Nested Keys + +```json +{ + "user": { + "profile": { + "title": "Profile" + } + } +} +``` + +```tsx +t("user.profile.title"); // "Profile" +``` + +## Type Definitions + +### TranslationNamespaces + +型安全な翻訳のためにこのインターフェースを拡張: + +```tsx +declare module "@onruntime/translations" { + interface TranslationNamespaces { + common: typeof import("./locales/en/common.json"); + auth: typeof import("./locales/en/auth.json"); + } +} +``` + + + 適切な型定義があれば、翻訳キーのオートコンプリートがあり、不正なキーのコンパイル時エラーを受け取れます。 + diff --git a/apps/web/src/content/ja/docs/translations/getting-started.mdx b/apps/web/src/content/ja/docs/translations/getting-started.mdx new file mode 100644 index 000000000..3ef575f95 --- /dev/null +++ b/apps/web/src/content/ja/docs/translations/getting-started.mdx @@ -0,0 +1,92 @@ +--- +title: はじめに +description: ReactとNext.jsのための軽量で型安全な国際化ライブラリ +--- +## What is @onruntime/translations? + +`@onruntime/translations`は、ReactとNext.jsアプリケーション向けに設計された軽量で型安全な国際化(i18n)ライブラリだよ。完全なTypeScriptサポートを持つシンプルなAPIで翻訳を管理できるんだ。 + + + - TypeScriptによる型安全な翻訳 + - ReactとNext.js(App Router)のサポート + - 名前空間ベースの整理 + - 変数の補間 + - 軽量で高性能 + + +## Why Use It? + +### Type Safety + +無効な翻訳キーを使用しているとコンパイル時エラーが出るよ: + +```typescript +const { t } = useTranslation("common"); + +t("greeting"); // ✅ 有効なキー +t("invalid_key"); // ❌ TypeScriptエラー +``` + +### Simple API + +あなたの翻訳ニーズに対してたった2つのフックがあれば大丈夫: + +```typescript +// クライアントコンポーネント +const { t } = useTranslation("namespace"); + +// サーバーコンポーネント(Next.js) +const { t } = await getTranslation("namespace"); +``` + +### Organized Translations + +名前空間を使って翻訳を整理しよう: + + + + + + + + + + + + + + + + +## Quick Example + +```tsx +// locales/en/common.json +{ + "greeting": "Hello, {name}!" +} + +// コンポーネント +import { useTranslation } from "@onruntime/translations/react"; + +function Welcome({ name }) { + const { t } = useTranslation("common"); + + return

{t("greeting", { name })}

; +} +``` + +## Next Steps + + + + + diff --git a/apps/web/src/content/ja/docs/translations/installation.mdx b/apps/web/src/content/ja/docs/translations/installation.mdx new file mode 100644 index 000000000..4df535b8b --- /dev/null +++ b/apps/web/src/content/ja/docs/translations/installation.mdx @@ -0,0 +1,127 @@ +--- +title: インストール +description: '@onruntime/translationsをインストールして設定する' +--- +## インストール + +お好きなパッケージマネージャーを使ってパッケージをインストールしてください: + +```bash +# npm +npm install @onruntime/translations + +# yarn +yarn add @onruntime/translations + +# pnpm +pnpm add @onruntime/translations +``` + +## プロジェクトのセットアップ + +### 1. 翻訳ファイルを作成 + +プロジェクト内に各言語の翻訳ファイルを含む `locales` ディレクトリを作成します: + + + + + + + + + + + + + + +例 `locales/en/common.json`: + +```json +{ + "title": "ようこそ", + "greeting": "こんにちは、{name}!", + "items": { + "one": "{count} アイテム", + "other": "{count} アイテム" + } +} +``` + +### 2. TypeScript を設定 (オプション) + +型安全な翻訳のため、型定義ファイルを作成します: + +```typescript +// types/translations.d.ts +import "onruntime/translations"; + +declare module "@onruntime/translations" { + interface TranslationNamespaces { + common: typeof import("../locales/en/common.json"); + auth: typeof import("../locales/en/auth.json"); + } +} +``` + +### 3. プロバイダーをセットアップ + +アプリを `TranslationsProvider` でラップします: + +```tsx +// Reactの場合 +import { TranslationsProvider } from "@onruntime/translations/react"; +import en from "./locales/en"; +import fr from "./locales/fr"; + +const locales = { en, fr }; + +function App() { + return ( + + + + ); +} +``` + + + Next.jsとアプリルーターを使う場合は、推奨のセットアップについては[Next.jsの使用法](/docs/translations/nextjs)ガイドを確認してください。 + + +## インストールの確認 + +簡単なコンポーネントでセットアップをテストします: + +```tsx +import { useTranslation } from "@onruntime/translations/react"; + +function TestComponent() { + const { t } = useTranslation("common"); + + return ( +
+

{t("title")}

+

{t("greeting", { name: "World" })}

+
+ ); +} +``` + +翻訳が表示されれば、準備完了です! + +## 次のステップ + + + + + diff --git a/apps/web/src/content/ja/docs/translations/nextjs.mdx b/apps/web/src/content/ja/docs/translations/nextjs.mdx new file mode 100644 index 000000000..6ac8ba06a --- /dev/null +++ b/apps/web/src/content/ja/docs/translations/nextjs.mdx @@ -0,0 +1,191 @@ +--- +title: Next.jsの使い方 +description: Next.js App Routerで@onruntime/translationsを使う +--- +## アプリルーターのセットアップ + +### 1. プロバイダーを設定する + +翻訳を設定するためにプロバイダーのファイルを作成します: + +```tsx +// app/providers.tsx +"use client"; + +import { TranslationsProvider } from "@onruntime/translations/react"; +import { ReactNode } from "react"; + +import en from "@/locales/en"; +import fr from "@/locales/fr"; + +const locales = { en, fr }; + +interface ProvidersProps { + children: ReactNode; + locale: string; +} + +export function Providers({ children, locale }: ProvidersProps) { + return ( + + {children} + + ); +} +``` + +### 2. ルートレイアウトを設定する + +ルートレイアウトでプロバイダーを使います: + +```tsx +// app/[locale]/layout.tsx +import { Providers } from "../providers"; + +export default function LocaleLayout({ + children, + params, +}: { + children: React.ReactNode; + params: { locale: string }; +}) { + return ( + + {children} + + ); +} +``` + +## サーバーコンポーネント + +サーバーコンポーネントでは `getTranslation` を使います: + +```tsx +// app/[locale]/page.tsx +import { getTranslation } from "@/lib/translations.server"; + +export default async function HomePage() { + const { t } = await getTranslation("common"); + + return ( +
+

{t("title")}

+

{t("description")}

+
+ ); +} +``` + + + サーバーコンポーネントでは `getTranslation` を、クライアントコンポーネントでは `useTranslation` を使ってね。 + + +## クライアントコンポーネント + +クライアントコンポーネントでは `useTranslation` を使います: + +```tsx +"use client"; + +import { useTranslation } from "@onruntime/translations/react"; + +export function LanguageSwitcher() { + const { locale, setLocale } = useTranslation("common"); + + return ( + + ); +} +``` + +## ロケールベースのルーティング + +### ミドルウェアの設定 + +ロケールの検出を処理するためにミドルウェアを設定します: + +```tsx +// middleware.ts +import { NextRequest, NextResponse } from "next/server"; + +const locales = ["en", "fr"]; +const defaultLocale = "en"; + +export function middleware(request: NextRequest) { + const pathname = request.nextUrl.pathname; + + // パス名にロケールが含まれているかを確認 + const pathnameHasLocale = locales.some( + (locale) => pathname.startsWith(`/${locale}/`) || pathname === `/${locale}` + ); + + if (pathnameHasLocale) return; + + // デフォルトのロケールにリダイレクト + return NextResponse.redirect( + new URL(`/${defaultLocale}${pathname}`, request.url) + ); +} + +export const config = { + matcher: ["/((?!api|_next|.*\\..*).*)"], +}; +``` + +## スタティックジェネレーション + +すべてのロケールのために静的ページを生成します: + +```tsx +// app/[locale]/page.tsx +export async function generateStaticParams() { + return [{ locale: "en" }, { locale: "fr" }]; +} +``` + +## リンクコンポーネント + +ナビゲーションのために翻訳されたリンクコンポーネントを使います: + +```tsx +import { Link } from "@onruntime/translations/next"; + +function Navigation() { + return ( + + ); +} +``` + +`Link` コンポーネントは自動的にロケールのプレフィックスを処理します。 + +## プロジェクト構成の例 + + + + + + + + + + + + + + + + + + + + + + diff --git a/apps/web/src/content/ja/docs/translations/react.mdx b/apps/web/src/content/ja/docs/translations/react.mdx new file mode 100644 index 000000000..a3caade57 --- /dev/null +++ b/apps/web/src/content/ja/docs/translations/react.mdx @@ -0,0 +1,157 @@ +--- +title: Reactの使い方 +description: Reactアプリケーションで@onruntime/translationsを使う +--- +## 基本的な使い方 + +### useTranslation フック + +`useTranslation` フックは、React コンポーネントで翻訳にアクセスするための主要な方法です: + +```tsx +import { useTranslation } from "@onruntime/translations/react"; + +function MyComponent() { + const { t, locale } = useTranslation("common"); + + return ( +
+

現在のロケール: {locale}

+

{t("title")}

+
+ ); +} +``` + +### 変数の補間 + +翻訳に変数を渡します: + +```json +// locales/en/common.json +{ + "greeting": "こんにちは、{name}!", + "items_count": "アイテムが {count} 個あります" +} +``` + +```tsx +function Greeting({ name, itemCount }) { + const { t } = useTranslation("common"); + + return ( + <> +

{t("greeting", { name })}

+

{t("items_count", { count: itemCount })}

+ + ); +} +``` + +## 複数のネームスペース + +同じコンポーネントで複数のネームスペースを使用できます: + +```tsx +function Dashboard() { + const { t: tCommon } = useTranslation("common"); + const { t: tDashboard } = useTranslation("dashboard"); + + return ( +
+

{tDashboard("title")}

+ +
+ ); +} +``` + +## ロケールの変更 + +`setLocale` 関数を使って現在のロケールを変更します: + +```tsx +import { useTranslation } from "@onruntime/translations/react"; + +function LanguageSwitcher() { + const { locale, setLocale } = useTranslation("common"); + + return ( + + ); +} +``` + +## ネストされたキー + +ドット表記を使用してネストされた翻訳キーにアクセスします: + +```json +// locales/en/common.json +{ + "nav": { + "home": "ホーム", + "about": "アバウト", + "contact": "お問い合わせ" + } +} +``` + +```tsx +function Navigation() { + const { t } = useTranslation("common"); + + return ( + + ); +} +``` + +## ベストプラクティス + + + すべてを1つのファイルにまとめるのではなく、機能やページごとに翻訳を整理します。 + + +### 推奨構成 + + + + + + + + + + + + +### キーを一貫性を保つ + +すべてのロケールで一貫した命名規則を使用します: + +```json +// ✅ 良い - 一貫した構造 +{ + "page_title": "ダッシュボード", + "actions": { + "save": "保存", + "cancel": "キャンセル" + } +} + +// ❌ 避ける - 一貫性がない +{ + "pageTitle": "ダッシュボード", + "save_button": "保存", + "cancelBtn": "キャンセル" +} +``` diff --git a/apps/web/src/content/ko/docs/gitmoji/emojis.mdx b/apps/web/src/content/ko/docs/gitmoji/emojis.mdx new file mode 100644 index 000000000..2da75cc4a --- /dev/null +++ b/apps/web/src/content/ko/docs/gitmoji/emojis.mdx @@ -0,0 +1,11 @@ +--- +title: 이모지 참고 +description: gitmojis의 전체 목록 +--- +우리는 [gitmoji](https://gitmoji.dev)를 사용해서 커밋을 분류해. 여기 이모지의 전체 목록이랑, 코드, 설명이 있어: + + + + + 인터랙티브한 커밋 경험을 위해 [gitmoji-cli](https://github.com/carloscuesta/gitmoji-cli)나 [VS Code 확장](https://marketplace.visualstudio.com/items?itemName=seatonjiang.gitmoji-vscode)을 사용해봐. + diff --git a/apps/web/src/content/ko/docs/gitmoji/getting-started.mdx b/apps/web/src/content/ko/docs/gitmoji/getting-started.mdx new file mode 100644 index 000000000..e7b4b369d --- /dev/null +++ b/apps/web/src/content/ko/docs/gitmoji/getting-started.mdx @@ -0,0 +1,91 @@ +--- +title: 시작하기 +description: 우리의 커밋 규칙을 배워보세요 +--- +우리는 깔끔한 프로젝트 이력을 유지하는 걸 좋아해. 우리의 커밋 규칙은 [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0)에서 영감을 받았지만 [gitmoji](https://gitmoji.dev)를 사용해서 더 시각적이고 재밌게 커스터마이즈했어. + +## 구조 + +커밋 메시지는 다음과 같이 **소문자**로 구조화해야 해: + +``` + [(#)] + +[optional body] + +[optional footer(s)] +``` + +### 예시 + +```bash +📝 update documentation contributors + +- Add @jerembdn as a contributor +- Add @younesbessa as a contributor + +Co-authored-by: Younes Bessa +``` + +대부분의 경우, 간단한 한 줄이면 충분해: + +```bash +📝 update documentation contributors +``` + +## 유형 + +우리는 다음과 같은 커밋 유형을 사용해: + +| Type | Description | +| --- | --- | +| `add` | 새로운 기능 추가 | +| `fix` | 버그 수정 | +| `improve` | 뭔가 개선 | +| `update` | 뭔가 업데이트 | +| `remove` | 뭔가 제거 | +| `refactor` | 뭔가 리팩토링 | +| `rename` | 뭔가 이름 변경 | +| `move` | 파일이나 폴더 이동 | +| `upgrade` | 의존성 업그레이드 | +| `downgrade` | 의존성 다운그레이드 | + +## 설명 + +설명은 **명령형**과 **소문자**로 작성해: + +```bash +# 좋음 +📝 update documentation contributors + +# 나쁨 +📝 updated documentation contributors + +# 나쁨 +📝 Update documentation contributors +``` + +## 이슈 번호 + +커밋을 이슈와 연결하려면 이슈 번호를 추가해: + +```bash +📝 update documentation contributors (#123) +``` + +## 본문 + +본문은 맥락과 동기를 위해 사용해: + +```bash +📝 update documentation contributors + +- Add @jerembdn as a contributor +- Add @younesbessa as a contributor + +Co-authored-by: Younes Bessa +``` + + + 각 커밋은 단일 논리적 변화를 나타내야 해. 관련 없는 변화를 섞지 마. + diff --git a/apps/web/src/content/ko/docs/gitmoji/with-ai.mdx b/apps/web/src/content/ko/docs/gitmoji/with-ai.mdx new file mode 100644 index 000000000..2afbc216d --- /dev/null +++ b/apps/web/src/content/ko/docs/gitmoji/with-ai.mdx @@ -0,0 +1,63 @@ +--- +title: AI와 함께 +description: Claude Code와 gitmoji 사용하기 +--- +우리 gitmoji 플러그인을 [Claude Code](https://claude.ai/code)에 설치해서 규칙에 맞는 커밋을 생성해봐요. + +## 플러그인 설치하기 + +onRuntime 마켓플레이스를 추가하고 플러그인을 설치하세요: + +```bash +# onRuntime 마켓플레이스 추가 +/plugin marketplace add https://onruntime.com/plugins + +# gitmoji 플러그인 설치 +/plugin install gitmoji@onruntime +``` + +아니면 메뉴에서 직접 설치할 수도 있어요: + +1. Claude Code에서 `/plugin` 실행 +2. **Discover** 탭으로 가기 +3. 마켓플레이스 추가: `https://onruntime.com/plugins` +4. "gitmoji" 검색 후 설치 + +## 사용법 + +`/commit` 명령어를 실행해서 커밋을 만들어 보세요: + +``` +/commit +``` + +``` +/commit fix the login bug +``` + +Claude Code가 당신의 변경 사항을 분석해서 gitmoji 규칙에 맞는 커밋을 만들어줄 거예요. + + + `/commit` 명령어는 자동으로 당신의 git 상태와 diff를 가져와서 적절한 커밋 메시지를 생성해요. + + +## 대안: CLAUDE.md + +플러그인을 설치하고 싶지 않다면, 프로젝트의 `CLAUDE.md`에 이 내용을 추가해보세요: + +```markdown +## 커밋 규칙 + +gitmoji 관례를 사용하세요: + +\`\`\` + +\`\`\` + +타입: add, fix, improve, update, remove, refactor, rename, move, upgrade, downgrade + +규칙: +- 소문자로 작성 +- 명령형 사용 ("add"는 "added"가 아님) +- 커밋당 하나의 논리적 변경 +``` diff --git a/apps/web/src/content/ko/docs/next-sitemap/api.mdx b/apps/web/src/content/ko/docs/next-sitemap/api.mdx new file mode 100644 index 000000000..e9c51fe2b --- /dev/null +++ b/apps/web/src/content/ko/docs/next-sitemap/api.mdx @@ -0,0 +1,169 @@ +--- +title: API 참조 +description: '@onruntime/next-sitemap에 대한 완전한 API 문서' +--- +## generateSitemap + +Next.js 애플리케이션을 위한 사이트맵을 생성해. + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +const sitemap = await generateSitemap(options); +``` + +### Options + +| Option | Type | Required | Description | +|--------|------|----------|-------------| +| `baseUrl` | `string` | Yes | 사이트의 기본 URL | +| `additionalPaths` | `SitemapEntry[]` | No | 포함할 추가 URL | +| `exclude` | `string[]` | No | 제외할 glob 패턴 | +| `defaults` | `SitemapDefaults` | No | 모든 항목의 기본값 | +| `locales` | `string[]` | No | 지원하는 로케일 | +| `defaultLocale` | `string` | No | 기본 로케일 | + +### SitemapEntry + +| Property | Type | Description | +|----------|------|-------------| +| `url` | `string` | 페이지 URL (상대 또는 절대) | +| `lastModified` | `Date \| string` | 마지막 수정 날짜 | +| `changeFrequency` | `ChangeFrequency` | 페이지가 얼마나 자주 변경되는지 | +| `priority` | `number` | 우선순위 (0.0 - 1.0) | + +### ChangeFrequency + +```tsx +type ChangeFrequency = + | "always" + | "hourly" + | "daily" + | "weekly" + | "monthly" + | "yearly" + | "never"; +``` + +### Example + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + const blogPosts = await fetchPosts(); + + return generateSitemap({ + baseUrl: "https://example.com", + defaults: { + changeFrequency: "weekly", + priority: 0.7, + }, + additionalPaths: blogPosts.map((post) => ({ + url: `/blog/${post.slug}`, + lastModified: post.updatedAt, + priority: 0.8, + })), + exclude: ["/admin/*", "/api/*"], + }); +} +``` + +## generateRobots + +robots.txt 파일을 생성해. + +```tsx +import { generateRobots } from "@onruntime/next-sitemap/app"; + +const robots = generateRobots(options); +``` + +### Options + +| Option | Type | Required | Description | +|--------|------|----------|-------------| +| `baseUrl` | `string` | Yes | 사이트의 기본 URL | +| `rules` | `RobotsRule[]` | No | 커스텀 로봇 규칙 | +| `sitemap` | `string \| boolean` | No | 사이트맵 URL 또는 제외할 경우 `false` | + +### RobotsRule + +| Property | Type | Description | +|----------|------|-------------| +| `userAgent` | `string` | 대상 사용자 에이전트 | +| `allow` | `string \| string[]` | 허용된 경로 | +| `disallow` | `string \| string[]` | 금지된 경로 | +| `crawlDelay` | `number` | 크롤링 지연 시간 (초 단위) | + +### Example + +```tsx +import { generateRobots } from "@onruntime/next-sitemap/app"; + +export default function robots() { + return generateRobots({ + baseUrl: "https://example.com", + rules: [ + { + userAgent: "*", + allow: "/", + disallow: ["/admin/", "/private/"], + }, + { + userAgent: "Googlebot", + allow: "/", + crawlDelay: 1, + }, + ], + }); +} +``` + +## generateSitemapIndex + +대규모 사이트를 위한 사이트맵 인덱스를 생성해. + +```tsx +import { generateSitemapIndex } from "@onruntime/next-sitemap/app"; + +const index = await generateSitemapIndex(options); +``` + +### Options + +| Option | Type | Required | Description | +|--------|------|----------|-------------| +| `baseUrl` | `string` | Yes | 사이트의 기본 URL | +| `sitemapsPerFile` | `number` | No | 사이트맵당 URL 수 (기본값: 5000) | + +### Example + +```tsx +import { generateSitemapIndex } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemapIndex({ + baseUrl: "https://example.com", + sitemapsPerFile: 10000, + }); +} +``` + +## Type Exports + +패키지는 편의를 위해 TypeScript 타입을 내보내. + +```tsx +import type { + SitemapEntry, + SitemapOptions, + RobotsOptions, + RobotsRule, + ChangeFrequency, +} from "@onruntime/next-sitemap"; +``` + + + 모든 함수와 옵션은 완전히 타입이 지정되어 있어. 당신의 IDE가 자동 완성 및 타입 검사를 제공할 거야. + diff --git a/apps/web/src/content/ko/docs/next-sitemap/configuration.mdx b/apps/web/src/content/ko/docs/next-sitemap/configuration.mdx new file mode 100644 index 000000000..59c215ab1 --- /dev/null +++ b/apps/web/src/content/ko/docs/next-sitemap/configuration.mdx @@ -0,0 +1,176 @@ +--- +title: 설정 +description: 당신의 필요에 맞게 @onruntime/next-sitemap을 설정하세요 +--- +## 기본 설정 + +가장 간단한 설정은 기본 URL만 필요해: + +```tsx +// app/sitemap.ts +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + }); +} +``` + +## 고급 설정 + +### 사용자 정의 경로 + +사용자 정의 경로나 동적 콘텐츠를 추가해봐: + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + // 동적 콘텐츠 가져오기 + const posts = await fetchBlogPosts(); + + return generateSitemap({ + baseUrl: "https://example.com", + additionalPaths: posts.map((post) => ({ + url: `/blog/${post.slug}`, + lastModified: post.updatedAt, + changeFrequency: "weekly", + priority: 0.7, + })), + }); +} +``` + +### 경로 제외하기 + +특정 경로를 사이트맵에서 제외하고 싶으면: + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + exclude: [ + "/admin/*", + "/api/*", + "/private/*", + ], + }); +} +``` + +### 우선순위와 변경 빈도 + +모든 페이지에 대한 기본값 설정하기: + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + defaults: { + changeFrequency: "weekly", + priority: 0.7, + }, + }); +} +``` + +## robots.txt 설정 + +### 기본 robots.txt + +```tsx +// app/robots.ts +import { generateRobots } from "@onruntime/next-sitemap/app"; + +export default function robots() { + return generateRobots({ + baseUrl: "https://example.com", + }); +} +``` + +### 사용자 정의 규칙 + +```tsx +import { generateRobots } from "@onruntime/next-sitemap/app"; + +export default function robots() { + return generateRobots({ + baseUrl: "https://example.com", + rules: [ + { + userAgent: "*", + allow: "/", + disallow: ["/admin/", "/private/"], + }, + { + userAgent: "Googlebot", + allow: "/", + }, + ], + }); +} +``` + +## 국제화 + +### 다국어 사이트맵 + +대체 언어를 지원해 보자: + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +const locales = ["en", "fr", "de"]; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + locales, + defaultLocale: "en", + }); +} +``` + +이건 `hreflang` 대체를 가진 URL을 생성해: + +```xml + + https://example.com/en/about + + + + +``` + +## 분할 사이트맵 + +큰 사이트의 경우, 사이트맵을 여러 파일로 분할해: + +```tsx +// app/sitemap/[id]/route.ts +import { generateSitemapIndex } from "@onruntime/next-sitemap/app"; + +export async function GET( + request: Request, + { params }: { params: { id: string } } +) { + const sitemaps = await generateSitemapIndex({ + baseUrl: "https://example.com", + sitemapsPerFile: 5000, + }); + + return new Response(sitemaps[parseInt(params.id)], { + headers: { "Content-Type": "application/xml" }, + }); +} +``` + + + Google은 사이트맵을 50MB와 50,000 URLs 미만으로 유지하는 것을 권장해. 더 큰 사이트의 경우 분할 사이트맵을 사용해. + diff --git a/apps/web/src/content/ko/docs/next-sitemap/getting-started.mdx b/apps/web/src/content/ko/docs/next-sitemap/getting-started.mdx new file mode 100644 index 000000000..f87886914 --- /dev/null +++ b/apps/web/src/content/ko/docs/next-sitemap/getting-started.mdx @@ -0,0 +1,86 @@ +--- +title: 시작하기 +description: Next.js 애플리케이션을 위한 사이트 맵 생성기 +--- +## What is @onruntime/next-sitemap? + +`@onruntime/next-sitemap`은 Next.js 애플리케이션을 위해 특별히 설계된 강력한 사이트맵 생성기야. 이건 자동으로 너의 Next.js 사이트를 위한 `sitemap.xml`과 `robots.txt` 파일을 생성해. + + + - 앱 라우터에 대한 자동 사이트맵 생성 + - 동적 경로 지원 + - 우선순위 및 변경 빈도 설정 가능 + - robots.txt 생성 + - 다국어 사이트맵 지원 + + +## 왜 사용해야 할까? + +### SEO 최적화 + +사이트맵은 검색 엔진이 너의 페이지를 더 효율적으로 발견하고 인덱싱하는 데 도움을 줘: + +- **더 빠른 인덱싱** - 검색 엔진이 모든 페이지를 찾을 수 있어 +- **더 나은 크롤링** - 페이지 업데이트에 대한 정보를 크롤러에게 알려줘 +- **우선순위 힌트** - 크롤러가 중요한 페이지로 안내받게 해 + +### Next.js 통합 + +특별히 Next.js를 위해 만들어져 있어서 다음을 이해해: + +- 앱 라우터 구조 +- 동적 경로 +- 정적 생성 +- 국제화된 라우팅 + +## 간단한 예시 + +```tsx +// app/sitemap.ts +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + }); +} +``` + +이건 너의 모든 정적 및 동적 페이지를 포함하는 완전한 사이트맵을 생성해. + +## 생성된 출력 + +이 패키지는 표준 XML 사이트맵을 생성해: + +```xml + + + + https://example.com/ + 2024-01-15 + daily + 1.0 + + + https://example.com/about + 2024-01-10 + monthly + 0.8 + + +``` + +## 다음 단계 + + + + + diff --git a/apps/web/src/content/ko/docs/next-sitemap/installation.mdx b/apps/web/src/content/ko/docs/next-sitemap/installation.mdx new file mode 100644 index 000000000..caf89d887 --- /dev/null +++ b/apps/web/src/content/ko/docs/next-sitemap/installation.mdx @@ -0,0 +1,121 @@ +--- +title: 설치 +description: '@onruntime/next-sitemap을 설치하고 설정해줘' +--- +## 설치 + +선호하는 패키지 관리자를 사용해 패키지를 설치하세요: + +```bash +# npm +npm install @onruntime/next-sitemap + +# yarn +yarn add @onruntime/next-sitemap + +# pnpm +pnpm add @onruntime/next-sitemap +``` + +## 기본 설정 + +### 앱 라우터 (Next.js 13+) + +`app` 디렉토리에 `sitemap.ts` 파일을 생성하세요: + +```tsx +// app/sitemap.ts +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://your-domain.com", + }); +} +``` + +### robots.txt + +robots.txt 생성을 위한 `robots.ts` 파일을 생성하세요: + +```tsx +// app/robots.ts +import { generateRobots } from "@onruntime/next-sitemap/app"; + +export default function robots() { + return generateRobots({ + baseUrl: "https://your-domain.com", + }); +} +``` + +## 프로젝트 구조 + +설정 후, 당신의 프로젝트는 다음과 같이 보여야 해요: + + + + + + + + + + + + + + + + + + +## 설치 확인 + +개발 서버를 시작하고 방문하세요: + +- `http://localhost:3000/sitemap.xml` - 당신의 사이트맵 +- `http://localhost:3000/robots.txt` - 당신의 robots.txt + +사이트맵을 위한 생성된 XML과 robots.txt의 텍스트 내용을 볼 수 있어요. + + + 사이트맵은 빌드 시간에 발견된 모든 경로를 포함해요. 개발 중에는 현재의 경로 구조를 반영해요. + + +## 환경 변수 + +배포를 위해 기본 URL을 설정하세요: + +```env +# .env.production +NEXT_PUBLIC_SITE_URL=https://your-domain.com +``` + +그 후 설정에서 사용하세요: + +```tsx +// app/sitemap.ts +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: process.env.NEXT_PUBLIC_SITE_URL || "https://your-domain.com", + }); +} +``` + +## 다음 단계 + + + + + diff --git a/apps/web/src/content/ko/docs/translations/api.mdx b/apps/web/src/content/ko/docs/translations/api.mdx new file mode 100644 index 000000000..076f61242 --- /dev/null +++ b/apps/web/src/content/ko/docs/translations/api.mdx @@ -0,0 +1,194 @@ +--- +title: API 참조 +description: '@onruntime/translations에 대한 완벽한 API 문서' +--- +## TranslationsProvider + +당신의 애플리케이션을 감싸는 제공자 컴포넌트. + +```tsx +import { TranslationsProvider } from "@onruntime/translations/react"; + + + {children} + +``` + +### Props + +| Prop | Type | Required | Description | +|------|------|----------|-------------| +| `locale` | `string` | 예 | 현재 활성 로케일 | +| `locales` | `Record` | 예 | 모든 로케일 번역을 포함하는 객체 | +| `fallbackLocale` | `string` | 아니오 | 키가 없을 때 사용할 대체 로케일 | +| `children` | `ReactNode` | 예 | 자식 컴포넌트 | + +## useTranslation + +클라이언트 컴포넌트에서 번역에 접근하기 위한 훅. + +```tsx +const { t, locale, setLocale } = useTranslation("namespace"); +``` + +### Parameters + +| Parameter | Type | Required | Description | +|-----------|------|----------|-------------| +| `namespace` | `string` | 예 | 사용할 번역 네임스페이스 | + +### Returns + +| Property | Type | Description | +|----------|------|-------------| +| `t` | `(key: string, vars?: object) => string` | 번역 함수 | +| `locale` | `string` | 현재 로케일 | +| `setLocale` | `(locale: string) => void` | 로케일을 변경하는 함수 | + +### Example + +```tsx +const { t, locale, setLocale } = useTranslation("common"); + +// 기본 사용법 +t("greeting"); // "Hello" + +// 변수와 함께 +t("greeting_name", { name: "John" }); // "Hello, John!" + +// 중첩 키 +t("nav.home"); // "Home" + +// 로케일 변경 +setLocale("fr"); +``` + +## getTranslation + +서버 컴포넌트(Next.js)에서 번역에 접근하기 위한 비동기 함수. + +```tsx +const { t } = await getTranslation("namespace"); +``` + +### Parameters + +| Parameter | Type | Required | Description | +|-----------|------|----------|-------------| +| `namespace` | `string` | 예 | 사용할 번역 네임스페이스 | + +### Returns + +| Property | Type | Description | +|----------|------|-------------| +| `t` | `(key: string, vars?: object) => string` | 번역 함수 | +| `locale` | `string` | 현재 로케일 | + +### Example + +```tsx +// 서버 컴포넌트 +export default async function Page() { + const { t } = await getTranslation("common"); + + return

{t("title")}

; +} +``` + +## Link Component + +Next.js를 위한 로케일 인식 링크 컴포넌트. + +```tsx +import { Link } from "@onruntime/translations/next"; + +About +``` + +### Props + +Next.js `Link` 컴포넌트의 모든 props, 추가로: + +| Prop | Type | Default | Description | +|------|------|---------|-------------| +| `locale` | `string` | 현재 로케일 | 링크 로케일을 덮어씌움 | + +### Example + +```tsx +// 현재 로케일 사용 +About + +// 특정 로케일 강제 설정 +À propos +``` + +## Translation Function (t) + +`t` 함수는 번역된 문자열을 가져오는 데 사용됨. + +### Signature + +```tsx +t(key: string, variables?: Record): string +``` + +### Parameters + +| Parameter | Type | Description | +|-----------|------|-------------| +| `key` | `string` | 번역 키 (점 표기법 지원) | +| `variables` | `object` | 보간할 변수 | + +### Variable Interpolation + +```json +{ + "greeting": "Hello, {name}!", + "items": "You have {count} items" +} +``` + +```tsx +t("greeting", { name: "Alice" }); // "Hello, Alice!" +t("items", { count: 5 }); // "You have 5 items" +``` + +### Nested Keys + +```json +{ + "user": { + "profile": { + "title": "Profile" + } + } +} +``` + +```tsx +t("user.profile.title"); // "Profile" +``` + +## Type Definitions + +### TranslationNamespaces + +타입 안전한 번역을 위해 이 인터페이스를 확장하세요: + +```tsx +declare module "@onruntime/translations" { + interface TranslationNamespaces { + common: typeof import("./locales/en/common.json"); + auth: typeof import("./locales/en/auth.json"); + } +} +``` + + + 적절한 타입 정의가 있으면 번역 키에 대해 자동 완성 및 잘못된 키에 대한 컴파일 타임 오류를 받을 수 있어. + diff --git a/apps/web/src/content/ko/docs/translations/getting-started.mdx b/apps/web/src/content/ko/docs/translations/getting-started.mdx new file mode 100644 index 000000000..15945c5f8 --- /dev/null +++ b/apps/web/src/content/ko/docs/translations/getting-started.mdx @@ -0,0 +1,92 @@ +--- +title: 시작하기 +description: React와 Next.js를 위한 가벼운 타입 안전 국제화 라이브러리 +--- +## @onruntime/translations가 뭐예요? + +`@onruntime/translations`는 React와 Next.js 애플리케이션을 위해 설계된 가벼운 타입 안전 국제화(i18n) 라이브러리예요. 전체 TypeScript 지원을 통해 번역 관리에 간단한 API를 제공해요. + + + - TypeScript로 타입 안전한 번역 + - React와 Next.js(App Router) 지원 + - 네임스페이스 기반 조직 + - 변수 보간 + - 가볍고 성능이 뛰어남 + + +## 왜 사용해야 할까요? + +### 타입 안전성 + +잘못된 번역 키를 사용할 때 컴파일 시간 오류를 제공해요: + +```typescript +const { t } = useTranslation("common"); + +t("greeting"); // ✅ 유효한 키 +t("invalid_key"); // ❌ TypeScript 오류 +``` + +### 간단한 API + +모든 번역 요구를 위한 두 개의 훅만 필요해요: + +```typescript +// 클라이언트 컴포넌트 +const { t } = useTranslation("namespace"); + +// 서버 컴포넌트 (Next.js) +const { t } = await getTranslation("namespace"); +``` + +### 조직화된 번역 + +네임스페이스로 번역을 체계적으로 관리해요: + + + + + + + + + + + + + + + + +## 빠른 예시 + +```tsx +// locales/en/common.json +{ + "greeting": "Hello, {name}!" +} + +// 컴포넌트 +import { useTranslation } from "@onruntime/translations/react"; + +function Welcome({ name }) { + const { t } = useTranslation("common"); + + return

{t("greeting", { name })}

; +} +``` + +## 다음 단계 + + + + + diff --git a/apps/web/src/content/ko/docs/translations/installation.mdx b/apps/web/src/content/ko/docs/translations/installation.mdx new file mode 100644 index 000000000..1286d792c --- /dev/null +++ b/apps/web/src/content/ko/docs/translations/installation.mdx @@ -0,0 +1,127 @@ +--- +title: 설치 +description: '@onruntime/translations을 설치하고 설정해봐' +--- +## 설치 + +선호하는 패키지 관리자를 사용하여 패키지를 설치하세요: + +```bash +# npm +npm install @onruntime/translations + +# yarn +yarn add @onruntime/translations + +# pnpm +pnpm add @onruntime/translations +``` + +## 프로젝트 설정 + +### 1. 번역 파일 만들기 + +각 언어에 대한 번역 파일이 포함된 `locales` 디렉토리를 프로젝트에 만드세요: + + + + + + + + + + + + + + +예시 `locales/en/common.json`: + +```json +{ + "title": "환영합니다", + "greeting": "안녕하세요, {name}!", + "items": { + "one": "{count} 개 아이템", + "other": "{count} 개 아이템" + } +} +``` + +### 2. TypeScript 구성하기 (선택사항) + +타입 안전한 번역을 위해 타입 정의 파일을 만드세요: + +```typescript +// types/translations.d.ts +import "onruntime/translations"; + +declare module "@onruntime/translations" { + interface TranslationNamespaces { + common: typeof import("../locales/en/common.json"); + auth: typeof import("../locales/en/auth.json"); + } +} +``` + +### 3. Provider 설정하기 + +`TranslationsProvider`로 앱을 감싸세요: + +```tsx +// React를 위한 +import { TranslationsProvider } from "@onruntime/translations/react"; +import en from "./locales/en"; +import fr from "./locales/fr"; + +const locales = { en, fr }; + +function App() { + return ( + + + + ); +} +``` + + + Next.js와 App Router를 위해 권장 설정에 대한 [Next.js 사용법](/docs/translations/nextjs) 가이드를 확인하세요. + + +## 설치 확인하기 + +간단한 컴포넌트로 설정을 테스트하세요: + +```tsx +import { useTranslation } from "@onruntime/translations/react"; + +function TestComponent() { + const { t } = useTranslation("common"); + + return ( +
+

{t("title")}

+

{t("greeting", { name: "세계" })}

+
+ ); +} +``` + +번역이 제대로 렌더링되면 모든 준비가 완료된 거예요! + +## 다음 단계 + + + + + diff --git a/apps/web/src/content/ko/docs/translations/nextjs.mdx b/apps/web/src/content/ko/docs/translations/nextjs.mdx new file mode 100644 index 000000000..c70c88d5b --- /dev/null +++ b/apps/web/src/content/ko/docs/translations/nextjs.mdx @@ -0,0 +1,191 @@ +--- +title: Next.js 사용 +description: Next.js 앱 라우터와 @onruntime/translations 사용하기 +--- +## 앱 라우터 설정 + +### 1. 프로바이더 구성하기 + +번역 설정을 위해 프로바이더 파일을 생성하세요: + +```tsx +// app/providers.tsx +"use client"; + +import { TranslationsProvider } from "@onruntime/translations/react"; +import { ReactNode } from "react"; + +import en from "@/locales/en"; +import fr from "@/locales/fr"; + +const locales = { en, fr }; + +interface ProvidersProps { + children: ReactNode; + locale: string; +} + +export function Providers({ children, locale }: ProvidersProps) { + return ( + + {children} + + ); +} +``` + +### 2. 루트 레이아웃 설정하기 + +루트 레이아웃에서 프로바이더를 사용하세요: + +```tsx +// app/[locale]/layout.tsx +import { Providers } from "../providers"; + +export default function LocaleLayout({ + children, + params, +}: { + children: React.ReactNode; + params: { locale: string }; +}) { + return ( + + {children} + + ); +} +``` + +## 서버 컴포넌트 + +서버 컴포넌트에서 `getTranslation`을 사용하세요: + +```tsx +// app/[locale]/page.tsx +import { getTranslation } from "@/lib/translations.server"; + +export default async function HomePage() { + const { t } = await getTranslation("common"); + + return ( +
+

{t("title")}

+

{t("description")}

+
+ ); +} +``` + + + 서버 컴포넌트에서는 `getTranslation`을 사용하고 클라이언트 컴포넌트에서는 `useTranslation`을 사용하세요. + + +## 클라이언트 컴포넌트 + +클라이언트 컴포넌트에서 `useTranslation`을 사용하세요: + +```tsx +"use client"; + +import { useTranslation } from "@onruntime/translations/react"; + +export function LanguageSwitcher() { + const { locale, setLocale } = useTranslation("common"); + + return ( + + ); +} +``` + +## 로케일 기반 라우팅 + +### 미들웨어 설정 + +로케일 감지를 처리하기 위해 미들웨어를 설정하세요: + +```tsx +// middleware.ts +import { NextRequest, NextResponse } from "next/server"; + +const locales = ["en", "fr"]; +const defaultLocale = "en"; + +export function middleware(request: NextRequest) { + const pathname = request.nextUrl.pathname; + + // pathname에 로케일이 있는지 확인 + const pathnameHasLocale = locales.some( + (locale) => pathname.startsWith(`/${locale}/`) || pathname === `/${locale}` + ); + + if (pathnameHasLocale) return; + + // 기본 로케일로 리다이렉트 + return NextResponse.redirect( + new URL(`/${defaultLocale}${pathname}`, request.url) + ); +} + +export const config = { + matcher: ["/((?!api|_next|.*\\..*).*)"], +}; +``` + +## 정적 생성 + +모든 로케일에 대해 정적 페이지를 생성하세요: + +```tsx +// app/[locale]/page.tsx +export async function generateStaticParams() { + return [{ locale: "en" }, { locale: "fr" }]; +} +``` + +## 링크 컴포넌트 + +탐색을 위해 번역된 링크 컴포넌트를 사용하세요: + +```tsx +import { Link } from "@onruntime/translations/next"; + +function Navigation() { + return ( + + ); +} +``` + +`Link` 컴포넌트는 로케일 접두사를 자동으로 처리합니다. + +## 예시 프로젝트 구조 + + + + + + + + + + + + + + + + + + + + + + diff --git a/apps/web/src/content/ko/docs/translations/react.mdx b/apps/web/src/content/ko/docs/translations/react.mdx new file mode 100644 index 000000000..633f5f9ab --- /dev/null +++ b/apps/web/src/content/ko/docs/translations/react.mdx @@ -0,0 +1,157 @@ +--- +title: 리액트 사용법 +description: 리액트 애플리케이션에서 @onruntime/translations 사용하기 +--- +## 기본 사용법 + +### useTranslation 훅 + +`useTranslation` 훅은 React 컴포넌트에서 번역에 접근하는 주된 방법이야: + +```tsx +import { useTranslation } from "@onruntime/translations/react"; + +function MyComponent() { + const { t, locale } = useTranslation("common"); + + return ( +
+

현재 로케일: {locale}

+

{t("title")}

+
+ ); +} +``` + +### 변수 보간 + +번역에 변수를 전달해봐: + +```json +// locales/en/common.json +{ + "greeting": "안녕하세요, {name}!", + "items_count": "아이템이 {count}개 있어요" +} +``` + +```tsx +function Greeting({ name, itemCount }) { + const { t } = useTranslation("common"); + + return ( + <> +

{t("greeting", { name })}

+

{t("items_count", { count: itemCount })}

+ + ); +} +``` + +## 여러 네임스페이스 + +같은 컴포넌트에서 여러 네임스페이스를 사용할 수 있어: + +```tsx +function Dashboard() { + const { t: tCommon } = useTranslation("common"); + const { t: tDashboard } = useTranslation("dashboard"); + + return ( +
+

{tDashboard("title")}

+ +
+ ); +} +``` + +## 로케일 변경하기 + +`setLocale` 함수를 사용해서 현재 로케일을 변경해봐: + +```tsx +import { useTranslation } from "@onruntime/translations/react"; + +function LanguageSwitcher() { + const { locale, setLocale } = useTranslation("common"); + + return ( + + ); +} +``` + +## 중첩 키 + +점 표기법을 사용해서 중첩된 번역 키에 접근해봐: + +```json +// locales/en/common.json +{ + "nav": { + "home": "홈", + "about": "소개", + "contact": "연락처" + } +} +``` + +```tsx +function Navigation() { + const { t } = useTranslation("common"); + + return ( + + ); +} +``` + +## 모범 사례 + + + 모든 내용을 하나의 파일에 넣기보다는 기능이나 페이지별로 번역을 정리해. + + +### 추천 구조 + + + + + + + + + + + + +### 일관된 키 유지 + +모든 로케일에서 일관된 명명 규칙을 사용해: + +```json +// ✅ 좋음 - 일관된 구조 +{ + "page_title": "대시보드", + "actions": { + "save": "저장", + "cancel": "취소" + } +} + +// ❌ 피하기 - 일관되지 않음 +{ + "pageTitle": "대시보드", + "save_button": "저장", + "cancelBtn": "취소" +} +``` diff --git a/apps/web/src/content/nl/docs/gitmoji/emojis.mdx b/apps/web/src/content/nl/docs/gitmoji/emojis.mdx new file mode 100644 index 000000000..76ed021d4 --- /dev/null +++ b/apps/web/src/content/nl/docs/gitmoji/emojis.mdx @@ -0,0 +1,11 @@ +--- +title: Emoji-referentie +description: Volledige lijst van gitmojis +--- +We gebruiken [gitmoji](https://gitmoji.dev) om onze commits te categoriseren. Hier is de complete lijst van emoji's, hun code en beschrijving: + + + + + Gebruik de [gitmoji-cli](https://github.com/carloscuesta/gitmoji-cli) of de [VS Code extensie](https://marketplace.visualstudio.com/items?itemName=seatonjiang.gitmoji-vscode) voor een interactieve commit ervaring. + diff --git a/apps/web/src/content/nl/docs/gitmoji/getting-started.mdx b/apps/web/src/content/nl/docs/gitmoji/getting-started.mdx new file mode 100644 index 000000000..8287bcb96 --- /dev/null +++ b/apps/web/src/content/nl/docs/gitmoji/getting-started.mdx @@ -0,0 +1,91 @@ +--- +title: Aan de slag +description: Leer onze commit conventie +--- +We houden van een schone projectgeschiedenis. Onze commit-conventie is geïnspireerd op [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0) maar aangepast met [gitmoji](https://gitmoji.dev) om het visueler en leuker te maken. + +## Structuur + +De commit-bericht moet als volgt gestructureerd zijn en **in kleine letters**: + +``` + [(#)] + +[optionele body] + +[optionele footer(s)] +``` + +### Voorbeeld + +```bash +📝 update documentatie bijdragers + +- Voeg @jerembdn toe als bijdrager +- Voeg @younesbessa toe als bijdrager + +Co-authored-by: Younes Bessa +``` + +Meestal is een simpele one-liner genoeg: + +```bash +📝 update documentatie bijdragers +``` + +## Types + +We gebruiken de volgende commit-types: + +| Type | Beschrijving | +| --- | --- | +| `add` | Voeg een nieuwe functie toe | +| `fix` | Los een bug op | +| `improve` | Verbeter iets | +| `update` | Update iets | +| `remove` | Verwijder iets | +| `refactor` | Refactor iets | +| `rename` | Hernoem iets | +| `move` | Verplaats een bestand of map | +| `upgrade` | Upgrade afhankelijkheden | +| `downgrade` | Downgrade afhankelijkheden | + +## Beschrijving + +Schrijf beschrijvingen in **imperatieve modus** en **kleine letters**: + +```bash +# Goed +📝 update documentatie bijdragers + +# Slecht +📝 updated documentatie bijdragers + +# Slecht +📝 Update documentatie bijdragers +``` + +## Issue Nummer + +Koppel commits aan issues door het issue nummer toe te voegen: + +```bash +📝 update documentatie bijdragers (#123) +``` + +## Body + +Gebruik de body voor context en motivatie: + +```bash +📝 update documentatie bijdragers + +- Voeg @jerembdn toe als bijdrager +- Voeg @younesbessa toe als bijdrager + +Co-authored-by: Younes Bessa +``` + + + Elke commit moet een enkele logische verandering vertegenwoordigen. Meng geen niet-verwante veranderingen. + diff --git a/apps/web/src/content/nl/docs/gitmoji/with-ai.mdx b/apps/web/src/content/nl/docs/gitmoji/with-ai.mdx new file mode 100644 index 000000000..41544fc79 --- /dev/null +++ b/apps/web/src/content/nl/docs/gitmoji/with-ai.mdx @@ -0,0 +1,63 @@ +--- +title: Met AI +description: Gebruik gitmoji met Claude Code +--- +Installeer onze gitmoji plugin voor [Claude Code](https://claude.ai/code) om commits te genereren volgens de conventie. + +## Installeer de Plugin + +Voeg de onRuntime marketplace toe en installeer de plugin: + +```bash +# Voeg de onRuntime marketplace toe +/plugin marketplace add https://onruntime.com/plugins + +# Installeer de gitmoji plugin +/plugin install gitmoji@onruntime +``` + +Of installeer direct vanuit het menu: + +1. Voer `/plugin` uit in Claude Code +2. Ga naar het **Ontdekken** tabblad +3. Voeg de marketplace toe: `https://onruntime.com/plugins` +4. Zoek naar "gitmoji" en installeer + +## Gebruik + +Voer het `/commit` commando uit om een commit te maken: + +``` +/commit +``` + +``` +/commit fix de login bug +``` + +Claude Code zal je wijzigingen analyseren en een commit maken volgens de gitmoji conventie. + + + Het `/commit` commando haalt automatisch je git status en diff op om het juiste commit bericht te genereren. + + +## Alternatief: CLAUDE.md + +Als je de plugin liever niet installeert, voeg dit toe aan je project `CLAUDE.md`: + +```markdown +## Commit Conventie + +Gebruik gitmoji conventionele commits: + +\`\`\` + +\`\`\` + +Typen: add, fix, improve, update, remove, refactor, rename, move, upgrade, downgrade + +Regels: +- Schrijf in kleine letters +- Gebruik de gebiedende wijs ("add" niet "added") +- Eén logische wijziging per commit +``` diff --git a/apps/web/src/content/nl/docs/next-sitemap/api.mdx b/apps/web/src/content/nl/docs/next-sitemap/api.mdx new file mode 100644 index 000000000..93950e374 --- /dev/null +++ b/apps/web/src/content/nl/docs/next-sitemap/api.mdx @@ -0,0 +1,169 @@ +--- +title: API-referentie +description: Volledige API-documentatie voor @onruntime/next-sitemap +--- +## generateSitemap + +Genereert een sitemap voor jouw Next.js applicatie. + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +const sitemap = await generateSitemap(options); +``` + +### Opties + +| Optie | Type | Vereist | Beschrijving | +|-------|------|---------|--------------| +| `baseUrl` | `string` | Ja | De basis-URL van jouw site | +| `additionalPaths` | `SitemapEntry[]` | Nee | Extra URL's om op te nemen | +| `exclude` | `string[]` | Nee | Glob-patronen om uit te sluiten | +| `defaults` | `SitemapDefaults` | Nee | Standaardwaarden voor alle items | +| `locales` | `string[]` | Nee | Ondersteunde locaties | +| `defaultLocale` | `string` | Nee | Standaardlocatie | + +### SitemapEntry + +| Property | Type | Beschrijving | +|----------|------|--------------| +| `url` | `string` | Pagina-URL (relatief of absoluut) | +| `lastModified` | `Date \| string` | Laatste wijzigingsdatum | +| `changeFrequency` | `ChangeFrequency` | Hoe vaak de pagina verandert | +| `priority` | `number` | Prioriteit (0.0 - 1.0) | + +### ChangeFrequency + +```tsx +type ChangeFrequency = + | "always" + | "hourly" + | "daily" + | "weekly" + | "monthly" + | "yearly" + | "never"; +``` + +### Voorbeeld + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + const blogPosts = await fetchPosts(); + + return generateSitemap({ + baseUrl: "https://example.com", + defaults: { + changeFrequency: "weekly", + priority: 0.7, + }, + additionalPaths: blogPosts.map((post) => ({ + url: `/blog/${post.slug}`, + lastModified: post.updatedAt, + priority: 0.8, + })), + exclude: ["/admin/*", "/api/*"], + }); +} +``` + +## generateRobots + +Genereert een robots.txt bestand. + +```tsx +import { generateRobots } from "@onruntime/next-sitemap/app"; + +const robots = generateRobots(options); +``` + +### Opties + +| Optie | Type | Vereist | Beschrijving | +|-------|------|---------|--------------| +| `baseUrl` | `string` | Ja | De basis-URL van jouw site | +| `rules` | `RobotsRule[]` | Nee | Aangepaste robotsregels | +| `sitemap` | `string \| boolean` | Nee | Sitemap-URL of `false` om uit te sluiten | + +### RobotsRule + +| Property | Type | Beschrijving | +|----------|------|--------------| +| `userAgent` | `string` | Doelgebruikersagent | +| `allow` | `string \| string[]` | Toegestane paden | +| `disallow` | `string \| string[]` | Verboden paden | +| `crawlDelay` | `number` | Crawlvertraging in seconden | + +### Voorbeeld + +```tsx +import { generateRobots } from "@onruntime/next-sitemap/app"; + +export default function robots() { + return generateRobots({ + baseUrl: "https://example.com", + rules: [ + { + userAgent: "*", + allow: "/", + disallow: ["/admin/", "/private/"], + }, + { + userAgent: "Googlebot", + allow: "/", + crawlDelay: 1, + }, + ], + }); +} +``` + +## generateSitemapIndex + +Genereert een sitemapindex voor grote sites. + +```tsx +import { generateSitemapIndex } from "@onruntime/next-sitemap/app"; + +const index = await generateSitemapIndex(options); +``` + +### Opties + +| Optie | Type | Vereist | Beschrijving | +|-------|------|---------|--------------| +| `baseUrl` | `string` | Ja | De basis-URL van jouw site | +| `sitemapsPerFile` | `number` | Nee | URL's per sitemap (standaard: 5000) | + +### Voorbeeld + +```tsx +import { generateSitemapIndex } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemapIndex({ + baseUrl: "https://example.com", + sitemapsPerFile: 10000, + }); +} +``` + +## Type Exports + +Het pakket exporteert TypeScript-typen voor gemak: + +```tsx +import type { + SitemapEntry, + SitemapOptions, + RobotsOptions, + RobotsRule, + ChangeFrequency, +} from "@onruntime/next-sitemap"; +``` + + + Alle functies en opties zijn volledig getypeerd. Jouw IDE zal autocompleteren en type-checking bieden. + diff --git a/apps/web/src/content/nl/docs/next-sitemap/configuration.mdx b/apps/web/src/content/nl/docs/next-sitemap/configuration.mdx new file mode 100644 index 000000000..a1b28f5c2 --- /dev/null +++ b/apps/web/src/content/nl/docs/next-sitemap/configuration.mdx @@ -0,0 +1,176 @@ +--- +title: Configuratie +description: Stel @onruntime/next-sitemap in volgens jouw wensen +--- +## Basisconfiguratie + +De eenvoudigste configuratie vereist alleen je basis-URL: + +```tsx +// app/sitemap.ts +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + }); +} +``` + +## Geavanceerde configuratie + +### Aangepaste routes + +Voeg aangepaste routes of dynamische inhoud toe: + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + // Haal dynamische inhoud op + const posts = await fetchBlogPosts(); + + return generateSitemap({ + baseUrl: "https://example.com", + additionalPaths: posts.map((post) => ({ + url: `/blog/${post.slug}`, + lastModified: post.updatedAt, + changeFrequency: "weekly", + priority: 0.7, + })), + }); +} +``` + +### Routes uitsluiten + +Exclusief specifieke routes uit de sitemap: + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + exclude: [ + "/admin/*", + "/api/*", + "/private/*", + ], + }); +} +``` + +### Prioriteit en wijzigingsfrequentie + +Stel standaardwaarden in voor alle pagina's: + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + defaults: { + changeFrequency: "weekly", + priority: 0.7, + }, + }); +} +``` + +## robots.txt Configuratie + +### Basis robots.txt + +```tsx +// app/robots.ts +import { generateRobots } from "@onruntime/next-sitemap/app"; + +export default function robots() { + return generateRobots({ + baseUrl: "https://example.com", + }); +} +``` + +### Aangepaste regels + +```tsx +import { generateRobots } from "@onruntime/next-sitemap/app"; + +export default function robots() { + return generateRobots({ + baseUrl: "https://example.com", + rules: [ + { + userAgent: "*", + allow: "/", + disallow: ["/admin/", "/private/"], + }, + { + userAgent: "Googlebot", + allow: "/", + }, + ], + }); +} +``` + +## Internationalisatie + +### Meertalige sitemaps + +Ondersteun meerdere talen met alternatieven: + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +const locales = ["en", "fr", "de"]; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + locales, + defaultLocale: "en", + }); +} +``` + +Dit genereert URL's met `hreflang`-alternatieven: + +```xml + + https://example.com/en/about + + + + +``` + +## Gesplitste sitemaps + +Voor grote sites, split je sitemap in meerdere bestanden: + +```tsx +// app/sitemap/[id]/route.ts +import { generateSitemapIndex } from "@onruntime/next-sitemap/app"; + +export async function GET( + request: Request, + { params }: { params: { id: string } } +) { + const sitemaps = await generateSitemapIndex({ + baseUrl: "https://example.com", + sitemapsPerFile: 5000, + }); + + return new Response(sitemaps[parseInt(params.id)], { + headers: { "Content-Type": "application/xml" }, + }); +} +``` + + + Google raadt aan om sitemaps onder de 50 MB en 50.000 URL's te houden. Gebruik gesplitste sitemaps voor grotere sites. + diff --git a/apps/web/src/content/nl/docs/next-sitemap/getting-started.mdx b/apps/web/src/content/nl/docs/next-sitemap/getting-started.mdx new file mode 100644 index 000000000..1b11ee320 --- /dev/null +++ b/apps/web/src/content/nl/docs/next-sitemap/getting-started.mdx @@ -0,0 +1,86 @@ +--- +title: Aan de slag +description: Een sitemapgenerator voor Next.js-toepassingen +--- +## Wat is @onruntime/next-sitemap? + +`@onruntime/next-sitemap` is een krachtige sitemapgenerator die speciaal is ontworpen voor Next.js applicaties. Het genereert automatisch `sitemap.xml` en `robots.txt` bestanden voor je Next.js site. + + + - Automatische sitemap-generatie voor App Router + - Ondersteuning voor dynamische routes + - Configureerbare prioriteit en changefreq + - robots.txt generatie + - Ondersteuning voor meertalige sitemaps + + +## Waarom het Gebruiken? + +### SEO Optimalisatie + +Sitemaps helpen zoekmachines om je pagina's efficiënter te ontdekken en te indexeren: + +- **Snellere indexering** - Zoekmachines kunnen al je pagina's vinden +- **Betere crawling** - Informeer crawlers over pagina-updates +- **Prioriteitsaanwijzingen** - Leid crawlers naar belangrijke pagina's + +### Next.js Integratie + +Speciaal gebouwd voor Next.js, begrijpt het: + +- App Router structuur +- Dynamische routes +- Statische generatie +- Internationaal routeren + +## Snelle Voorbeeld + +```tsx +// app/sitemap.ts +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + }); +} +``` + +Dit genereert een complete sitemap inclusief al je statische en dynamische pagina's. + +## Geproduceerde Output + +Het pakket genereert standaard XML sitemaps: + +```xml + + + + https://example.com/ + 2024-01-15 + daily + 1.0 + + + https://example.com/about + 2024-01-10 + monthly + 0.8 + + +``` + +## Volgende Stappen + + + + + diff --git a/apps/web/src/content/nl/docs/next-sitemap/installation.mdx b/apps/web/src/content/nl/docs/next-sitemap/installation.mdx new file mode 100644 index 000000000..f8d7b0a36 --- /dev/null +++ b/apps/web/src/content/nl/docs/next-sitemap/installation.mdx @@ -0,0 +1,121 @@ +--- +title: Installatie +description: Installeer en stel @onruntime/next-sitemap in +--- +## Installatie + +Installeer het pakket met je favoriete package manager: + +```bash +# npm +npm install @onruntime/next-sitemap + +# yarn +yarn add @onruntime/next-sitemap + +# pnpm +pnpm add @onruntime/next-sitemap +``` + +## Basisinstelling + +### App Router (Next.js 13+) + +Maak een `sitemap.ts` bestand in je `app` directory: + +```tsx +// app/sitemap.ts +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://your-domain.com", + }); +} +``` + +### robots.txt + +Maak een `robots.ts` bestand voor de generatie van robots.txt: + +```tsx +// app/robots.ts +import { generateRobots } from "@onruntime/next-sitemap/app"; + +export default function robots() { + return generateRobots({ + baseUrl: "https://your-domain.com", + }); +} +``` + +## Projectstructuur + +Na de installatie zou je project er zo uit moeten zien: + + + + + + + + + + + + + + + + + + +## Verifiëren van installatie + +Start je ontwikkelingsserver en bezoek: + +- `http://localhost:3000/sitemap.xml` - Je sitemap +- `http://localhost:3000/robots.txt` - Je robots.txt + +Je zou de gegenereerde XML voor je sitemap en tekstinhoud voor robots.txt moeten zien. + + + De sitemap bevat alle routes die zijn ontdekt tijdens de bouwtijd. In ontwikkeling weerspiegelt het je huidige routerstructuur. + + +## Omgevingsvariabelen + +Voor productie, stel je basis-URL in: + +```env +# .env.production +NEXT_PUBLIC_SITE_URL=https://your-domain.com +``` + +Gebruik het dan in je configuratie: + +```tsx +// app/sitemap.ts +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: process.env.NEXT_PUBLIC_SITE_URL || "https://your-domain.com", + }); +} +``` + +## Volgende stappen + + + + + diff --git a/apps/web/src/content/nl/docs/translations/api.mdx b/apps/web/src/content/nl/docs/translations/api.mdx new file mode 100644 index 000000000..bf01d7413 --- /dev/null +++ b/apps/web/src/content/nl/docs/translations/api.mdx @@ -0,0 +1,194 @@ +--- +title: API Referentie +description: Volledige API-documentatie voor @onruntime/translations +--- +## TranslationsProvider + +De providercomponent die je applicatie omhult. + +```tsx +import { TranslationsProvider } from "@onruntime/translations/react"; + + + {children} + +``` + +### Props + +| Prop | Type | Vereist | Beschrijving | +|------|------|---------|--------------| +| `locale` | `string` | Ja | Huidige actieve locale | +| `locales` | `Record` | Ja | Object met alle locale vertalingen | +| `fallbackLocale` | `string` | Nee | Vervanglocale wanneer een sleutel ontbreekt | +| `children` | `ReactNode` | Ja | Kindcomponenten | + +## useTranslation + +Hook om toegang te krijgen tot vertalingen in clientcomponenten. + +```tsx +const { t, locale, setLocale } = useTranslation("namespace"); +``` + +### Parameters + +| Parameter | Type | Vereist | Beschrijving | +|-----------|------|---------|--------------| +| `namespace` | `string` | Ja | Te gebruiken vertalingsnamespace | + +### Returnt + +| Eigenschap | Type | Beschrijving | +|------------|------|--------------| +| `t` | `(key: string, vars?: object) => string` | Vertalingsfunctie | +| `locale` | `string` | Huidige locale | +| `setLocale` | `(locale: string) => void` | Functie om locale te veranderen | + +### Voorbeeld + +```tsx +const { t, locale, setLocale } = useTranslation("common"); + +// Basisgebruik +t("greeting"); // "Hallo" + +// Met variabelen +t("greeting_name", { name: "John" }); // "Hallo, John!" + +// Geneste sleutels +t("nav.home"); // "Home" + +// Verander locale +setLocale("fr"); +``` + +## getTranslation + +Asynchrone functie voor toegang tot vertalingen in servercomponenten (Next.js). + +```tsx +const { t } = await getTranslation("namespace"); +``` + +### Parameters + +| Parameter | Type | Vereist | Beschrijving | +|-----------|------|---------|--------------| +| `namespace` | `string` | Ja | Te gebruiken vertalingsnamespace | + +### Returnt + +| Eigenschap | Type | Beschrijving | +|------------|------|--------------| +| `t` | `(key: string, vars?: object) => string` | Vertalingsfunctie | +| `locale` | `string` | Huidige locale | + +### Voorbeeld + +```tsx +// Servercomponent +export default async function Page() { + const { t } = await getTranslation("common"); + + return

{t("title")}

; +} +``` + +## Link Component + +Locale-bewuste Link component voor Next.js. + +```tsx +import { Link } from "@onruntime/translations/next"; + +Over +``` + +### Props + +Alle props van de Next.js `Link` component, plus: + +| Prop | Type | Standaard | Beschrijving | +|------|------|-----------|--------------| +| `locale` | `string` | Huidige locale | Overschrijf de linklocale | + +### Voorbeeld + +```tsx +// Gebruikt de huidige locale +Over + +// Dwing specifieke locale af +À propos +``` + +## Translatie Functie (t) + +De `t` functie wordt gebruikt om vertaald strings op te halen. + +### Handtekening + +```tsx +t(key: string, variables?: Record): string +``` + +### Parameters + +| Parameter | Type | Beschrijving | +|-----------|------|--------------| +| `key` | `string` | Vertalingssleutel (ondersteunt puntnotatie) | +| `variables` | `object` | Variabelen om te interpoleren | + +### Variabele Interpolatie + +```json +{ + "greeting": "Hallo, {name}!", + "items": "Je hebt {count} items" +} +``` + +```tsx +t("greeting", { name: "Alice" }); // "Hallo, Alice!" +t("items", { count: 5 }); // "Je hebt 5 items" +``` + +### Geneste Sleutels + +```json +{ + "user": { + "profile": { + "title": "Profiel" + } + } +} +``` + +```tsx +t("user.profile.title"); // "Profiel" +``` + +## Type Definities + +### TranslationNamespaces + +Verleng deze interface voor type-veilige vertalingen: + +```tsx +declare module "@onruntime/translations" { + interface TranslationNamespaces { + common: typeof import("./locales/nl/common.json"); + auth: typeof import("./locales/nl/auth.json"); + } +} +``` + + + Met de juiste type definities krijg je autocomplete voor vertalingssleutels en compileertijdfouten voor ongeldige sleutels. + diff --git a/apps/web/src/content/nl/docs/translations/getting-started.mdx b/apps/web/src/content/nl/docs/translations/getting-started.mdx new file mode 100644 index 000000000..fb8e0525f --- /dev/null +++ b/apps/web/src/content/nl/docs/translations/getting-started.mdx @@ -0,0 +1,92 @@ +--- +title: Aan de slag +description: 'Een lichte, type-veilige internationalisatiebibliotheek voor React en Next.js' +--- +## Wat is @onruntime/translations? + +`@onruntime/translations` is een lichte, typeveilige internationalisatie (i18n) bibliotheek ontworpen voor React en Next.js applicaties. Het biedt een eenvoudige API voor het beheren van vertalingen met volledige TypeScript ondersteuning. + + + - Typeveilige vertalingen met TypeScript + - Ondersteuning voor React en Next.js (App Router) + - Namespace-gebaseerde organisatie + - Variabele interpolatie + - Lichtgewicht en performant + + +## Waarom Het Gebruiken? + +### Type Veiligheid + +Krijg compileertijdfouten bij het gebruik van ongeldige vertaalkeys: + +```typescript +const { t } = useTranslation("common"); + +t("greeting"); // ✅ Geldige key +t("invalid_key"); // ❌ TypeScript fout +``` + +### Eenvoudige API + +Slechts twee hooks voor al je vertaalbehoeften: + +```typescript +// Client Componenten +const { t } = useTranslation("namespace"); + +// Server Componenten (Next.js) +const { t } = await getTranslation("namespace"); +``` + +### Georganiseerde Vertalingen + +Houd je vertalingen georganiseerd met namespaces: + + + + + + + + + + + + + + + + +## Snelle Voorbeeld + +```tsx +// locales/en/common.json +{ + "greeting": "Hallo, {name}!" +} + +// Component +import { useTranslation } from "@onruntime/translations/react"; + +function Welcome({ name }) { + const { t } = useTranslation("common"); + + return

{t("greeting", { name })}

; +} +``` + +## Volgende Stappen + + + + + diff --git a/apps/web/src/content/nl/docs/translations/installation.mdx b/apps/web/src/content/nl/docs/translations/installation.mdx new file mode 100644 index 000000000..46bcb98c8 --- /dev/null +++ b/apps/web/src/content/nl/docs/translations/installation.mdx @@ -0,0 +1,127 @@ +--- +title: Installatie +description: Installeer en configureer @onruntime/translations +--- +## Installatie + +Installeer het pakket met je favoriete pakketbeheerder: + +```bash +# npm +npm install @onruntime/translations + +# yarn +yarn add @onruntime/translations + +# pnpm +pnpm add @onruntime/translations +``` + +## Project Setup + +### 1. Maak Vertalingsbestanden Aan + +Maak een `locales` map in je project met vertalingsbestanden voor elke taal: + + + + + + + + + + + + + + +Voorbeeld `locales/en/common.json`: + +```json +{ + "title": "Welkom", + "greeting": "Hallo, {name}!", + "items": { + "one": "{count} item", + "other": "{count} items" + } +} +``` + +### 2. Configureer TypeScript (Optioneel) + +Voor type-veilige vertalingen, maak een typedefinitiebestand aan: + +```typescript +// types/translations.d.ts +import "onruntime/translations"; + +declare module "@onruntime/translations" { + interface TranslationNamespaces { + common: typeof import("../locales/en/common.json"); + auth: typeof import("../locales/en/auth.json"); + } +} +``` + +### 3. Zet Provider Op + +Omring je app met de `TranslationsProvider`: + +```tsx +// Voor React +import { TranslationsProvider } from "@onruntime/translations/react"; +import en from "./locales/en"; +import fr from "./locales/fr"; + +const locales = { en, fr }; + +function App() { + return ( + + + + ); +} +``` + + + Voor Next.js met App Router, bekijk de [Next.js Usage](/docs/translations/nextjs) gids voor de aanbevolen setup. + + +## Installatie Verifiëren + +Test je setup met een eenvoudig component: + +```tsx +import { useTranslation } from "@onruntime/translations/react"; + +function TestComponent() { + const { t } = useTranslation("common"); + + return ( +
+

{t("title")}

+

{t("greeting", { name: "Wereld" })}

+
+ ); +} +``` + +Als je je vertalingen ziet weergegeven, ben je klaar om te gaan! + +## Volgende Stappen + + + + + diff --git a/apps/web/src/content/nl/docs/translations/nextjs.mdx b/apps/web/src/content/nl/docs/translations/nextjs.mdx new file mode 100644 index 000000000..5a5393f36 --- /dev/null +++ b/apps/web/src/content/nl/docs/translations/nextjs.mdx @@ -0,0 +1,191 @@ +--- +title: Next.js gebruik +description: Eenvoudig @onruntime/translations gebruiken met de Next.js App Router +--- +## Opzet voor App Router + +### 1. Configureer de Provider + +Maak een providers-bestand aan om vertalingen in te stellen: + +```tsx +// app/providers.tsx +"use client"; + +import { TranslationsProvider } from "@onruntime/translations/react"; +import { ReactNode } from "react"; + +import en from "@/locales/en"; +import fr from "@/locales/fr"; + +const locales = { en, fr }; + +interface ProvidersProps { + children: ReactNode; + locale: string; +} + +export function Providers({ children, locale }: ProvidersProps) { + return ( + + {children} + + ); +} +``` + +### 2. Stel de Hoofdlayout In + +Gebruik de provider in je hoofdlayout: + +```tsx +// app/[locale]/layout.tsx +import { Providers } from "../providers"; + +export default function LocaleLayout({ + children, + params, +}: { + children: React.ReactNode; + params: { locale: string }; +}) { + return ( + + {children} + + ); +} +``` + +## Servercomponenten + +Gebruik `getTranslation` voor Servercomponenten: + +```tsx +// app/[locale]/page.tsx +import { getTranslation } from "@/lib/translations.server"; + +export default async function HomePage() { + const { t } = await getTranslation("common"); + + return ( +
+

{t("title")}

+

{t("description")}

+
+ ); +} +``` + + + Gebruik `getTranslation` in Servercomponenten en `useTranslation` in Clientcomponenten. + + +## Clientcomponenten + +Gebruik `useTranslation` voor Clientcomponenten: + +```tsx +"use client"; + +import { useTranslation } from "@onruntime/translations/react"; + +export function LanguageSwitcher() { + const { locale, setLocale } = useTranslation("common"); + + return ( + + ); +} +``` + +## Lokalisatie-gebaseerde Routering + +### Middleware Instelling + +Stel middleware in om lokalisatie-detectie te verwerken: + +```tsx +// middleware.ts +import { NextRequest, NextResponse } from "next/server"; + +const locales = ["en", "fr"]; +const defaultLocale = "en"; + +export function middleware(request: NextRequest) { + const pathname = request.nextUrl.pathname; + + // Controleer of de pathname een lokalisatie heeft + const pathnameHasLocale = locales.some( + (locale) => pathname.startsWith(`/${locale}/`) || pathname === `/${locale}` + ); + + if (pathnameHasLocale) return; + + // Redirect naar de standaard lokalisatie + return NextResponse.redirect( + new URL(`/${defaultLocale}${pathname}`, request.url) + ); +} + +export const config = { + matcher: ["/((?!api|_next|.*\\..*).*)"], +}; +``` + +## Statische Generatie + +Genereer statische pagina's voor alle lokalisaties: + +```tsx +// app/[locale]/page.tsx +export async function generateStaticParams() { + return [{ locale: "en" }, { locale: "fr" }]; +} +``` + +## Link Component + +Gebruik de vertaalde Link component voor navigatie: + +```tsx +import { Link } from "@onruntime/translations/next"; + +function Navigation() { + return ( + + ); +} +``` + +De `Link` component verwerkt automatisch lokalisatie-voorvoegsels. + +## Voorbeeld Projectstructuur + + + + + + + + + + + + + + + + + + + + + + diff --git a/apps/web/src/content/nl/docs/translations/react.mdx b/apps/web/src/content/nl/docs/translations/react.mdx new file mode 100644 index 000000000..643d55beb --- /dev/null +++ b/apps/web/src/content/nl/docs/translations/react.mdx @@ -0,0 +1,157 @@ +--- +title: Gebruik van React +description: Gebruik van @onruntime/translations in React-applicaties +--- +## Basisgebruik + +### De useTranslation Hook + +De `useTranslation` hook is je belangrijkste manier om vertalingen in React-componenten te verkrijgen: + +```tsx +import { useTranslation } from "@onruntime/translations/react"; + +function MyComponent() { + const { t, locale } = useTranslation("common"); + + return ( +
+

Huidige taalinstelling: {locale}

+

{t("title")}

+
+ ); +} +``` + +### Variabele Interpolatie + +Stuur variabelen mee naar je vertalingen: + +```json +// locales/en/common.json +{ + "greeting": "Hallo, {name}!", + "items_count": "Je hebt {count} items" +} +``` + +```tsx +function Greeting({ name, itemCount }) { + const { t } = useTranslation("common"); + + return ( + <> +

{t("greeting", { name })}

+

{t("items_count", { count: itemCount })}

+ + ); +} +``` + +## Meerdere Namespaces + +Je kunt meerdere namespaces in dezelfde component gebruiken: + +```tsx +function Dashboard() { + const { t: tCommon } = useTranslation("common"); + const { t: tDashboard } = useTranslation("dashboard"); + + return ( +
+

{tDashboard("title")}

+ +
+ ); +} +``` + +## Taalinstelling Wijzigen + +Gebruik de `setLocale` functie om de huidige taalinstelling te wijzigen: + +```tsx +import { useTranslation } from "@onruntime/translations/react"; + +function LanguageSwitcher() { + const { locale, setLocale } = useTranslation("common"); + + return ( + + ); +} +``` + +## Geneste Sleutels + +Toegang tot geneste vertaal-sleutels met behulp van puntnotatie: + +```json +// locales/en/common.json +{ + "nav": { + "home": "Home", + "about": "Over", + "contact": "Contact" + } +} +``` + +```tsx +function Navigation() { + const { t } = useTranslation("common"); + + return ( + + ); +} +``` + +## Beste Praktijken + + + Organiseer vertalingen op functie of pagina in plaats van alles in één bestand te zetten. + + +### Aanbevolen Structuur + + + + + + + + + + + + +### Houd Sleutels Consistent + +Gebruik consistente naamgevingsconventies in alle locales: + +```json +// ✅ Goed - consistente structuur +{ + "page_title": "Dashboard", + "actions": { + "save": "Opslaan", + "cancel": "Annuleren" + } +} + +// ❌ Vermijd - inconsistent +{ + "pageTitle": "Dashboard", + "save_button": "Opslaan", + "cancelBtn": "Annuleren" +} +``` diff --git a/apps/web/src/content/pl/docs/gitmoji/emojis.mdx b/apps/web/src/content/pl/docs/gitmoji/emojis.mdx new file mode 100644 index 000000000..3695f0a7c --- /dev/null +++ b/apps/web/src/content/pl/docs/gitmoji/emojis.mdx @@ -0,0 +1,11 @@ +--- +title: Referencja Emoji +description: Pełna lista gitmojis +--- +Używamy [gitmoji](https://gitmoji.dev), żeby kategoryzować nasze commity. Oto pełna lista emotikonów, ich kodów i opisów: + + + + + Użyj [gitmoji-cli](https://github.com/carloscuesta/gitmoji-cli) lub [rozszerzenia VS Code](https://marketplace.visualstudio.com/items?itemName=seatonjiang.gitmoji-vscode), żeby mieć interaktywne doświadczenie z commitami. + diff --git a/apps/web/src/content/pl/docs/gitmoji/getting-started.mdx b/apps/web/src/content/pl/docs/gitmoji/getting-started.mdx new file mode 100644 index 000000000..c9a81ae84 --- /dev/null +++ b/apps/web/src/content/pl/docs/gitmoji/getting-started.mdx @@ -0,0 +1,91 @@ +--- +title: Zaczynamy +description: Poznaj naszą konwencję commitów +--- +Lubimy mieć czystą historię projektu. Nasza konwencja commitów jest inspirowana [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0), ale dostosowana z użyciem [gitmoji](https://gitmoji.dev), żeby było to bardziej wizualne i zabawne. + +## Struktura + +Wiadomość commit powinna być zbudowana w następujący sposób i **ma być napisana małymi literami**: + +``` + [(#)] + +[nieobowiązkowe ciało] + +[nieobowiązkowe stopki] +``` + +### Przykład + +```bash +📝 update documentation contributors + +- Dodaj @jerembdn jako współautora +- Dodaj @younesbessa jako współautora + +Co-authored-by: Younes Bessa +``` + +Z reguły wystarczy prosty jednowierszowy wpis: + +```bash +📝 update documentation contributors +``` + +## Typy + +Używamy następujących typów commitów: + +| Typ | Opis | +| --- | --- | +| `add` | Dodaj nową funkcjonalność | +| `fix` | Napraw błąd | +| `improve` | Popraw coś | +| `update` | Zaktualizuj coś | +| `remove` | Usuń coś | +| `refactor` | Przeorganizuj coś | +| `rename` | Zmień nazwę czegoś | +| `move` | Przenieś plik lub folder | +| `upgrade` | Zaktualizuj zależności | +| `downgrade` | Obniż zależności | + +## Opis + +Pisanie opisów w **trybie rozkazującym** i **małymi literami**: + +```bash +# Dobrze +📝 update documentation contributors + +# Źle +📝 updated documentation contributors + +# Źle +📝 Update documentation contributors +``` + +## Numer issue + +Połącz commity z issue, dodając numer issue: + +```bash +📝 update documentation contributors (#123) +``` + +## Ciało + +Użyj ciała do kontekstu i motywacji: + +```bash +📝 update documentation contributors + +- Dodaj @jerembdn jako współautora +- Dodaj @younesbessa jako współautora + +Co-authored-by: Younes Bessa +``` + + + Każdy commit powinien reprezentować jedną logiczną zmianę. Nie mieszaj niepowiązanych zmian. + diff --git a/apps/web/src/content/pl/docs/gitmoji/with-ai.mdx b/apps/web/src/content/pl/docs/gitmoji/with-ai.mdx new file mode 100644 index 000000000..964438933 --- /dev/null +++ b/apps/web/src/content/pl/docs/gitmoji/with-ai.mdx @@ -0,0 +1,63 @@ +--- +title: Z AI +description: Używaj gitmoji z Claude Code +--- +Zainstaluj naszą wtyczkę gitmoji do [Claude Code](https://claude.ai/code), aby generować commity zgodnie z konwencją. + +## Instalacja wtyczki + +Dodaj rynek onRuntime i zainstaluj wtyczkę: + +```bash +# Dodaj rynek onRuntime +/plugin marketplace add https://onruntime.com/plugins + +# Zainstaluj wtyczkę gitmoji +/plugin install gitmoji@onruntime +``` + +Lub zainstaluj bezpośrednio z menu: + +1. Uruchom `/plugin` w Claude Code +2. Przejdź do zakładki **Discover** +3. Dodaj rynek: `https://onruntime.com/plugins` +4. Wyszukaj "gitmoji" i zainstaluj + +## Użycie + +Uruchom komendę `/commit`, aby utworzyć commit: + +``` +/commit +``` + +``` +/commit napraw bug logowania +``` + +Claude Code przeanalizuje twoje zmiany i stworzy commit zgodny z konwencją gitmoji. + + + Komenda `/commit` automatycznie pobiera status git i różnice, aby wygenerować odpowiednią wiadomość commit. + + +## Alternatywa: CLAUDE.md + +Jeśli wolisz nie instalować wtyczki, dodaj to do pliku `CLAUDE.md` w swoim projekcie: + +```markdown +## Konwencja Commitów + +Użyj konwencjonalnych commitów gitmoji: + +\`\`\` + +\`\`\` + +Typy: add, fix, improve, update, remove, refactor, rename, move, upgrade, downgrade + +Zasady: +- Pisz małymi literami +- Używaj trybu rozkazującego ("add" a nie "added") +- Jedna logiczna zmiana na commit +``` diff --git a/apps/web/src/content/pl/docs/next-sitemap/api.mdx b/apps/web/src/content/pl/docs/next-sitemap/api.mdx new file mode 100644 index 000000000..7148f7cc5 --- /dev/null +++ b/apps/web/src/content/pl/docs/next-sitemap/api.mdx @@ -0,0 +1,169 @@ +--- +title: Dokumentacja API +description: Pełna dokumentacja API dla @onruntime/next-sitemap +--- +## generateSitemap + +Generuje mapę strony dla twojej aplikacji Next.js. + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +const sitemap = await generateSitemap(options); +``` + +### Opcje + +| Opcja | Typ | Wymagane | Opis | +|-------|-----|----------|------| +| `baseUrl` | `string` | Tak | Podstawowy adres URL twojej strony | +| `additionalPaths` | `SitemapEntry[]` | Nie | Dodatkowe adresy URL do uwzględnienia | +| `exclude` | `string[]` | Nie | Wzorce glob do wykluczenia | +| `defaults` | `SitemapDefaults` | Nie | Domyślne wartości dla wszystkich wpisów | +| `locales` | `string[]` | Nie | Wspierane locale | +| `defaultLocale` | `string` | Nie | Domyślne locale | + +### SitemapEntry + +| Właściwość | Typ | Opis | +|------------|-----|------| +| `url` | `string` | Adres URL strony (względny lub absolutny) | +| `lastModified` | `Date \| string` | Data ostatniej modyfikacji | +| `changeFrequency` | `ChangeFrequency` | Jak często strona się zmienia | +| `priority` | `number` | Priorytet (0.0 - 1.0) | + +### ChangeFrequency + +```tsx +type ChangeFrequency = + | "always" + | "hourly" + | "daily" + | "weekly" + | "monthly" + | "yearly" + | "never"; +``` + +### Przykład + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + const blogPosts = await fetchPosts(); + + return generateSitemap({ + baseUrl: "https://example.com", + defaults: { + changeFrequency: "weekly", + priority: 0.7, + }, + additionalPaths: blogPosts.map((post) => ({ + url: `/blog/${post.slug}`, + lastModified: post.updatedAt, + priority: 0.8, + })), + exclude: ["/admin/*", "/api/*"], + }); +} +``` + +## generateRobots + +Generuje plik robots.txt. + +```tsx +import { generateRobots } from "@onruntime/next-sitemap/app"; + +const robots = generateRobots(options); +``` + +### Opcje + +| Opcja | Typ | Wymagane | Opis | +|-------|-----|----------|------| +| `baseUrl` | `string` | Tak | Podstawowy adres URL twojej strony | +| `rules` | `RobotsRule[]` | Nie | Niestandardowe zasady dla robotów | +| `sitemap` | `string \| boolean` | Nie | Adres URL mapy strony lub `false` do wykluczenia | + +### RobotsRule + +| Właściwość | Typ | Opis | +|------------|-----|------| +| `userAgent` | `string` | Docelowy agent użytkownika | +| `allow` | `string \| string[]` | Dozwolone ścieżki | +| `disallow` | `string \| string[]` | Niedozwolone ścieżki | +| `crawlDelay` | `number` | Opóźnienie skanowania w sekundach | + +### Przykład + +```tsx +import { generateRobots } from "@onruntime/next-sitemap/app"; + +export default function robots() { + return generateRobots({ + baseUrl: "https://example.com", + rules: [ + { + userAgent: "*", + allow: "/", + disallow: ["/admin/", "/private/"], + }, + { + userAgent: "Googlebot", + allow: "/", + crawlDelay: 1, + }, + ], + }); +} +``` + +## generateSitemapIndex + +Generuje indeks mapy strony dla dużych stron. + +```tsx +import { generateSitemapIndex } from "@onruntime/next-sitemap/app"; + +const index = await generateSitemapIndex(options); +``` + +### Opcje + +| Opcja | Typ | Wymagane | Opis | +|-------|-----|----------|------| +| `baseUrl` | `string` | Tak | Podstawowy adres URL twojej strony | +| `sitemapsPerFile` | `number` | Nie | Adresy URL na mapę strony (domyślnie: 5000) | + +### Przykład + +```tsx +import { generateSitemapIndex } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemapIndex({ + baseUrl: "https://example.com", + sitemapsPerFile: 10000, + }); +} +``` + +## Eksporty Typów + +Pakiet eksportuje typy TypeScript dla wygody: + +```tsx +import type { + SitemapEntry, + SitemapOptions, + RobotsOptions, + RobotsRule, + ChangeFrequency, +} from "@onruntime/next-sitemap"; +``` + + + Wszystkie funkcje i opcje są w pełni typowane. Twoje IDE będzie oferować autouzupełnianie i sprawdzanie typów. + diff --git a/apps/web/src/content/pl/docs/next-sitemap/configuration.mdx b/apps/web/src/content/pl/docs/next-sitemap/configuration.mdx new file mode 100644 index 000000000..d7828c4a2 --- /dev/null +++ b/apps/web/src/content/pl/docs/next-sitemap/configuration.mdx @@ -0,0 +1,176 @@ +--- +title: Konfiguracja +description: Skonfiguruj @onruntime/next-sitemap według swoich potrzeb +--- +## Podstawowa konfiguracja + +Najprostsza konfiguracja wymaga tylko Twojego podstawowego URL-a: + +```tsx +// app/sitemap.ts +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + }); +} +``` + +## Zaawansowana konfiguracja + +### Niestandardowe trasy + +Dodaj niestandardowe trasy lub dynamiczne treści: + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + // Pobierz dynamiczne treści + const posts = await fetchBlogPosts(); + + return generateSitemap({ + baseUrl: "https://example.com", + additionalPaths: posts.map((post) => ({ + url: `/blog/${post.slug}`, + lastModified: post.updatedAt, + changeFrequency: "weekly", + priority: 0.7, + })), + }); +} +``` + +### Wykluczanie tras + +Wyklucz konkretne trasy z mapy witryny: + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + exclude: [ + "/admin/*", + "/api/*", + "/private/*", + ], + }); +} +``` + +### Priorytet i częstotliwość zmian + +Ustaw domyślne wartości dla wszystkich stron: + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + defaults: { + changeFrequency: "weekly", + priority: 0.7, + }, + }); +} +``` + +## Konfiguracja robots.txt + +### Podstawowy robots.txt + +```tsx +// app/robots.ts +import { generateRobots } from "@onruntime/next-sitemap/app"; + +export default function robots() { + return generateRobots({ + baseUrl: "https://example.com", + }); +} +``` + +### Niestandardowe zasady + +```tsx +import { generateRobots } from "@onruntime/next-sitemap/app"; + +export default function robots() { + return generateRobots({ + baseUrl: "https://example.com", + rules: [ + { + userAgent: "*", + allow: "/", + disallow: ["/admin/", "/private/"], + }, + { + userAgent: "Googlebot", + allow: "/", + }, + ], + }); +} +``` + +## Internacjonalizacja + +### Mapa witryn w wielu językach + +Obsługuj wiele języków z alternatywami: + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +const locales = ["en", "fr", "de"]; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + locales, + defaultLocale: "en", + }); +} +``` + +To generuje adresy URL z alternatywami `hreflang`: + +```xml + + https://example.com/en/about + + + + +``` + +## Podzielone mapy witryn + +Dla dużych witryn podziel swoją mapę witryn na wiele plików: + +```tsx +// app/sitemap/[id]/route.ts +import { generateSitemapIndex } from "@onruntime/next-sitemap/app"; + +export async function GET( + request: Request, + { params }: { params: { id: string } } +) { + const sitemaps = await generateSitemapIndex({ + baseUrl: "https://example.com", + sitemapsPerFile: 5000, + }); + + return new Response(sitemaps[parseInt(params.id)], { + headers: { "Content-Type": "application/xml" }, + }); +} +``` + + + Google zaleca utrzymywanie map witryn poniżej 50 MB i 50 000 adresów URL. Używaj podzielonych map witryn dla większych witryn. + diff --git a/apps/web/src/content/pl/docs/next-sitemap/getting-started.mdx b/apps/web/src/content/pl/docs/next-sitemap/getting-started.mdx new file mode 100644 index 000000000..8490852b0 --- /dev/null +++ b/apps/web/src/content/pl/docs/next-sitemap/getting-started.mdx @@ -0,0 +1,86 @@ +--- +title: Jak zacząć +description: Generator mapy witryny dla aplikacji Next.js +--- +## Co to jest @onruntime/next-sitemap? + +`@onruntime/next-sitemap` to potężny generator mapy witryny zaprojektowany specjalnie dla aplikacji Next.js. Automatycznie generuje pliki `sitemap.xml` i `robots.txt` dla Twojej witryny Next.js. + + + - Automatyczne generowanie mapy witryny dla App Router + - Wsparcie dla dynamicznych tras + - Konfigurowalny priorytet i changefreq + - Generowanie robots.txt + - Wsparcie dla wielojęzycznych map witryn + + +## Dlaczego warto to używać? + +### Optymalizacja SEO + +Mapy witryn pomagają wyszukiwarkom odkrywać i indeksować Twoje strony bardziej efektywnie: + +- **Szybsze indeksowanie** - Wyszukiwarki mogą znaleźć wszystkie Twoje strony +- **Lepsze przeszukiwanie** - Informuj roboty o aktualizacjach stron +- **Wskazówki dotyczące priorytetów** - Kieruj roboty do ważnych stron + +### Integracja z Next.js + +Zbudowany specjalnie dla Next.js, rozumie: + +- Strukturę App Router +- Dynamiczne trasy +- Generowanie statyczne +- Międzynarodowe trasowanie + +## Szybki przykład + +```tsx +// app/sitemap.ts +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + }); +} +``` + +To generuje kompletną mapę witryny zawierającą wszystkie Twoje statyczne i dynamiczne strony. + +## Wygenerowane wyjście + +Pakiet generuje standardowe XML mapy witryn: + +```xml + + + + https://example.com/ + 2024-01-15 + daily + 1.0 + + + https://example.com/about + 2024-01-10 + monthly + 0.8 + + +``` + +## Następne kroki + + + + + diff --git a/apps/web/src/content/pl/docs/next-sitemap/installation.mdx b/apps/web/src/content/pl/docs/next-sitemap/installation.mdx new file mode 100644 index 000000000..aec2520fd --- /dev/null +++ b/apps/web/src/content/pl/docs/next-sitemap/installation.mdx @@ -0,0 +1,121 @@ +--- +title: Instalacja +description: Zainstaluj i skonfiguruj @onruntime/next-sitemap +--- +## Instalacja + +Zainstaluj pakiet przy użyciu preferowanego menedżera pakietów: + +```bash +# npm +npm install @onruntime/next-sitemap + +# yarn +yarn add @onruntime/next-sitemap + +# pnpm +pnpm add @onruntime/next-sitemap +``` + +## Podstawowa konfiguracja + +### App Router (Next.js 13+) + +Utwórz plik `sitemap.ts` w swoim katalogu `app`: + +```tsx +// app/sitemap.ts +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://your-domain.com", + }); +} +``` + +### robots.txt + +Utwórz plik `robots.ts` do generacji robots.txt: + +```tsx +// app/robots.ts +import { generateRobots } from "@onruntime/next-sitemap/app"; + +export default function robots() { + return generateRobots({ + baseUrl: "https://your-domain.com", + }); +} +``` + +## Struktura projektu + +Po konfiguracji, twój projekt powinien wyglądać tak: + + + + + + + + + + + + + + + + + + +## Weryfikacja instalacji + +Uruchom swój serwer deweloperski i odwiedź: + +- `http://localhost:3000/sitemap.xml` - Twój sitemap +- `http://localhost:3000/robots.txt` - Twój robots.txt + +Powinieneś zobaczyć wygenerowany XML dla swojego sitemapu i tekst dla robots.txt. + + + Sitemap będzie zawierał wszystkie trasy odkryte w czasie budowy. W trybie deweloperskim odzwierciedla aktualną strukturę tras. + + +## Zmienne środowiskowe + +Dla produkcji ustaw swój podstawowy URL: + +```env +# .env.production +NEXT_PUBLIC_SITE_URL=https://your-domain.com +``` + +Następnie użyj go w swojej konfiguracji: + +```tsx +// app/sitemap.ts +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: process.env.NEXT_PUBLIC_SITE_URL || "https://your-domain.com", + }); +} +``` + +## Następne kroki + + + + + diff --git a/apps/web/src/content/pl/docs/translations/api.mdx b/apps/web/src/content/pl/docs/translations/api.mdx new file mode 100644 index 000000000..63631a8c6 --- /dev/null +++ b/apps/web/src/content/pl/docs/translations/api.mdx @@ -0,0 +1,194 @@ +--- +title: Dokumentacja API +description: Pełna dokumentacja API dla @onruntime/translations +--- +## TranslationsProvider + +Komponent dostarczający, który owija twoją aplikację. + +```tsx +import { TranslationsProvider } from "@onruntime/translations/react"; + + + {children} + +``` + +### Props + +| Prop | Typ | Wymagane | Opis | +|------|-----|----------|------| +| `locale` | `string` | Tak | Aktualny aktywny język | +| `locales` | `Record` | Tak | Obiekt zawierający wszystkie tłumaczenia językowe | +| `fallbackLocale` | `string` | Nie | Język zapasowy, gdy klucz jest niedostępny | +| `children` | `ReactNode` | Tak | Komponenty potomne | + +## useTranslation + +Hook do uzyskiwania tłumaczeń w komponentach klienckich. + +```tsx +const { t, locale, setLocale } = useTranslation("namespace"); +``` + +### Parametry + +| Parametr | Typ | Wymagane | Opis | +|----------|-----|----------|------| +| `namespace` | `string` | Tak | Przestrzeń nazw tłumaczeń do użycia | + +### Zwraca + +| Właściwość | Typ | Opis | +|------------|-----|------| +| `t` | `(key: string, vars?: object) => string` | Funkcja tłumacząca | +| `locale` | `string` | Aktualny język | +| `setLocale` | `(locale: string) => void` | Funkcja do zmiany języka | + +### Przykład + +```tsx +const { t, locale, setLocale } = useTranslation("common"); + +// Podstawowe użycie +t("greeting"); // "Cześć" + +// Z zmiennymi +t("greeting_name", { name: "Jan" }); // "Cześć, Janie!" + +// Zagnieżdżone klucze +t("nav.home"); // "Strona główna" + +// Zmień język +setLocale("fr"); +``` + +## getTranslation + +Asynchroniczna funkcja do uzyskiwania tłumaczeń w komponentach serwerowych (Next.js). + +```tsx +const { t } = await getTranslation("namespace"); +``` + +### Parametry + +| Parametr | Typ | Wymagane | Opis | +|----------|-----|----------|------| +| `namespace` | `string` | Tak | Przestrzeń nazw tłumaczeń do użycia | + +### Zwraca + +| Właściwość | Typ | Opis | +|------------|-----|------| +| `t` | `(key: string, vars?: object) => string` | Funkcja tłumacząca | +| `locale` | `string` | Aktualny język | + +### Przykład + +```tsx +// Komponent Serwerowy +export default async function Page() { + const { t } = await getTranslation("common"); + + return

{t("title")}

; +} +``` + +## Link Component + +Komponent Link rozumiejący język dla Next.js. + +```tsx +import { Link } from "@onruntime/translations/next"; + +O nas +``` + +### Props + +Wszystkie propsy z komponentu `Link` Next.js, plus: + +| Prop | Typ | Domyślnie | Opis | +|------|-----|-----------|------| +| `locale` | `string` | Aktualny język | Nadpisuje język linku | + +### Przykład + +```tsx +// Używa aktualnego języka +O nas + +// Wymusza konkretny język +À propos +``` + +## Funkcja Tłumaczenia (t) + +Funkcja `t` jest używana do pobierania przetłumaczonych ciągów. + +### Sygnatura + +```tsx +t(key: string, variables?: Record): string +``` + +### Parametry + +| Parametr | Typ | Opis | +|----------|-----|------| +| `key` | `string` | Klucz tłumaczenia (obsługuje notację kropkową) | +| `variables` | `object` | Zmienne do interpolacji | + +### Interpolacja Zmiennych + +```json +{ + "greeting": "Cześć, {name}!", + "items": "Masz {count} przedmiotów" +} +``` + +```tsx +t("greeting", { name: "Alicja" }); // "Cześć, Alicjo!" +t("items", { count: 5 }); // "Masz 5 przedmiotów" +``` + +### Zagnieżdżone Klucze + +```json +{ + "user": { + "profile": { + "title": "Profil" + } + } +} +``` + +```tsx +t("user.profile.title"); // "Profil" +``` + +## Definicje Typów + +### TranslationNamespaces + +Rozszerz ten interfejs dla typowanej translacji: + +```tsx +declare module "@onruntime/translations" { + interface TranslationNamespaces { + common: typeof import("./locales/pl/common.json"); + auth: typeof import("./locales/pl/auth.json"); + } +} +``` + + + Dzięki odpowiednim definicjom typów uzyskasz autouzupełnianie dla kluczy tłumaczeń i błędy kompilacji dla nieprawidłowych kluczy. + diff --git a/apps/web/src/content/pl/docs/translations/getting-started.mdx b/apps/web/src/content/pl/docs/translations/getting-started.mdx new file mode 100644 index 000000000..18acbfbf0 --- /dev/null +++ b/apps/web/src/content/pl/docs/translations/getting-started.mdx @@ -0,0 +1,94 @@ +--- +title: Zaczynamy +description: >- + Lekka, bezpieczna pod względem typów biblioteka do internacjonalizacji dla + React i Next.js +--- +## Co to jest @onruntime/translations? + +`@onruntime/translations` to lekka biblioteka do internacjonalizacji (i18n) zapewniająca typowanie, zaprojektowana dla aplikacji React i Next.js. Oferuje prosty interfejs API do zarządzania tłumaczeniami z pełnym wsparciem dla TypeScript. + + + - Tłumaczenia z typowaniem w TypeScript + - Wsparcie dla React i Next.js (App Router) + - Organizacja oparta na przestrzeniach nazw + - Interpolacja zmiennych + - Lekka i wydajna + + +## Dlaczego warto to używać? + +### Bezpieczeństwo typów + +Uzyskaj błędy kompilacji, gdy używasz nieprawidłowych kluczy tłumaczeń: + +```typescript +const { t } = useTranslation("common"); + +t("greeting"); // ✅ Prawidłowy klucz +t("invalid_key"); // ❌ Błąd TypeScript +``` + +### Prosty interfejs API + +Tylko dwa hooki dla wszystkich Twoich potrzeb związanych z tłumaczeniem: + +```typescript +// Komponenty klienckie +const { t } = useTranslation("namespace"); + +// Komponenty serwerowe (Next.js) +const { t } = await getTranslation("namespace"); +``` + +### Zorganizowane tłumaczenia + +Utrzymuj swoje tłumaczenia w porządku z przestrzeniami nazw: + + + + + + + + + + + + + + + + +## Szybki przykład + +```tsx +// locales/en/common.json +{ + "greeting": "Cześć, {name}!" +} + +// Komponent +import { useTranslation } from "@onruntime/translations/react"; + +function Welcome({ name }) { + const { t } = useTranslation("common"); + + return

{t("greeting", { name })}

; +} +``` + +## Następne kroki + + + + + diff --git a/apps/web/src/content/pl/docs/translations/installation.mdx b/apps/web/src/content/pl/docs/translations/installation.mdx new file mode 100644 index 000000000..f4c140bb5 --- /dev/null +++ b/apps/web/src/content/pl/docs/translations/installation.mdx @@ -0,0 +1,127 @@ +--- +title: Instalacja +description: Zainstaluj i skonfiguruj @onruntime/translations +--- +## Instalacja + +Zainstaluj pakiet za pomocą swojego ulubionego menedżera pakietów: + +```bash +# npm +npm install @onruntime/translations + +# yarn +yarn add @onruntime/translations + +# pnpm +pnpm add @onruntime/translations +``` + +## Ustawienie Projektu + +### 1. Utwórz Pliki Tłumaczeń + +Utwórz katalog `locales` w swoim projekcie z plikami tłumaczeń dla każdego języka: + + + + + + + + + + + + + + +Przykładowy plik `locales/en/common.json`: + +```json +{ + "title": "Witaj", + "greeting": "Cześć, {name}!", + "items": { + "one": "{count} item", + "other": "{count} items" + } +} +``` + +### 2. Skonfiguruj TypeScript (Opcjonalnie) + +Aby uzyskać typu bezpieczne tłumaczenia, utwórz plik definicji typu: + +```typescript +// types/translations.d.ts +import "onruntime/translations"; + +declare module "@onruntime/translations" { + interface TranslationNamespaces { + common: typeof import("../locales/en/common.json"); + auth: typeof import("../locales/en/auth.json"); + } +} +``` + +### 3. Skonfiguruj Provider + +Owiń swoją aplikację w `TranslationsProvider`: + +```tsx +// Dla React +import { TranslationsProvider } from "@onruntime/translations/react"; +import en from "./locales/en"; +import fr from "./locales/fr"; + +const locales = { en, fr }; + +function App() { + return ( + + + + ); +} +``` + + + Dla Next.js z App Router zajrzyj do przewodnika [Next.js Usage](/docs/translations/nextjs) w celu zalecanej konfiguracji. + + +## Weryfikacja Instalacji + +Przetestuj swoją konfigurację za pomocą prostego komponentu: + +```tsx +import { useTranslation } from "@onruntime/translations/react"; + +function TestComponent() { + const { t } = useTranslation("common"); + + return ( +
+

{t("title")}

+

{t("greeting", { name: "World" })}

+
+ ); +} +``` + +Jeśli zobaczysz swoje tłumaczenia, jesteś gotowy do działania! + +## Kolejne Kroki + + + + + diff --git a/apps/web/src/content/pl/docs/translations/nextjs.mdx b/apps/web/src/content/pl/docs/translations/nextjs.mdx new file mode 100644 index 000000000..a881a5dd0 --- /dev/null +++ b/apps/web/src/content/pl/docs/translations/nextjs.mdx @@ -0,0 +1,191 @@ +--- +title: Użycie Next.js +description: Korzystanie z @onruntime/translations z Next.js App Router +--- +## Konfiguracja Routera Aplikacji + +### 1. Skonfiguruj Dostawcę + +Utwórz plik dostawcy, aby ustawić tłumaczenia: + +```tsx +// app/providers.tsx +"use client"; + +import { TranslationsProvider } from "@onruntime/translations/react"; +import { ReactNode } from "react"; + +import en from "@/locales/en"; +import fr from "@/locales/fr"; + +const locales = { en, fr }; + +interface ProvidersProps { + children: ReactNode; + locale: string; +} + +export function Providers({ children, locale }: ProvidersProps) { + return ( + + {children} + + ); +} +``` + +### 2. Skonfiguruj Główny Układ + +Użyj dostawcy w swoim głównym układzie: + +```tsx +// app/[locale]/layout.tsx +import { Providers } from "../providers"; + +export default function LocaleLayout({ + children, + params, +}: { + children: React.ReactNode; + params: { locale: string }; +}) { + return ( + + {children} + + ); +} +``` + +## Komponenty Serwera + +Użyj `getTranslation` dla Komponentów Serwera: + +```tsx +// app/[locale]/page.tsx +import { getTranslation } from "@/lib/translations.server"; + +export default async function HomePage() { + const { t } = await getTranslation("common"); + + return ( +
+

{t("title")}

+

{t("description")}

+
+ ); +} +``` + + + Użyj `getTranslation` w Komponentach Serwera i `useTranslation` w Komponentach Klienta. + + +## Komponenty Klienta + +Użyj `useTranslation` dla Komponentów Klienta: + +```tsx +"use client"; + +import { useTranslation } from "@onruntime/translations/react"; + +export function LanguageSwitcher() { + const { locale, setLocale } = useTranslation("common"); + + return ( + + ); +} +``` + +## Routing oparty na Lokacji + +### Konfiguracja Middleware + +Skonfiguruj middleware do wykrywania lokacji: + +```tsx +// middleware.ts +import { NextRequest, NextResponse } from "next/server"; + +const locales = ["en", "fr"]; +const defaultLocale = "en"; + +export function middleware(request: NextRequest) { + const pathname = request.nextUrl.pathname; + + // Sprawdź, czy ścieżka zawiera lokalizację + const pathnameHasLocale = locales.some( + (locale) => pathname.startsWith(`/${locale}/`) || pathname === `/${locale}` + ); + + if (pathnameHasLocale) return; + + // Przekieruj do domyślnej lokalizacji + return NextResponse.redirect( + new URL(`/${defaultLocale}${pathname}`, request.url) + ); +} + +export const config = { + matcher: ["/((?!api|_next|.*\\..*).*)"], +}; +``` + +## Generacja Statyczna + +Generuj statyczne strony dla wszystkich lokalizacji: + +```tsx +// app/[locale]/page.tsx +export async function generateStaticParams() { + return [{ locale: "en" }, { locale: "fr" }]; +} +``` + +## Komponent Link + +Użyj przetłumaczonego komponentu Link do nawigacji: + +```tsx +import { Link } from "@onruntime/translations/next"; + +function Navigation() { + return ( + + ); +} +``` + +Komponent `Link` automatycznie obsługuje prefiks lokalizacji. + +## Przykładowa Struktura Projektu + + + + + + + + + + + + + + + + + + + + + + diff --git a/apps/web/src/content/pl/docs/translations/react.mdx b/apps/web/src/content/pl/docs/translations/react.mdx new file mode 100644 index 000000000..cdf2d807a --- /dev/null +++ b/apps/web/src/content/pl/docs/translations/react.mdx @@ -0,0 +1,157 @@ +--- +title: Wykorzystanie React +description: Używanie @onruntime/translations w aplikacjach React +--- +## Podstawowe użycie + +### Hook useTranslation + +Hook `useTranslation` to Twój główny sposób na dostęp do tłumaczeń w komponentach React: + +```tsx +import { useTranslation } from "@onruntime/translations/react"; + +function MyComponent() { + const { t, locale } = useTranslation("common"); + + return ( +
+

Aktualny język: {locale}

+

{t("title")}

+
+ ); +} +``` + +### Interpolacja Zmiennych + +Przekaż zmienne do swoich tłumaczeń: + +```json +// locales/en/common.json +{ + "greeting": "Cześć, {name}!", + "items_count": "Masz {count} przedmiotów" +} +``` + +```tsx +function Greeting({ name, itemCount }) { + const { t } = useTranslation("common"); + + return ( + <> +

{t("greeting", { name })}

+

{t("items_count", { count: itemCount })}

+ + ); +} +``` + +## Wiele przestrzeni nazw + +Możesz używać wielu przestrzeni nazw w tym samym komponencie: + +```tsx +function Dashboard() { + const { t: tCommon } = useTranslation("common"); + const { t: tDashboard } = useTranslation("dashboard"); + + return ( +
+

{tDashboard("title")}

+ +
+ ); +} +``` + +## Zmiana języka + +Użyj funkcji `setLocale`, aby zmienić aktualny język: + +```tsx +import { useTranslation } from "@onruntime/translations/react"; + +function LanguageSwitcher() { + const { locale, setLocale } = useTranslation("common"); + + return ( + + ); +} +``` + +## Zagnieżdżone klucze + +Uzyskaj dostęp do zagnieżdżonych kluczy tłumaczeń, używając notacji kropkowej: + +```json +// locales/en/common.json +{ + "nav": { + "home": "Strona główna", + "about": "O nas", + "contact": "Kontakt" + } +} +``` + +```tsx +function Navigation() { + const { t } = useTranslation("common"); + + return ( + + ); +} +``` + +## Najlepsze praktyki + + + Organizuj tłumaczenia według funkcji lub strony zamiast wszystkiego wkładać do jednego pliku. + + +### Zalecana struktura + + + + + + + + + + + + +### Utrzymuj spójność kluczy + +Używaj spójnych konwencji nazewnictwa we wszystkich lokalizacjach: + +```json +// ✅ Dobry - spójna struktura +{ + "page_title": "Dashboard", + "actions": { + "save": "Zapisz", + "cancel": "Anuluj" + } +} + +// ❌ Unikaj - niespójność +{ + "pageTitle": "Dashboard", + "save_button": "Zapisz", + "cancelBtn": "Anuluj" +} +``` diff --git a/apps/web/src/content/pt/docs/gitmoji/emojis.mdx b/apps/web/src/content/pt/docs/gitmoji/emojis.mdx new file mode 100644 index 000000000..b2dcc0cf3 --- /dev/null +++ b/apps/web/src/content/pt/docs/gitmoji/emojis.mdx @@ -0,0 +1,11 @@ +--- +title: Referência de Emojis +description: Lista completa de gitmojis +--- +Usamos [gitmoji](https://gitmoji.dev) para categorizar nossos commits. Aqui está a lista completa de emojis, seus códigos e descrições: + + + + + Use o [gitmoji-cli](https://github.com/carloscuesta/gitmoji-cli) ou a [extensão do VS Code](https://marketplace.visualstudio.com/items?itemName=seatonjiang.gitmoji-vscode) para uma experiência interativa de commit. + diff --git a/apps/web/src/content/pt/docs/gitmoji/getting-started.mdx b/apps/web/src/content/pt/docs/gitmoji/getting-started.mdx new file mode 100644 index 000000000..8e41ab749 --- /dev/null +++ b/apps/web/src/content/pt/docs/gitmoji/getting-started.mdx @@ -0,0 +1,91 @@ +--- +title: Começando +description: Aprenda nossa convenção de commits +--- +Nós gostamos de ter um histórico de projeto limpo. Nossa convenção de commits é inspirada pelo [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0) mas personalizada com [gitmoji](https://gitmoji.dev) para tornar tudo mais visual e divertido. + +## Estrutura + +A mensagem de commit deve ser estruturada da seguinte forma e **em minúsculas**: + +``` + [(#)] + +[corpo opcional] + +[rodapé(s) opcional(is)] +``` + +### Exemplo + +```bash +📝 atualizar colaboradores da documentação + +- Adicionar @jerembdn como colaborador +- Adicionar @younesbessa como colaborador + +Co-authored-by: Younes Bessa +``` + +Na maioria das vezes, uma linha simples é o suficiente: + +```bash +📝 atualizar colaboradores da documentação +``` + +## Tipos + +Usamos os seguintes tipos de commit: + +| Tipo | Descrição | +| --- | --- | +| `add` | Adicionar uma nova funcionalidade | +| `fix` | Corrigir um bug | +| `improve` | Melhorar algo | +| `update` | Atualizar algo | +| `remove` | Remover algo | +| `refactor` | Refatorar algo | +| `rename` | Renomear algo | +| `move` | Mover um arquivo ou pasta | +| `upgrade` | Atualizar dependências | +| `downgrade` | Rebaixar dependências | + +## Descrição + +Escreva descrições em **modo imperativo** e **minúsculas**: + +```bash +# Bom +📝 atualizar colaboradores da documentação + +# Ruim +📝 atualizado colaboradores da documentação + +# Ruim +📝 Atualizar colaboradores da documentação +``` + +## Número do Issue + +Vincule commits a issues adicionando o número do issue: + +```bash +📝 atualizar colaboradores da documentação (#123) +``` + +## Corpo + +Use o corpo para contexto e motivação: + +```bash +📝 atualizar colaboradores da documentação + +- Adicionar @jerembdn como colaborador +- Adicionar @younesbessa como colaborador + +Co-authored-by: Younes Bessa +``` + + + Cada commit deve representar uma única mudança lógica. Não misture mudanças não relacionadas. + diff --git a/apps/web/src/content/pt/docs/gitmoji/with-ai.mdx b/apps/web/src/content/pt/docs/gitmoji/with-ai.mdx new file mode 100644 index 000000000..b02d1eeb2 --- /dev/null +++ b/apps/web/src/content/pt/docs/gitmoji/with-ai.mdx @@ -0,0 +1,63 @@ +--- +title: Com IA +description: Use gitmoji com Claude Code +--- +Instale nosso plugin gitmoji para [Claude Code](https://claude.ai/code) para gerar commits seguindo a convenção. + +## Instalar o Plugin + +Adicione o marketplace do onRuntime e instale o plugin: + +```bash +# Adicione o marketplace do onRuntime +/plugin marketplace add https://onruntime.com/plugins + +# Instale o plugin gitmoji +/plugin install gitmoji@onruntime +``` + +Ou instale diretamente pelo menu: + +1. Execute `/plugin` no Claude Code +2. Vá para a aba **Descobrir** +3. Adicione o marketplace: `https://onruntime.com/plugins` +4. Procure por "gitmoji" e instale + +## Uso + +Execute o comando `/commit` para criar um commit: + +``` +/commit +``` + +``` +/commit corrigir o bug de login +``` + +O Claude Code analisará suas alterações e criará um commit seguindo a convenção gitmoji. + + + O comando `/commit` captura automaticamente seu status git e diff para gerar a mensagem de commit apropriada. + + +## Alternativa: CLAUDE.md + +Se você preferir não instalar o plugin, adicione isso ao `CLAUDE.md` do seu projeto: + +```markdown +## Convenção de Commits + +Use commits convencionais gitmoji: + +\`\`\` + +\`\`\` + +Tipos: adicionar, corrigir, melhorar, atualizar, remover, refatorar, renomear, mover, atualizar, reverter + +Regras: +- Escreva em letras minúsculas +- Use modo imperativo ("adicionar" não "adicionado") +- Uma mudança lógica por commit +``` diff --git a/apps/web/src/content/pt/docs/next-sitemap/api.mdx b/apps/web/src/content/pt/docs/next-sitemap/api.mdx new file mode 100644 index 000000000..98b6cb15e --- /dev/null +++ b/apps/web/src/content/pt/docs/next-sitemap/api.mdx @@ -0,0 +1,169 @@ +--- +title: Referência da API +description: Documentação completa da API para @onruntime/next-sitemap +--- +## generateSitemap + +Gera um sitemap para sua aplicação Next.js. + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +const sitemap = await generateSitemap(options); +``` + +### Opções + +| Opção | Tipo | Necessário | Descrição | +|-------|------|------------|-----------| +| `baseUrl` | `string` | Sim | A URL base do seu site | +| `additionalPaths` | `SitemapEntry[]` | Não | URLs adicionais para incluir | +| `exclude` | `string[]` | Não | Padrões globais para excluir | +| `defaults` | `SitemapDefaults` | Não | Valores padrão para todas as entradas | +| `locales` | `string[]` | Não | Locales suportadas | +| `defaultLocale` | `string` | Não | Locale padrão | + +### SitemapEntry + +| Propriedade | Tipo | Descrição | +|-------------|------|-----------| +| `url` | `string` | URL da página (relativa ou absoluta) | +| `lastModified` | `Date \| string` | Data da última modificação | +| `changeFrequency` | `ChangeFrequency` | Com que frequência a página muda | +| `priority` | `number` | Prioridade (0.0 - 1.0) | + +### ChangeFrequency + +```tsx +type ChangeFrequency = + | "always" + | "hourly" + | "daily" + | "weekly" + | "monthly" + | "yearly" + | "never"; +``` + +### Exemplo + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + const blogPosts = await fetchPosts(); + + return generateSitemap({ + baseUrl: "https://example.com", + defaults: { + changeFrequency: "weekly", + priority: 0.7, + }, + additionalPaths: blogPosts.map((post) => ({ + url: `/blog/${post.slug}`, + lastModified: post.updatedAt, + priority: 0.8, + })), + exclude: ["/admin/*", "/api/*"], + }); +} +``` + +## generateRobots + +Gera um arquivo robots.txt. + +```tsx +import { generateRobots } from "@onruntime/next-sitemap/app"; + +const robots = generateRobots(options); +``` + +### Opções + +| Opção | Tipo | Necessário | Descrição | +|-------|------|------------|-----------| +| `baseUrl` | `string` | Sim | A URL base do seu site | +| `rules` | `RobotsRule[]` | Não | Regras de robots personalizadas | +| `sitemap` | `string \| boolean` | Não | URL do sitemap ou `false` para excluir | + +### RobotsRule + +| Propriedade | Tipo | Descrição | +|-------------|------|-----------| +| `userAgent` | `string` | Agente de usuário alvo | +| `allow` | `string \| string[]` | Caminhos permitidos | +| `disallow` | `string \| string[]` | Caminhos não permitidos | +| `crawlDelay` | `number` | Atraso de rastreamento em segundos | + +### Exemplo + +```tsx +import { generateRobots } from "@onruntime/next-sitemap/app"; + +export default function robots() { + return generateRobots({ + baseUrl: "https://example.com", + rules: [ + { + userAgent: "*", + allow: "/", + disallow: ["/admin/", "/private/"], + }, + { + userAgent: "Googlebot", + allow: "/", + crawlDelay: 1, + }, + ], + }); +} +``` + +## generateSitemapIndex + +Gera um índice de sitemap para sites grandes. + +```tsx +import { generateSitemapIndex } from "@onruntime/next-sitemap/app"; + +const index = await generateSitemapIndex(options); +``` + +### Opções + +| Opção | Tipo | Necessário | Descrição | +|-------|------|------------|-----------| +| `baseUrl` | `string` | Sim | A URL base do seu site | +| `sitemapsPerFile` | `number` | Não | URLs por sitemap (padrão: 5000) | + +### Exemplo + +```tsx +import { generateSitemapIndex } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemapIndex({ + baseUrl: "https://example.com", + sitemapsPerFile: 10000, + }); +} +``` + +## Type Exports + +O pacote exporta tipos TypeScript para conveniência: + +```tsx +import type { + SitemapEntry, + SitemapOptions, + RobotsOptions, + RobotsRule, + ChangeFrequency, +} from "@onruntime/next-sitemap"; +``` + + + Todas as funções e opções estão totalmente tipadas. Seu IDE vai fornecer autocompletar e verificação de tipos. + diff --git a/apps/web/src/content/pt/docs/next-sitemap/configuration.mdx b/apps/web/src/content/pt/docs/next-sitemap/configuration.mdx new file mode 100644 index 000000000..37249b185 --- /dev/null +++ b/apps/web/src/content/pt/docs/next-sitemap/configuration.mdx @@ -0,0 +1,176 @@ +--- +title: Configuração +description: Configure @onruntime/next-sitemap de acordo com suas necessidades +--- +## Configuração Básica + +A configuração mais simples só requer sua URL base: + +```tsx +// app/sitemap.ts +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + }); +} +``` + +## Configuração Avançada + +### Rotas Personalizadas + +Adicione rotas personalizadas ou conteúdo dinâmico: + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + // Busque conteúdo dinâmico + const posts = await fetchBlogPosts(); + + return generateSitemap({ + baseUrl: "https://example.com", + additionalPaths: posts.map((post) => ({ + url: `/blog/${post.slug}`, + lastModified: post.updatedAt, + changeFrequency: "weekly", + priority: 0.7, + })), + }); +} +``` + +### Excluindo Rotas + +Exclua rotas específicas do sitemap: + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + exclude: [ + "/admin/*", + "/api/*", + "/private/*", + ], + }); +} +``` + +### Prioridade e Frequência de Mudança + +Defina valores padrão para todas as páginas: + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + defaults: { + changeFrequency: "weekly", + priority: 0.7, + }, + }); +} +``` + +## Configuração do robots.txt + +### robots.txt Básico + +```tsx +// app/robots.ts +import { generateRobots } from "@onruntime/next-sitemap/app"; + +export default function robots() { + return generateRobots({ + baseUrl: "https://example.com", + }); +} +``` + +### Regras Personalizadas + +```tsx +import { generateRobots } from "@onruntime/next-sitemap/app"; + +export default function robots() { + return generateRobots({ + baseUrl: "https://example.com", + rules: [ + { + userAgent: "*", + allow: "/", + disallow: ["/admin/", "/private/"], + }, + { + userAgent: "Googlebot", + allow: "/", + }, + ], + }); +} +``` + +## Internacionalização + +### Sitemaps Multilíngues + +Suporte a vários idiomas com alternativos: + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +const locales = ["en", "fr", "de"]; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + locales, + defaultLocale: "en", + }); +} +``` + +Isso gera URLs com alternativos `hreflang`: + +```xml + + https://example.com/en/about + + + + +``` + +## Sitemaps Divididos + +Para sites grandes, divida seu sitemap em vários arquivos: + +```tsx +// app/sitemap/[id]/route.ts +import { generateSitemapIndex } from "@onruntime/next-sitemap/app"; + +export async function GET( + request: Request, + { params }: { params: { id: string } } +) { + const sitemaps = await generateSitemapIndex({ + baseUrl: "https://example.com", + sitemapsPerFile: 5000, + }); + + return new Response(sitemaps[parseInt(params.id)], { + headers: { "Content-Type": "application/xml" }, + }); +} +``` + + + O Google recomenda manter sitemaps abaixo de 50MB e 50.000 URLs. Use sitemaps divididos para sites maiores. + diff --git a/apps/web/src/content/pt/docs/next-sitemap/getting-started.mdx b/apps/web/src/content/pt/docs/next-sitemap/getting-started.mdx new file mode 100644 index 000000000..2b69738e4 --- /dev/null +++ b/apps/web/src/content/pt/docs/next-sitemap/getting-started.mdx @@ -0,0 +1,86 @@ +--- +title: Começando +description: Um gerador de sitemap para aplicações Next.js +--- +## O que é @onruntime/next-sitemap? + +`@onruntime/next-sitemap` é um gerador de sitemap poderoso projetado especificamente para aplicações Next.js. Ele gera automaticamente os arquivos `sitemap.xml` e `robots.txt` para o seu site Next.js. + + + - Geração automática de sitemap para App Router + - Suporte para rotas dinâmicas + - Prioridade e mudança de frequência configuráveis + - Geração de robots.txt + - Suporte para sitemap multilíngue + + +## Por que Usar? + +### Otimização de SEO + +Sitemaps ajudam os motores de busca a descobrir e indexar suas páginas de forma mais eficiente: + +- **Indexação mais rápida** - Motores de busca conseguem encontrar todas as suas páginas +- **Melhor rastreamento** - Informe os crawlers sobre atualizações nas páginas +- **Dicas de prioridade** - Guie os crawlers para páginas importantes + +### Integração com Next.js + +Construído especificamente para Next.js, ele entende: + +- Estrutura do App Router +- Rotas dinâmicas +- Geração estática +- Roteamento internacionalizado + +## Exemplo Rápido + +```tsx +// app/sitemap.ts +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + }); +} +``` + +Isso gera um sitemap completo, incluindo todas as suas páginas estáticas e dinâmicas. + +## Saída Gerada + +O pacote gera sitemaps XML padrão: + +```xml + + + + https://example.com/ + 2024-01-15 + daily + 1.0 + + + https://example.com/about + 2024-01-10 + monthly + 0.8 + + +``` + +## Próximos Passos + + + + + diff --git a/apps/web/src/content/pt/docs/next-sitemap/installation.mdx b/apps/web/src/content/pt/docs/next-sitemap/installation.mdx new file mode 100644 index 000000000..dd7a5f476 --- /dev/null +++ b/apps/web/src/content/pt/docs/next-sitemap/installation.mdx @@ -0,0 +1,121 @@ +--- +title: Instalação +description: Instale e configure @onruntime/next-sitemap +--- +## Instalação + +Instale o pacote usando seu gerenciador de pacotes preferido: + +```bash +# npm +npm install @onruntime/next-sitemap + +# yarn +yarn add @onruntime/next-sitemap + +# pnpm +pnpm add @onruntime/next-sitemap +``` + +## Configuração Básica + +### App Router (Next.js 13+) + +Crie um arquivo `sitemap.ts` no seu diretório `app`: + +```tsx +// app/sitemap.ts +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://seu-domínio.com", + }); +} +``` + +### robots.txt + +Crie um arquivo `robots.ts` para a geração de robots.txt: + +```tsx +// app/robots.ts +import { generateRobots } from "@onruntime/next-sitemap/app"; + +export default function robots() { + return generateRobots({ + baseUrl: "https://seu-domínio.com", + }); +} +``` + +## Estrutura do Projeto + +Depois da configuração, seu projeto deve parecer com isso: + + + + + + + + + + + + + + + + + + +## Verificar Instalação + +Inicie seu servidor de desenvolvimento e visite: + +- `http://localhost:3000/sitemap.xml` - Seu sitemap +- `http://localhost:3000/robots.txt` - Seu robots.txt + +Você deve ver o XML gerado para o seu sitemap e o conteúdo de texto para o robots.txt. + + + O sitemap incluirá todas as rotas descobertas no momento da construção. Em desenvolvimento, ele reflete a estrutura de rotas atual. + + +## Variáveis de Ambiente + +Para produção, defina sua URL base: + +```env +# .env.production +NEXT_PUBLIC_SITE_URL=https://seu-domínio.com +``` + +Então use isso na sua configuração: + +```tsx +// app/sitemap.ts +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: process.env.NEXT_PUBLIC_SITE_URL || "https://seu-domínio.com", + }); +} +``` + +## Próximos Passos + + + + + diff --git a/apps/web/src/content/pt/docs/translations/api.mdx b/apps/web/src/content/pt/docs/translations/api.mdx new file mode 100644 index 000000000..46cea3abb --- /dev/null +++ b/apps/web/src/content/pt/docs/translations/api.mdx @@ -0,0 +1,194 @@ +--- +title: Referência da API +description: Documentação completa da API para @onruntime/translations +--- +## TranslationsProvider + +O componente provider que envolve sua aplicação. + +```tsx +import { TranslationsProvider } from "@onruntime/translations/react"; + + + {children} + +``` + +### Props + +| Prop | Tipo | Obrigatório | Descrição | +|------|------|-------------|-----------| +| `locale` | `string` | Sim | Locale ativo atual | +| `locales` | `Record` | Sim | Objeto contendo todas as traduções de locale | +| `fallbackLocale` | `string` | Não | Locale de fallback quando a chave está ausente | +| `children` | `ReactNode` | Sim | Componentes filhos | + +## useTranslation + +Hook para acessar traduções em componentes cliente. + +```tsx +const { t, locale, setLocale } = useTranslation("namespace"); +``` + +### Parâmetros + +| Parâmetro | Tipo | Obrigatório | Descrição | +|-----------|------|-------------|-----------| +| `namespace` | `string` | Sim | Namespace de tradução a ser usado | + +### Retorna + +| Propriedade | Tipo | Descrição | +|-------------|------|-----------| +| `t` | `(key: string, vars?: object) => string` | Função de tradução | +| `locale` | `string` | Locale atual | +| `setLocale` | `(locale: string) => void` | Função para mudar o locale | + +### Exemplo + +```tsx +const { t, locale, setLocale } = useTranslation("common"); + +// Uso básico +t("greeting"); // "Hello" + +// Com variáveis +t("greeting_name", { name: "John" }); // "Hello, John!" + +// Chaves aninhadas +t("nav.home"); // "Home" + +// Mudar locale +setLocale("fr"); +``` + +## getTranslation + +Função assíncrona para acessar traduções em componentes servidor (Next.js). + +```tsx +const { t } = await getTranslation("namespace"); +``` + +### Parâmetros + +| Parâmetro | Tipo | Obrigatório | Descrição | +|-----------|------|-------------|-----------| +| `namespace` | `string` | Sim | Namespace de tradução a ser usado | + +### Retorna + +| Propriedade | Tipo | Descrição | +|-------------|------|-----------| +| `t` | `(key: string, vars?: object) => string` | Função de tradução | +| `locale` | `string` | Locale atual | + +### Exemplo + +```tsx +// Componente Servidor +export default async function Page() { + const { t } = await getTranslation("common"); + + return

{t("title")}

; +} +``` + +## Link Component + +Componente Link consciente do Locale para Next.js. + +```tsx +import { Link } from "@onruntime/translations/next"; + +About +``` + +### Props + +Todas as props do componente `Link` do Next.js, mais: + +| Prop | Tipo | Padrão | Descrição | +|------|------|--------|-----------| +| `locale` | `string` | Locale atual | Sobrescreve o locale do link | + +### Exemplo + +```tsx +// Usa o locale atual +About + +// Força um locale específico +À propos +``` + +## Função de Tradução (t) + +A função `t` é usada para recuperar strings traduzidas. + +### Assinatura + +```tsx +t(key: string, variables?: Record): string +``` + +### Parâmetros + +| Parâmetro | Tipo | Descrição | +|-----------|------|-----------| +| `key` | `string` | Chave de tradução (suporta notação de ponto) | +| `variables` | `object` | Variáveis para interpolação | + +### Interpolação de Variáveis + +```json +{ + "greeting": "Hello, {name}!", + "items": "You have {count} items" +} +``` + +```tsx +t("greeting", { name: "Alice" }); // "Hello, Alice!" +t("items", { count: 5 }); // "You have 5 items" +``` + +### Chaves Aninhadas + +```json +{ + "user": { + "profile": { + "title": "Profile" + } + } +} +``` + +```tsx +t("user.profile.title"); // "Profile" +``` + +## Definições de Tipos + +### TranslationNamespaces + +Estenda esta interface para traduções seguras em termos de tipo: + +```tsx +declare module "@onruntime/translations" { + interface TranslationNamespaces { + common: typeof import("./locales/en/common.json"); + auth: typeof import("./locales/en/auth.json"); + } +} +``` + + + Com definições de tipo adequadas, você terá autocomplete para chaves de tradução e erros em tempo de compilação para chaves inválidas. + diff --git a/apps/web/src/content/pt/docs/translations/getting-started.mdx b/apps/web/src/content/pt/docs/translations/getting-started.mdx new file mode 100644 index 000000000..5b2be1481 --- /dev/null +++ b/apps/web/src/content/pt/docs/translations/getting-started.mdx @@ -0,0 +1,94 @@ +--- +title: Começando +description: >- + Uma biblioteca de internacionalização leve e segura para tipos, para React e + Next.js +--- +## O que é @onruntime/translations? + +`@onruntime/translations` é uma biblioteca leve e com segurança de tipo para internacionalização (i18n), projetada para aplicações React e Next.js. Ela fornece uma API simples para gerenciar traduções com suporte completo a TypeScript. + + + - Traduções seguras com TypeScript + - Suporte para React e Next.js (App Router) + - Organização baseada em namespaces + - Interpolação de variáveis + - Leve e performática + + +## Por Que Usar? + +### Segurança de Tipo + +Obtenha erros em tempo de compilação ao usar chaves de tradução inválidas: + +```typescript +const { t } = useTranslation("common"); + +t("greeting"); // ✅ Chave válida +t("invalid_key"); // ❌ Erro de TypeScript +``` + +### API Simples + +Apenas dois hooks para todas as suas necessidades de tradução: + +```typescript +// Componentes do Cliente +const { t } = useTranslation("namespace"); + +// Componentes do Servidor (Next.js) +const { t } = await getTranslation("namespace"); +``` + +### Traduções Organizadas + +Mantenha suas traduções organizadas com namespaces: + + + + + + + + + + + + + + + + +## Exemplo Rápido + +```tsx +// locales/en/common.json +{ + "greeting": "Hello, {name}!" +} + +// Componente +import { useTranslation } from "@onruntime/translations/react"; + +function Welcome({ name }) { + const { t } = useTranslation("common"); + + return

{t("greeting", { name })}

; +} +``` + +## Próximos Passos + + + + + diff --git a/apps/web/src/content/pt/docs/translations/installation.mdx b/apps/web/src/content/pt/docs/translations/installation.mdx new file mode 100644 index 000000000..8cc743cab --- /dev/null +++ b/apps/web/src/content/pt/docs/translations/installation.mdx @@ -0,0 +1,127 @@ +--- +title: Instalação +description: Instale e configure @onruntime/translations +--- +## Instalação + +Instale o pacote usando seu gerenciador de pacotes preferido: + +```bash +# npm +npm install @onruntime/translations + +# yarn +yarn add @onruntime/translations + +# pnpm +pnpm add @onruntime/translations +``` + +## Configuração do Projeto + +### 1. Criar Arquivos de Tradução + +Crie um diretório `locales` no seu projeto com arquivos de tradução para cada idioma: + + + + + + + + + + + + + + +Exemplo do `locales/en/common.json`: + +```json +{ + "title": "Bem-vindo", + "greeting": "Olá, {name}!", + "items": { + "one": "{count} item", + "other": "{count} itens" + } +} +``` + +### 2. Configurar TypeScript (Opcional) + +Para traduções com segurança de tipo, crie um arquivo de definição de tipo: + +```typescript +// types/translations.d.ts +import "onruntime/translations"; + +declare module "@onruntime/translations" { + interface TranslationNamespaces { + common: typeof import("../locales/en/common.json"); + auth: typeof import("../locales/en/auth.json"); + } +} +``` + +### 3. Configurar Provider + +Envolva seu app com o `TranslationsProvider`: + +```tsx +// Para React +import { TranslationsProvider } from "@onruntime/translations/react"; +import en from "./locales/en"; +import fr from "./locales/fr"; + +const locales = { en, fr }; + +function App() { + return ( + + + + ); +} +``` + + + Para Next.js com App Router, confira o guia de [Uso do Next.js](/docs/translations/nextjs) para a configuração recomendada. + + +## Verificando a Instalação + +Teste sua configuração com um componente simples: + +```tsx +import { useTranslation } from "@onruntime/translations/react"; + +function TestComponent() { + const { t } = useTranslation("common"); + + return ( +
+

{t("title")}

+

{t("greeting", { name: "World" })}

+
+ ); +} +``` + +Se você ver suas traduções sendo exibidas, está tudo certo! + +## Próximos Passos + + + + + diff --git a/apps/web/src/content/pt/docs/translations/nextjs.mdx b/apps/web/src/content/pt/docs/translations/nextjs.mdx new file mode 100644 index 000000000..bfdc22fb4 --- /dev/null +++ b/apps/web/src/content/pt/docs/translations/nextjs.mdx @@ -0,0 +1,191 @@ +--- +title: Uso do Next.js +description: Usando @onruntime/translations com o Next.js App Router +--- +## Configuração para App Router + +### 1. Configure o Provider + +Crie um arquivo de providers para configurar traduções: + +```tsx +// app/providers.tsx +"use client"; + +import { TranslationsProvider } from "@onruntime/translations/react"; +import { ReactNode } from "react"; + +import en from "@/locales/en"; +import fr from "@/locales/fr"; + +const locales = { en, fr }; + +interface ProvidersProps { + children: ReactNode; + locale: string; +} + +export function Providers({ children, locale }: ProvidersProps) { + return ( + + {children} + + ); +} +``` + +### 2. Configure o Layout Raiz + +Use o provider no seu layout raiz: + +```tsx +// app/[locale]/layout.tsx +import { Providers } from "../providers"; + +export default function LocaleLayout({ + children, + params, +}: { + children: React.ReactNode; + params: { locale: string }; +}) { + return ( + + {children} + + ); +} +``` + +## Componentes do Servidor + +Use `getTranslation` para Componentes do Servidor: + +```tsx +// app/[locale]/page.tsx +import { getTranslation } from "@/lib/translations.server"; + +export default async function HomePage() { + const { t } = await getTranslation("common"); + + return ( +
+

{t("title")}

+

{t("description")}

+
+ ); +} +``` + + + Use `getTranslation` em Componentes do Servidor e `useTranslation` em Componentes do Cliente. + + +## Componentes do Cliente + +Use `useTranslation` para Componentes do Cliente: + +```tsx +"use client"; + +import { useTranslation } from "@onruntime/translations/react"; + +export function LanguageSwitcher() { + const { locale, setLocale } = useTranslation("common"); + + return ( + + ); +} +``` + +## Roteamento Baseado em Locale + +### Configuração do Middleware + +Configure o middleware para lidar com a detecção de locale: + +```tsx +// middleware.ts +import { NextRequest, NextResponse } from "next/server"; + +const locales = ["en", "fr"]; +const defaultLocale = "en"; + +export function middleware(request: NextRequest) { + const pathname = request.nextUrl.pathname; + + // Verifique se o pathname tem um locale + const pathnameHasLocale = locales.some( + (locale) => pathname.startsWith(`/${locale}/`) || pathname === `/${locale}` + ); + + if (pathnameHasLocale) return; + + // Redirecionar para o locale padrão + return NextResponse.redirect( + new URL(`/${defaultLocale}${pathname}`, request.url) + ); +} + +export const config = { + matcher: ["/((?!api|_next|.*\\..*).*)"], +}; +``` + +## Geração Estática + +Gere páginas estáticas para todos os locales: + +```tsx +// app/[locale]/page.tsx +export async function generateStaticParams() { + return [{ locale: "en" }, { locale: "fr" }]; +} +``` + +## Componente Link + +Use o componente Link traduzido para navegação: + +```tsx +import { Link } from "@onruntime/translations/next"; + +function Navigation() { + return ( + + ); +} +``` + +O componente `Link` cuida automaticamente do prefixo do locale. + +## Estrutura do Projeto de Exemplo + + + + + + + + + + + + + + + + + + + + + + diff --git a/apps/web/src/content/pt/docs/translations/react.mdx b/apps/web/src/content/pt/docs/translations/react.mdx new file mode 100644 index 000000000..210aa715c --- /dev/null +++ b/apps/web/src/content/pt/docs/translations/react.mdx @@ -0,0 +1,157 @@ +--- +title: Uso do React +description: Usando @onruntime/translations em aplicações React +--- +## Uso Básico + +### O Hook useTranslation + +O hook `useTranslation` é sua principal forma de acessar traduções em componentes React: + +```tsx +import { useTranslation } from "@onruntime/translations/react"; + +function MyComponent() { + const { t, locale } = useTranslation("common"); + + return ( +
+

Localização atual: {locale}

+

{t("title")}

+
+ ); +} +``` + +### Interpolação de Variáveis + +Passe variáveis para suas traduções: + +```json +// locales/en/common.json +{ + "greeting": "Olá, {name}!", + "items_count": "Você tem {count} itens" +} +``` + +```tsx +function Greeting({ name, itemCount }) { + const { t } = useTranslation("common"); + + return ( + <> +

{t("greeting", { name })}

+

{t("items_count", { count: itemCount })}

+ + ); +} +``` + +## Múltiplos Namespaces + +Você pode usar múltiplos namespaces no mesmo componente: + +```tsx +function Dashboard() { + const { t: tCommon } = useTranslation("common"); + const { t: tDashboard } = useTranslation("dashboard"); + + return ( +
+

{tDashboard("title")}

+ +
+ ); +} +``` + +## Mudando a Localização + +Use a função `setLocale` para mudar a localização atual: + +```tsx +import { useTranslation } from "@onruntime/translations/react"; + +function LanguageSwitcher() { + const { locale, setLocale } = useTranslation("common"); + + return ( + + ); +} +``` + +## Chaves Aninhadas + +Acesse chaves de tradução aninhadas usando a notação de ponto: + +```json +// locales/en/common.json +{ + "nav": { + "home": "Início", + "about": "Sobre", + "contact": "Contato" + } +} +``` + +```tsx +function Navigation() { + const { t } = useTranslation("common"); + + return ( + + ); +} +``` + +## Melhores Práticas + + + Organize as traduções por funcionalidade ou página em vez de colocar tudo em um único arquivo. + + +### Estrutura Recomendada + + + + + + + + + + + + +### Mantenha as Chaves Consistentes + +Use convenções de nomenclatura consistentes em todas as localizações: + +```json +// ✅ Bom - estrutura consistente +{ + "page_title": "Painel", + "actions": { + "save": "Salvar", + "cancel": "Cancelar" + } +} + +// ❌ Evite - inconsistente +{ + "pageTitle": "Painel", + "save_button": "Salvar", + "cancelBtn": "Cancelar" +} +``` diff --git a/apps/web/src/content/sv/docs/gitmoji/emojis.mdx b/apps/web/src/content/sv/docs/gitmoji/emojis.mdx new file mode 100644 index 000000000..8cfbd04fe --- /dev/null +++ b/apps/web/src/content/sv/docs/gitmoji/emojis.mdx @@ -0,0 +1,11 @@ +--- +title: Emoji referens +description: Fullständig lista över gitmojis +--- +Vi använder [gitmoji](https://gitmoji.dev) för att kategorisera våra commits. Här är hela listan över emojis, deras kod och beskrivning: + + + + + Använd [gitmoji-cli](https://github.com/carloscuesta/gitmoji-cli) eller [VS Code-tillägget](https://marketplace.visualstudio.com/items?itemName=seatonjiang.gitmoji-vscode) för en interaktiv commit-upplevelse. + diff --git a/apps/web/src/content/sv/docs/gitmoji/getting-started.mdx b/apps/web/src/content/sv/docs/gitmoji/getting-started.mdx new file mode 100644 index 000000000..10e9e9c17 --- /dev/null +++ b/apps/web/src/content/sv/docs/gitmoji/getting-started.mdx @@ -0,0 +1,91 @@ +--- +title: Kom igång +description: Lär dig vår commits konvention +--- +Vi gillar att ha en ren projekt­historik. Vår commit­konvention är inspirerad av [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0) men anpassad med [gitmoji](https://gitmoji.dev) för att göra det mer visuellt och roligt. + +## Struktur + +Commitmeddelandet ska struktureras som följer och **i gemener**: + +``` + [(#)] + +[optional body] + +[optional footer(s)] +``` + +### Exempel + +```bash +📝 uppdatera dokumentation bidragsgivare + +- Lägg till @jerembdn som en bidragsgivare +- Lägg till @younesbessa som en bidragsgivare + +Co-authored-by: Younes Bessa +``` + +För det mesta räcker det med en enkel rad: + +```bash +📝 uppdatera dokumentation bidragsgivare +``` + +## Typer + +Vi använder följande committyper: + +| Typ | Beskrivning | +| --- | --- | +| `add` | Lägg till en ny funktion | +| `fix` | Fix en bugg | +| `improve` | Förbättra något | +| `update` | Uppdatera något | +| `remove` | Ta bort något | +| `refactor` | Refaktorisera något | +| `rename` | Byt namn på något | +| `move` | Flytta en fil eller mapp | +| `upgrade` | Uppgradera beroenden | +| `downgrade` | Nedgradera beroenden | + +## Beskrivning + +Skriv beskrivningar i **imperativform** och **gemener**: + +```bash +# Bra +📝 uppdatera dokumentation bidragsgivare + +# Dåligt +📝 uppdaterad dokumentation bidragsgivare + +# Dåligt +📝 Uppdatera dokumentation bidragsgivare +``` + +## Ärendenummer + +Länka commits till ärenden genom att lägga till ärendenumret: + +```bash +📝 uppdatera dokumentation bidragsgivare (#123) +``` + +## Kropp + +Använd kroppen för kontext och motivation: + +```bash +📝 uppdatera dokumentation bidragsgivare + +- Lägg till @jerembdn som en bidragsgivare +- Lägg till @younesbessa som en bidragsgivare + +Co-authored-by: Younes Bessa +``` + + + Varje commit bör representera en enda logisk förändring. Blanda inte orelaterade förändringar. + diff --git a/apps/web/src/content/sv/docs/gitmoji/with-ai.mdx b/apps/web/src/content/sv/docs/gitmoji/with-ai.mdx new file mode 100644 index 000000000..386ce5828 --- /dev/null +++ b/apps/web/src/content/sv/docs/gitmoji/with-ai.mdx @@ -0,0 +1,63 @@ +--- +title: Med AI +description: Använd gitmoji med Claude Code +--- +Installera vår gitmoji-plugin för [Claude Code](https://claude.ai/code) för att generera commits enligt konventionen. + +## Installera Plugin + +Lägg till onRuntime-marknadsplatsen och installera plugin: + +```bash +# Lägg till onRuntime-marknadsplatsen +/plugin marketplace add https://onruntime.com/plugins + +# Installera gitmoji-plugin +/plugin install gitmoji@onruntime +``` + +Eller installera direkt från menyn: + +1. Kör `/plugin` i Claude Code +2. Gå till **Discover** fliken +3. Lägg till marknadsplats: `https://onruntime.com/plugins` +4. Sök efter "gitmoji" och installera + +## Användning + +Kör kommandot `/commit` för att skapa en commit: + +``` +/commit +``` + +``` +/commit fix the login bug +``` + +Claude Code kommer att analysera dina ändringar och skapa en commit enligt gitmoji-konventionen. + + + Kommandot `/commit` hämtar automatiskt ditt git-status och diff för att generera rätt commit-meddelande. + + +## Alternativ: CLAUDE.md + +Om du föredrar att inte installera plugin, lägg till detta i ditt projekts `CLAUDE.md`: + +```markdown +## Commit Konvention + +Använd gitmoji konventionella commits: + +\`\`\` + +\`\`\` + +Typer: add, fix, improve, update, remove, refactor, rename, move, upgrade, downgrade + +Regler: +- Skriv med små bokstäver +- Använd imperativ form ("add" inte "added") +- En logisk ändring per commit +``` diff --git a/apps/web/src/content/sv/docs/next-sitemap/api.mdx b/apps/web/src/content/sv/docs/next-sitemap/api.mdx new file mode 100644 index 000000000..f3fdf7cef --- /dev/null +++ b/apps/web/src/content/sv/docs/next-sitemap/api.mdx @@ -0,0 +1,169 @@ +--- +title: API-referens +description: Komplett API-dokumentation för @onruntime/next-sitemap +--- +## generateSitemap + +Genererar en sitemap för din Next.js-applikation. + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +const sitemap = await generateSitemap(options); +``` + +### Options + +| Option | Typ | Obligatorisk | Beskrivning | +|--------|------|--------------|-------------| +| `baseUrl` | `string` | Ja | Din sidas bas-URL | +| `additionalPaths` | `SitemapEntry[]` | Nej | Ytterligare URL:er att inkludera | +| `exclude` | `string[]` | Nej | Glob-mönster att utesluta | +| `defaults` | `SitemapDefaults` | Nej | Standardvärden för alla poster | +| `locales` | `string[]` | Nej | Stödda språkversioner | +| `defaultLocale` | `string` | Nej | Standard språkversion | + +### SitemapEntry + +| Egenskap | Typ | Beskrivning | +|----------|------|-------------| +| `url` | `string` | Sidans URL (relativ eller absolut) | +| `lastModified` | `Date \| string` | Senaste ändringsdatum | +| `changeFrequency` | `ChangeFrequency` | Hur ofta sidan ändras | +| `priority` | `number` | Prioritet (0.0 - 1.0) | + +### ChangeFrequency + +```tsx +type ChangeFrequency = + | "always" + | "hourly" + | "daily" + | "weekly" + | "monthly" + | "yearly" + | "never"; +``` + +### Exempel + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + const blogPosts = await fetchPosts(); + + return generateSitemap({ + baseUrl: "https://example.com", + defaults: { + changeFrequency: "weekly", + priority: 0.7, + }, + additionalPaths: blogPosts.map((post) => ({ + url: `/blog/${post.slug}`, + lastModified: post.updatedAt, + priority: 0.8, + })), + exclude: ["/admin/*", "/api/*"], + }); +} +``` + +## generateRobots + +Genererar en robots.txt-fil. + +```tsx +import { generateRobots } from "@onruntime/next-sitemap/app"; + +const robots = generateRobots(options); +``` + +### Options + +| Option | Typ | Obligatorisk | Beskrivning | +|--------|------|--------------|-------------| +| `baseUrl` | `string` | Ja | Din sidas bas-URL | +| `rules` | `RobotsRule[]` | Nej | Anpassade robots-regler | +| `sitemap` | `string \| boolean` | Nej | Sitemap-URL eller `false` för att utesluta | + +### RobotsRule + +| Egenskap | Typ | Beskrivning | +|----------|------|-------------| +| `userAgent` | `string` | Målanvändaragent | +| `allow` | `string \| string[]` | Tillåtna vägar | +| `disallow` | `string \| string[]` | Ej tillåtna vägar | +| `crawlDelay` | `number` | Crawl-fördröjning i sekunder | + +### Exempel + +```tsx +import { generateRobots } from "@onruntime/next-sitemap/app"; + +export default function robots() { + return generateRobots({ + baseUrl: "https://example.com", + rules: [ + { + userAgent: "*", + allow: "/", + disallow: ["/admin/", "/private/"], + }, + { + userAgent: "Googlebot", + allow: "/", + crawlDelay: 1, + }, + ], + }); +} +``` + +## generateSitemapIndex + +Genererar en sitemap-index för stora sidor. + +```tsx +import { generateSitemapIndex } from "@onruntime/next-sitemap/app"; + +const index = await generateSitemapIndex(options); +``` + +### Options + +| Option | Typ | Obligatorisk | Beskrivning | +|--------|------|--------------|-------------| +| `baseUrl` | `string` | Ja | Din sidas bas-URL | +| `sitemapsPerFile` | `number` | Nej | URL:er per sitemap (standard: 5000) | + +### Exempel + +```tsx +import { generateSitemapIndex } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemapIndex({ + baseUrl: "https://example.com", + sitemapsPerFile: 10000, + }); +} +``` + +## Type Exports + +Paketet exporterar TypeScript-typer för bekvämlighet: + +```tsx +import type { + SitemapEntry, + SitemapOptions, + RobotsOptions, + RobotsRule, + ChangeFrequency, +} from "@onruntime/next-sitemap"; +``` + + + Alla funktioner och alternativ är helt typade. Din IDE kommer att ge autokomplettering och typkontroll. + diff --git a/apps/web/src/content/sv/docs/next-sitemap/configuration.mdx b/apps/web/src/content/sv/docs/next-sitemap/configuration.mdx new file mode 100644 index 000000000..bb8796e3e --- /dev/null +++ b/apps/web/src/content/sv/docs/next-sitemap/configuration.mdx @@ -0,0 +1,176 @@ +--- +title: Konfiguration +description: Konfigurera @onruntime/next-sitemap för dina behov +--- +## Grundkonfiguration + +Den enklaste konfigurationen kräver bara din bas-URL: + +```tsx +// app/sitemap.ts +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + }); +} +``` + +## Avancerad konfiguration + +### Anpassade rutter + +Lägg till anpassade rutter eller dynamiskt innehåll: + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + // Hämta dynamiskt innehåll + const posts = await fetchBlogPosts(); + + return generateSitemap({ + baseUrl: "https://example.com", + additionalPaths: posts.map((post) => ({ + url: `/blog/${post.slug}`, + lastModified: post.updatedAt, + changeFrequency: "weekly", + priority: 0.7, + })), + }); +} +``` + +### Utesluta rutter + +Uteslut specifika rutter från sitemapen: + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + exclude: [ + "/admin/*", + "/api/*", + "/private/*", + ], + }); +} +``` + +### Prioritet och ändringsfrekvens + +Ställ in standardvärden för alla sidor: + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + defaults: { + changeFrequency: "weekly", + priority: 0.7, + }, + }); +} +``` + +## robots.txt-konfiguration + +### Grundläggande robots.txt + +```tsx +// app/robots.ts +import { generateRobots } from "@onruntime/next-sitemap/app"; + +export default function robots() { + return generateRobots({ + baseUrl: "https://example.com", + }); +} +``` + +### Anpassade regler + +```tsx +import { generateRobots } from "@onruntime/next-sitemap/app"; + +export default function robots() { + return generateRobots({ + baseUrl: "https://example.com", + rules: [ + { + userAgent: "*", + allow: "/", + disallow: ["/admin/", "/private/"], + }, + { + userAgent: "Googlebot", + allow: "/", + }, + ], + }); +} +``` + +## Internationell anpassning + +### Flera språk-sitemaps + +Stöd för flera språk med alternat: + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +const locales = ["en", "fr", "de"]; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + locales, + defaultLocale: "en", + }); +} +``` + +Detta genererar URL:er med `hreflang` alternativ: + +```xml + + https://example.com/en/about + + + + +``` + +## Delade sitemaps + +För stora webbplatser, dela din sitemap i flera filer: + +```tsx +// app/sitemap/[id]/route.ts +import { generateSitemapIndex } from "@onruntime/next-sitemap/app"; + +export async function GET( + request: Request, + { params }: { params: { id: string } } +) { + const sitemaps = await generateSitemapIndex({ + baseUrl: "https://example.com", + sitemapsPerFile: 5000, + }); + + return new Response(sitemaps[parseInt(params.id)], { + headers: { "Content-Type": "application/xml" }, + }); +} +``` + + + Google rekommenderar att hålla sitemaps under 50MB och 50,000 URL:er. Använd delade sitemaps för större webbplatser. + diff --git a/apps/web/src/content/sv/docs/next-sitemap/getting-started.mdx b/apps/web/src/content/sv/docs/next-sitemap/getting-started.mdx new file mode 100644 index 000000000..8d1adf4aa --- /dev/null +++ b/apps/web/src/content/sv/docs/next-sitemap/getting-started.mdx @@ -0,0 +1,86 @@ +--- +title: Komma igång +description: En webbplatskarta generator för Next.js-applikationer +--- +## Vad är @onruntime/next-sitemap? + +`@onruntime/next-sitemap` är en kraftfull sitemap-generator som är designad specifikt för Next.js-applikationer. Den genererar automatiskt `sitemap.xml` och `robots.txt` filer för din Next.js-sajt. + + + - Automatisk sitemap-generering för App Router + - Stöd för dynamiska rutter + - Konfigurerbar prioritet och changefreq + - robots.txt-generering + - Stöd för flerspråkiga sitemaps + + +## Varför använda det? + +### SEO-optimering + +Sitemaps hjälper sökmotorer att upptäcka och indexera dina sidor mer effektivt: + +- **Snabbare indexering** - Sökmotorer kan hitta alla dina sidor +- **Bättre crawlning** - Informera crawlers om siduppdateringar +- **Prioritetsledtrådar** - Vägleder crawlers till viktiga sidor + +### Next.js-integration + +Byggd specifikt för Next.js, förstår den: + +- App Router-struktur +- Dynamiska rutter +- Statisk generering +- Internationaliserad routing + +## Snabbt exempel + +```tsx +// app/sitemap.ts +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + }); +} +``` + +Detta genererar en komplett sitemap som inkluderar alla dina statiska och dynamiska sidor. + +## Genererad utdata + +Paketet genererar standard XML sitemaps: + +```xml + + + + https://example.com/ + 2024-01-15 + daily + 1.0 + + + https://example.com/about + 2024-01-10 + monthly + 0.8 + + +``` + +## Nästa steg + + + + + diff --git a/apps/web/src/content/sv/docs/next-sitemap/installation.mdx b/apps/web/src/content/sv/docs/next-sitemap/installation.mdx new file mode 100644 index 000000000..7a58c301d --- /dev/null +++ b/apps/web/src/content/sv/docs/next-sitemap/installation.mdx @@ -0,0 +1,121 @@ +--- +title: Installation +description: Installera och ställ in @onruntime/next-sitemap +--- +## Installation + +Installera paketet med hjälp av din föredragna paketchefs: + +```bash +# npm +npm install @onruntime/next-sitemap + +# yarn +yarn add @onruntime/next-sitemap + +# pnpm +pnpm add @onruntime/next-sitemap +``` + +## Grundläggande Installation + +### App Router (Next.js 13+) + +Skapa en `sitemap.ts` fil i din `app`-katalog: + +```tsx +// app/sitemap.ts +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://your-domain.com", + }); +} +``` + +### robots.txt + +Skapa en `robots.ts` fil för generering av robots.txt: + +```tsx +// app/robots.ts +import { generateRobots } from "@onruntime/next-sitemap/app"; + +export default function robots() { + return generateRobots({ + baseUrl: "https://your-domain.com", + }); +} +``` + +## Projektstruktur + +Efter installationen ska ditt projekt se ut så här: + + + + + + + + + + + + + + + + + + +## Verifiera Installation + +Starta din utvecklingsserver och besök: + +- `http://localhost:3000/sitemap.xml` - Din sitemap +- `http://localhost:3000/robots.txt` - Din robots.txt + +Du ska se genererad XML för din sitemap och textinnehåll för robots.txt. + + + Sitemapen kommer att inkludera alla rutter som upptäckts vid bygget. I utveckling återspeglar den din nuvarande ruttstruktur. + + +## Miljövariabler + +För produktion, ställ in din bas-URL: + +```env +# .env.production +NEXT_PUBLIC_SITE_URL=https://your-domain.com +``` + +Använd den sedan i din konfiguration: + +```tsx +// app/sitemap.ts +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: process.env.NEXT_PUBLIC_SITE_URL || "https://your-domain.com", + }); +} +``` + +## Nästa Steg + + + + + diff --git a/apps/web/src/content/sv/docs/translations/api.mdx b/apps/web/src/content/sv/docs/translations/api.mdx new file mode 100644 index 000000000..35eb4919f --- /dev/null +++ b/apps/web/src/content/sv/docs/translations/api.mdx @@ -0,0 +1,194 @@ +--- +title: API-referens +description: Komplett API-dokumentation för @onruntime/översättningar +--- +## TranslationsProvider + +Provider-komponenten som omsluter din applikation. + +```tsx +import { TranslationsProvider } from "@onruntime/translations/react"; + + + {children} + +``` + +### Props + +| Prop | Typ | Obligatorisk | Beskrivning | +|------|-----|--------------|-------------| +| `locale` | `string` | Ja | Nuvarande aktiva språk | +| `locales` | `Record` | Ja | Objekt som innehåller alla översättningar för språk | +| `fallbackLocale` | `string` | Nej | Reservspråk när nyckeln saknas | +| `children` | `ReactNode` | Ja | Barnkomponenter | + +## useTranslation + +Hook för att få åtkomst till översättningar i client-komponenter. + +```tsx +const { t, locale, setLocale } = useTranslation("namespace"); +``` + +### Parametrar + +| Parameter | Typ | Obligatorisk | Beskrivning | +|-----------|-----|--------------|-------------| +| `namespace` | `string` | Ja | Översättningsnamnrymd att använda | + +### Returer + +| Egenskap | Typ | Beskrivning | +|----------|-----|-------------| +| `t` | `(key: string, vars?: object) => string` | Översättningsfunktion | +| `locale` | `string` | Nuvarande språk | +| `setLocale` | `(locale: string) => void` | Funktion för att ändra språk | + +### Exempel + +```tsx +const { t, locale, setLocale } = useTranslation("common"); + +// Grundläggande användning +t("greeting"); // "Hello" + +// Med variabler +t("greeting_name", { name: "John" }); // "Hello, John!" + +// Nästlade nycklar +t("nav.home"); // "Home" + +// Byt språk +setLocale("fr"); +``` + +## getTranslation + +Asynkron funktion för att få åtkomst till översättningar i serverkomponenter (Next.js). + +```tsx +const { t } = await getTranslation("namespace"); +``` + +### Parametrar + +| Parameter | Typ | Obligatorisk | Beskrivning | +|-----------|-----|--------------|-------------| +| `namespace` | `string` | Ja | Översättningsnamnrymd att använda | + +### Returer + +| Egenskap | Typ | Beskrivning | +|----------|-----|-------------| +| `t` | `(key: string, vars?: object) => string` | Översättningsfunktion | +| `locale` | `string` | Nuvarande språk | + +### Exempel + +```tsx +// Serverkomponent +export default async function Page() { + const { t } = await getTranslation("common"); + + return

{t("title")}

; +} +``` + +## Link Component + +Språkmedveten länkkomponent för Next.js. + +```tsx +import { Link } from "@onruntime/translations/next"; + +About +``` + +### Props + +Alla props från Next.js `Link`-komponenten, plus: + +| Prop | Typ | Standard | Beskrivning | +|------|-----|----------|-------------| +| `locale` | `string` | Nuvarande språk | Åsidosätt språk för länken | + +### Exempel + +```tsx +// Använder nuvarande språk +About + +// Tvinga till specifikt språk +À propos +``` + +## Translation Function (t) + +`t`-funktionen används för att hämta översatta strängar. + +### Signatur + +```tsx +t(key: string, variables?: Record): string +``` + +### Parametrar + +| Parameter | Typ | Beskrivning | +|-----------|-----|-------------| +| `key` | `string` | Översättningsnyckel (stödjer punktnotation) | +| `variables` | `object` | Variabler att interpolera | + +### Variabelinterpolation + +```json +{ + "greeting": "Hello, {name}!", + "items": "You have {count} items" +} +``` + +```tsx +t("greeting", { name: "Alice" }); // "Hello, Alice!" +t("items", { count: 5 }); // "You have 5 items" +``` + +### Nästlade nycklar + +```json +{ + "user": { + "profile": { + "title": "Profile" + } + } +} +``` + +```tsx +t("user.profile.title"); // "Profile" +``` + +## Typdefinitioner + +### TranslationNamespaces + +Utöka detta gränssnitt för typ-säkra översättningar: + +```tsx +declare module "@onruntime/translations" { + interface TranslationNamespaces { + common: typeof import("./locales/en/common.json"); + auth: typeof import("./locales/en/auth.json"); + } +} +``` + + + Med rätt typdefinitioner får du autocompletion för översättningsnycklar och kompileringstid fel för ogiltiga nycklar. + diff --git a/apps/web/src/content/sv/docs/translations/getting-started.mdx b/apps/web/src/content/sv/docs/translations/getting-started.mdx new file mode 100644 index 000000000..57f6eea0a --- /dev/null +++ b/apps/web/src/content/sv/docs/translations/getting-started.mdx @@ -0,0 +1,92 @@ +--- +title: Komma igång +description: 'Ett lättviktigt, typ-säkert internationellt bibliotek för React och Next.js' +--- +## Vad är @onruntime/translations? + +`@onruntime/translations` är ett lättviktigt, typ-säkert internationaliserings (i18n) bibliotek designat för React och Next.js applikationer. Det erbjuder ett enkelt API för att hantera översättningar med fullt TypeScript-stöd. + + + - Typ-säkra översättningar med TypeScript + - Stöd för React och Next.js (App Router) + - Namnrymds-baserad organisation + - Variabelinterpolation + - Lättviktigt och prestandaeffektivt + + +## Varför Använda Det? + +### Typ Säkerhet + +Få kompileringsfel när du använder ogiltiga översättningsnycklar: + +```typescript +const { t } = useTranslation("common"); + +t("greeting"); // ✅ Giltig nyckel +t("invalid_key"); // ❌ TypeScript fel +``` + +### Enkelt API + +Bara två hooks för alla dina översättningsbehov: + +```typescript +// Klientkomponenter +const { t } = useTranslation("namespace"); + +// Serverkomponenter (Next.js) +const { t } = await getTranslation("namespace"); +``` + +### Organiserade Översättningar + +Håll dina översättningar organiserade med namnrymder: + + + + + + + + + + + + + + + + +## Snabbt Exempel + +```tsx +// locales/en/common.json +{ + "greeting": "Hej, {name}!" +} + +// Komponent +import { useTranslation } from "@onruntime/translations/react"; + +function Welcome({ name }) { + const { t } = useTranslation("common"); + + return

{t("greeting", { name })}

; +} +``` + +## Nästa Steg + + + + + diff --git a/apps/web/src/content/sv/docs/translations/installation.mdx b/apps/web/src/content/sv/docs/translations/installation.mdx new file mode 100644 index 000000000..db52c4837 --- /dev/null +++ b/apps/web/src/content/sv/docs/translations/installation.mdx @@ -0,0 +1,127 @@ +--- +title: Installation +description: Installera och konfigurera @onruntime/translations +--- +## Installation + +Installera paketet med din föredragna paketmanager: + +```bash +# npm +npm install @onruntime/translations + +# yarn +yarn add @onruntime/translations + +# pnpm +pnpm add @onruntime/translations +``` + +## Projektsetup + +### 1. Skapa Översättningsfiler + +Skapa en `locales`-katalog i ditt projekt med översättningsfiler för varje språk: + + + + + + + + + + + + + + +Exempel på `locales/en/common.json`: + +```json +{ + "title": "Välkommen", + "greeting": "Hej, {name}!", + "items": { + "one": "{count} artikel", + "other": "{count} artiklar" + } +} +``` + +### 2. Konfigurera TypeScript (Valfritt) + +För typ-säker översättning, skapa en typdefinitionsfil: + +```typescript +// types/translations.d.ts +import "onruntime/translations"; + +declare module "@onruntime/translations" { + interface TranslationNamespaces { + common: typeof import("../locales/en/common.json"); + auth: typeof import("../locales/en/auth.json"); + } +} +``` + +### 3. Ställ in Provider + +Ombryta din app med `TranslationsProvider`: + +```tsx +// För React +import { TranslationsProvider } from "@onruntime/translations/react"; +import en from "./locales/en"; +import fr from "./locales/fr"; + +const locales = { en, fr }; + +function App() { + return ( + + + + ); +} +``` + + + För Next.js med App Router, kolla in guiden [Next.js Usage](/docs/translations/nextjs) för rekommenderad setup. + + +## Verifiera Installation + +Testa din setup med en enkel komponent: + +```tsx +import { useTranslation } from "@onruntime/translations/react"; + +function TestComponent() { + const { t } = useTranslation("common"); + + return ( +
+

{t("title")}

+

{t("greeting", { name: "Världen" })}

+
+ ); +} +``` + +Om du ser dina översättningar renderade så är du redo! + +## Nästa Steg + + + + + diff --git a/apps/web/src/content/sv/docs/translations/nextjs.mdx b/apps/web/src/content/sv/docs/translations/nextjs.mdx new file mode 100644 index 000000000..61555f5c8 --- /dev/null +++ b/apps/web/src/content/sv/docs/translations/nextjs.mdx @@ -0,0 +1,191 @@ +--- +title: Next.js användning +description: Använda @onruntime/translations med Next.js App Router +--- +## Setup för App Router + +### 1. Konfigurera Leverantören + +Skapa en providers-fil för att ställa in översättningar: + +```tsx +// app/providers.tsx +"use client"; + +import { TranslationsProvider } from "@onruntime/translations/react"; +import { ReactNode } from "react"; + +import en from "@/locales/en"; +import fr from "@/locales/fr"; + +const locales = { en, fr }; + +interface ProvidersProps { + children: ReactNode; + locale: string; +} + +export function Providers({ children, locale }: ProvidersProps) { + return ( + + {children} + + ); +} +``` + +### 2. Ställ In Rotlayouten + +Använd leverantören i din rotlayout: + +```tsx +// app/[locale]/layout.tsx +import { Providers } from "../providers"; + +export default function LocaleLayout({ + children, + params, +}: { + children: React.ReactNode; + params: { locale: string }; +}) { + return ( + + {children} + + ); +} +``` + +## Serverkomponenter + +Använd `getTranslation` för Serverkomponenter: + +```tsx +// app/[locale]/page.tsx +import { getTranslation } from "@/lib/translations.server"; + +export default async function HomePage() { + const { t } = await getTranslation("common"); + + return ( +
+

{t("title")}

+

{t("description")}

+
+ ); +} +``` + + + Använd `getTranslation` i Serverkomponenter och `useTranslation` i Klientkomponenter. + + +## Klientkomponenter + +Använd `useTranslation` för Klientkomponenter: + +```tsx +"use client"; + +import { useTranslation } from "@onruntime/translations/react"; + +export function LanguageSwitcher() { + const { locale, setLocale } = useTranslation("common"); + + return ( + + ); +} +``` + +## Lokalbaserad Routing + +### Middleware Setup + +Ställ in middleware för att hantera lokalavkänning: + +```tsx +// middleware.ts +import { NextRequest, NextResponse } from "next/server"; + +const locales = ["en", "fr"]; +const defaultLocale = "en"; + +export function middleware(request: NextRequest) { + const pathname = request.nextUrl.pathname; + + // Kolla om pathname har en lokal + const pathnameHasLocale = locales.some( + (locale) => pathname.startsWith(`/${locale}/`) || pathname === `/${locale}` + ); + + if (pathnameHasLocale) return; + + // Omdirigera till standardlokalen + return NextResponse.redirect( + new URL(`/${defaultLocale}${pathname}`, request.url) + ); +} + +export const config = { + matcher: ["/((?!api|_next|.*\\..*).*)"], +}; +``` + +## Statisk Generering + +Generera statiska sidor för alla lokaler: + +```tsx +// app/[locale]/page.tsx +export async function generateStaticParams() { + return [{ locale: "en" }, { locale: "fr" }]; +} +``` + +## Länkkomponent + +Använd den översatta Länkkomponenten för navigering: + +```tsx +import { Link } from "@onruntime/translations/next"; + +function Navigation() { + return ( + + ); +} +``` + +Den `Link`-komponenten hanterar automatiskt lokalprefixering. + +## Exempel på Projektstruktur + + + + + + + + + + + + + + + + + + + + + + diff --git a/apps/web/src/content/sv/docs/translations/react.mdx b/apps/web/src/content/sv/docs/translations/react.mdx new file mode 100644 index 000000000..9a5caf49e --- /dev/null +++ b/apps/web/src/content/sv/docs/translations/react.mdx @@ -0,0 +1,157 @@ +--- +title: React-användning +description: Använda @onruntime/translations i React-applikationer +--- +## Grundläggande Användning + +### useTranslation Hooken + +`useTranslation` hooken är ditt huvudsakliga sätt att få tillgång till översättningar i React-komponenter: + +```tsx +import { useTranslation } from "@onruntime/translations/react"; + +function MyComponent() { + const { t, locale } = useTranslation("common"); + + return ( +
+

Nuvarande språk: {locale}

+

{t("title")}

+
+ ); +} +``` + +### Variabelinterpolation + +Skicka variabler till dina översättningar: + +```json +// locales/sv/common.json +{ + "greeting": "Hej, {name}!", + "items_count": "Du har {count} objekt" +} +``` + +```tsx +function Greeting({ name, itemCount }) { + const { t } = useTranslation("common"); + + return ( + <> +

{t("greeting", { name })}

+

{t("items_count", { count: itemCount })}

+ + ); +} +``` + +## Flera Namnområden + +Du kan använda flera namnområden i samma komponent: + +```tsx +function Dashboard() { + const { t: tCommon } = useTranslation("common"); + const { t: tDashboard } = useTranslation("dashboard"); + + return ( +
+

{tDashboard("title")}

+ +
+ ); +} +``` + +## Ändra Språk + +Använd `setLocale` funktionen för att ändra det aktuella språket: + +```tsx +import { useTranslation } from "@onruntime/translations/react"; + +function LanguageSwitcher() { + const { locale, setLocale } = useTranslation("common"); + + return ( + + ); +} +``` + +## Nästlade Nycklar + +Åtkomst till nästlade översättningsnycklar med hjälp av punktnotation: + +```json +// locales/sv/common.json +{ + "nav": { + "home": "Hem", + "about": "Om", + "contact": "Kontakt" + } +} +``` + +```tsx +function Navigation() { + const { t } = useTranslation("common"); + + return ( + + ); +} +``` + +## Bästa Praxis + + + Organisera översättningar efter funktion eller sida istället för att lägga allt i en fil. + + +### Rekommenderad Struktur + + + + + + + + + + + + +### Håll Nycklar Konsekventa + +Använd konsekventa namngivningskonventioner över alla språk: + +```json +// ✅ Bra - konsekvent struktur +{ + "page_title": "Dashboard", + "actions": { + "save": "Spara", + "cancel": "Avbryt" + } +} + +// ❌ Undvik - inkonsekvent +{ + "pageTitle": "Dashboard", + "save_button": "Spara", + "cancelBtn": "Avbryt" +} +``` diff --git a/apps/web/src/content/tr/docs/gitmoji/emojis.mdx b/apps/web/src/content/tr/docs/gitmoji/emojis.mdx new file mode 100644 index 000000000..71630cfcd --- /dev/null +++ b/apps/web/src/content/tr/docs/gitmoji/emojis.mdx @@ -0,0 +1,11 @@ +--- +title: Emoji Referansı +description: Tam gitmoji listesi +--- +Biz [gitmoji](https://gitmoji.dev) kullanarak commitlerimizi kategorilere ayırıyoruz. İşte emoji listesinin tamamı, kodları ve açıklamaları: + + + + + Etkileşimli bir commit deneyimi için [gitmoji-cli](https://github.com/carloscuesta/gitmoji-cli) veya [VS Code uzantısını](https://marketplace.visualstudio.com/items?itemName=seatonjiang.gitmoji-vscode) kullan. + diff --git a/apps/web/src/content/tr/docs/gitmoji/getting-started.mdx b/apps/web/src/content/tr/docs/gitmoji/getting-started.mdx new file mode 100644 index 000000000..90405ba04 --- /dev/null +++ b/apps/web/src/content/tr/docs/gitmoji/getting-started.mdx @@ -0,0 +1,91 @@ +--- +title: Başlarken +description: Commit kuralımızı öğren +--- +Biz temiz bir proje geçmişine sahip olmayı seviyoruz. Commit konvansiyonumuz [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0) ilham alınarak oluşturuldu ama daha görsel ve eğlenceli hale getirilmesi için [gitmoji](https://gitmoji.dev) ile özelleştirildi. + +## Yapı + +Commit mesajı aşağıdaki gibi yapılandırılmalı ve **küçük harf** ile yazılmalıdır: + +``` + [(#)] + +[isteğe bağlı gövde] + +[isteğe bağlı footer(lar)] +``` + +### Örnek + +```bash +📝 update documentation contributors + +- @jerembdn'yi katkıcı olarak ekle +- @younesbessa'yı katkıcı olarak ekle + +Co-authored-by: Younes Bessa +``` + +Çoğu zaman basit bir satır yeterlidir: + +```bash +📝 update documentation contributors +``` + +## Türler + +Aşağıdaki commit türlerini kullanıyoruz: + +| Tür | Açıklama | +| --- | --- | +| `add` | Yeni bir özellik ekle | +| `fix` | Bir hatayı düzelt | +| `improve` | Bir şeyi geliştir | +| `update` | Bir şeyi güncelle | +| `remove` | Bir şeyi kaldır | +| `refactor` | Bir şeyi yeniden düzenle | +| `rename` | Bir şeyi yeniden adlandır | +| `move` | Bir dosya veya klasörü taşı | +| `upgrade` | Bağlantıları güncelle | +| `downgrade` | Bağlantıları düşür | + +## Açıklama + +Açıklamaları **emir kipi** ve **küçük harfle** yaz: + +```bash +# İyi +📝 update documentation contributors + +# Kötü +📝 updated documentation contributors + +# Kötü +📝 Update documentation contributors +``` + +## Sorun Numarası + +Commit’leri sorun numarasına bağlamak için sorun numarasını ekle: + +```bash +📝 update documentation contributors (#123) +``` + +## Gövde + +Gövdeyi bağlam ve motivasyon için kullan: + +```bash +📝 update documentation contributors + +- @jerembdn'yi katkıcı olarak ekle +- @younesbessa'yı katkıcı olarak ekle + +Co-authored-by: Younes Bessa +``` + + + Her commit tek bir mantıksal değişikliği temsil etmelidir. Alakasız değişiklikleri karıştırmayın. + diff --git a/apps/web/src/content/tr/docs/gitmoji/with-ai.mdx b/apps/web/src/content/tr/docs/gitmoji/with-ai.mdx new file mode 100644 index 000000000..6a1a70cf8 --- /dev/null +++ b/apps/web/src/content/tr/docs/gitmoji/with-ai.mdx @@ -0,0 +1,63 @@ +--- +title: Yapay zeka ile +description: Claude Code ile gitmoji kullanın +--- +Install our gitmoji plugin for [Claude Code](https://claude.ai/code) to generate commits following the convention. + +## Eklentiyi Kur + +onRuntime pazarını ekleyin ve eklentiyi kurun: + +```bash +# onRuntime pazarını ekle +/plugin marketplace add https://onruntime.com/plugins + +# gitmoji eklentisini kur +/plugin install gitmoji@onruntime +``` + +Ya da menüden doğrudan kurun: + +1. Claude Code'da `/plugin` komutunu çalıştırın +2. **Keşfet** sekmesine gidin +3. Pazar ekleyin: `https://onruntime.com/plugins` +4. "gitmoji" için arama yapın ve kurun + +## Kullanım + +Bir commit oluşturmak için `/commit` komutunu çalıştırın: + +``` +/commit +``` + +``` +/commit login hatasını düzelt +``` + +Claude Code, değişikliklerinizi analiz edecek ve gitmoji kuralına uygun bir commit oluşturacaktır. + + + `/commit` komutu, uygun commit mesajını oluşturmak için otomatik olarak git durumunu ve farklılıkları alır. + + +## Alternatif: CLAUDE.md + +Eklentiyi kurmak istemiyorsanız, projenizin `CLAUDE.md` dosyasına şunu ekleyin: + +```markdown +## Commit Konvansiyonu + +gitmoji geleneksel commitlerini kullanın: + +\`\`\` + +\`\`\` + +Türler: add, fix, improve, update, remove, refactor, rename, move, upgrade, downgrade + +Kurallar: +- Küçük harfle yazın +- Emir kipi kullanın ("add" değil "added") +- Her commit için bir mantıksal değişiklik +``` diff --git a/apps/web/src/content/tr/docs/next-sitemap/api.mdx b/apps/web/src/content/tr/docs/next-sitemap/api.mdx new file mode 100644 index 000000000..14fe2c621 --- /dev/null +++ b/apps/web/src/content/tr/docs/next-sitemap/api.mdx @@ -0,0 +1,169 @@ +--- +title: API Referansı +description: '@onruntime/next-sitemap için eksiksiz API belgelendirmesi' +--- +## generateSitemap + +Next.js uygulamanız için bir site haritası oluşturur. + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +const sitemap = await generateSitemap(options); +``` + +### Options + +| Seçenek | Tür | Zorunlu | Açıklama | +|---------|-----|---------|----------| +| `baseUrl` | `string` | Evet | Sitenizin ana URL'si | +| `additionalPaths` | `SitemapEntry[]` | Hayır | Dahil edilecek ek URL'ler | +| `exclude` | `string[]` | Hayır | Hariç tutulacak glob kalıpları | +| `defaults` | `SitemapDefaults` | Hayır | Tüm girdiler için varsayılan değerler | +| `locales` | `string[]` | Hayır | Desteklenen diller | +| `defaultLocale` | `string` | Hayır | Varsayılan dil | + +### SitemapEntry + +| Özellik | Tür | Açıklama | +|---------|-----|----------| +| `url` | `string` | Sayfa URL'si (göreceli veya mutlak) | +| `lastModified` | `Date \| string` | Son değişiklik tarihi | +| `changeFrequency` | `ChangeFrequency` | Sayfanın ne sıklıkla değiştiği | +| `priority` | `number` | Öncelik (0.0 - 1.0) | + +### ChangeFrequency + +```tsx +type ChangeFrequency = + | "always" + | "hourly" + | "daily" + | "weekly" + | "monthly" + | "yearly" + | "never"; +``` + +### Örnek + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + const blogPosts = await fetchPosts(); + + return generateSitemap({ + baseUrl: "https://example.com", + defaults: { + changeFrequency: "weekly", + priority: 0.7, + }, + additionalPaths: blogPosts.map((post) => ({ + url: `/blog/${post.slug}`, + lastModified: post.updatedAt, + priority: 0.8, + })), + exclude: ["/admin/*", "/api/*"], + }); +} +``` + +## generateRobots + +Bir robots.txt dosyası oluşturur. + +```tsx +import { generateRobots } from "@onruntime/next-sitemap/app"; + +const robots = generateRobots(options); +``` + +### Options + +| Seçenek | Tür | Zorunlu | Açıklama | +|---------|-----|---------|----------| +| `baseUrl` | `string` | Evet | Sitenizin ana URL'si | +| `rules` | `RobotsRule[]` | Hayır | Özel robots kuralları | +| `sitemap` | `string \| boolean` | Hayır | Site haritası URL'si veya hariç tutmak için `false` | + +### RobotsRule + +| Özellik | Tür | Açıklama | +|---------|-----|----------| +| `userAgent` | `string` | Hedef kullanıcı aracısı | +| `allow` | `string \| string[]` | İzin verilen yollar | +| `disallow` | `string \| string[]` | İzin verilmeyen yollar | +| `crawlDelay` | `number` | Saniyeler cinsinden tarama gecikmesi | + +### Örnek + +```tsx +import { generateRobots } from "@onruntime/next-sitemap/app"; + +export default function robots() { + return generateRobots({ + baseUrl: "https://example.com", + rules: [ + { + userAgent: "*", + allow: "/", + disallow: ["/admin/", "/private/"], + }, + { + userAgent: "Googlebot", + allow: "/", + crawlDelay: 1, + }, + ], + }); +} +``` + +## generateSitemapIndex + +Büyük siteler için bir site haritası indeksi oluşturur. + +```tsx +import { generateSitemapIndex } from "@onruntime/next-sitemap/app"; + +const index = await generateSitemapIndex(options); +``` + +### Options + +| Seçenek | Tür | Zorunlu | Açıklama | +|---------|-----|---------|----------| +| `baseUrl` | `string` | Evet | Sitenizin ana URL'si | +| `sitemapsPerFile` | `number` | Hayır | Her site haritası için URL sayısı (varsayılan: 5000) | + +### Örnek + +```tsx +import { generateSitemapIndex } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemapIndex({ + baseUrl: "https://example.com", + sitemapsPerFile: 10000, + }); +} +``` + +## Type Exports + +Paket, kullanım kolaylığı için TypeScript türlerini dışa aktarır: + +```tsx +import type { + SitemapEntry, + SitemapOptions, + RobotsOptions, + RobotsRule, + ChangeFrequency, +} from "@onruntime/next-sitemap"; +``` + + + Tüm fonksiyonlar ve seçenekler tamamen tiplenmiştir. IDE'niz otomatik tamamlama ve tip kontrolü sağlayacak. + diff --git a/apps/web/src/content/tr/docs/next-sitemap/configuration.mdx b/apps/web/src/content/tr/docs/next-sitemap/configuration.mdx new file mode 100644 index 000000000..af59f5c1c --- /dev/null +++ b/apps/web/src/content/tr/docs/next-sitemap/configuration.mdx @@ -0,0 +1,176 @@ +--- +title: Yapılandırma +description: İhtiyaçlarına göre @onruntime/next-sitemap'i yapılandır +--- +## Temel Yapılandırma + +En basit yapılandırma yalnızca temel URL'nizi gerektirir: + +```tsx +// app/sitemap.ts +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + }); +} +``` + +## Gelişmiş Yapılandırma + +### Özel Yollar + +Özel yollar veya dinamik içerik ekleyin: + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + // Dinamik içeriği al + const posts = await fetchBlogPosts(); + + return generateSitemap({ + baseUrl: "https://example.com", + additionalPaths: posts.map((post) => ({ + url: `/blog/${post.slug}`, + lastModified: post.updatedAt, + changeFrequency: "haftalık", + priority: 0.7, + })), + }); +} +``` + +### Yolları Hariç Tutma + +Belirli yolları sitemap'ten çıkarın: + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + exclude: [ + "/admin/*", + "/api/*", + "/private/*", + ], + }); +} +``` + +### Öncelik ve Değiştirme Sıklığı + +Tüm sayfalar için varsayılan değerleri ayarlayın: + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + defaults: { + changeFrequency: "haftalık", + priority: 0.7, + }, + }); +} +``` + +## robots.txt Yapılandırması + +### Temel robots.txt + +```tsx +// app/robots.ts +import { generateRobots } from "@onruntime/next-sitemap/app"; + +export default function robots() { + return generateRobots({ + baseUrl: "https://example.com", + }); +} +``` + +### Özel Kurallar + +```tsx +import { generateRobots } from "@onruntime/next-sitemap/app"; + +export default function robots() { + return generateRobots({ + baseUrl: "https://example.com", + rules: [ + { + userAgent: "*", + allow: "/", + disallow: ["/admin/", "/private/"], + }, + { + userAgent: "Googlebot", + allow: "/", + }, + ], + }); +} +``` + +## Uluslararasılaşma + +### Çok Dilli Sitemaps + +Alternatiflerle birden fazla dili destekleyin: + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +const locales = ["en", "fr", "de"]; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + locales, + defaultLocale: "en", + }); +} +``` + +Bu, `hreflang` alternatifleri ile URL'ler oluşturur: + +```xml + + https://example.com/en/about + + + + +``` + +## Bölünmüş Sitemaps + +Büyük siteler için sitemap'inizi birden fazla dosyaya ayırın: + +```tsx +// app/sitemap/[id]/route.ts +import { generateSitemapIndex } from "@onruntime/next-sitemap/app"; + +export async function GET( + request: Request, + { params }: { params: { id: string } } +) { + const sitemaps = await generateSitemapIndex({ + baseUrl: "https://example.com", + sitemapsPerFile: 5000, + }); + + return new Response(sitemaps[parseInt(params.id)], { + headers: { "Content-Type": "application/xml" }, + }); +} +``` + + + Google, sitemaps'in 50MB'ın altında ve 50,000 URL'den az tutulmasını önerir. Daha büyük siteler için bölünmüş sitemaps kullanın. + diff --git a/apps/web/src/content/tr/docs/next-sitemap/getting-started.mdx b/apps/web/src/content/tr/docs/next-sitemap/getting-started.mdx new file mode 100644 index 000000000..596804d8e --- /dev/null +++ b/apps/web/src/content/tr/docs/next-sitemap/getting-started.mdx @@ -0,0 +1,86 @@ +--- +title: Başlarken +description: Next.js uygulamaları için bir site haritası oluşturucu +--- +## @onruntime/next-sitemap Nedir? + +`@onruntime/next-sitemap`, özel olarak Next.js uygulamaları için tasarlanmış güçlü bir sitemap oluşturucusudur. Next.js siteniz için otomatik olarak `sitemap.xml` ve `robots.txt` dosyaları oluşturur. + + + - App Router için otomatik sitemap oluşturma + - Dinamik yolları destekleme + - Yapılandırılabilir öncelik ve changefreq + - robots.txt oluşturma + - Çok dilli sitemap desteği + + +## Neden Kullanmalısınız? + +### SEO Optimizasyonu + +Sitemap'ler arama motorlarının sayfalarınızı daha verimli bir şekilde keşfetmesine ve dizine eklemesine yardımcı olur: + +- **Daha hızlı dizinleme** - Arama motorları tüm sayfalarınızı bulabilir +- **Daha iyi tarama** - Tarayıcılara sayfa güncellemeleri hakkında bilgi verir +- **Öncelik ipuçları** - Tarayıcıları önemli sayfalara yönlendirir + +### Next.js Entegrasyonu + +Özellikle Next.js için oluşturulmuş olup, şunları anlar: + +- App Router yapısı +- Dinamik yollar +- Statik oluşturma +- Uluslararasılaştırılmış yönlendirme + +## Hızlı Örnek + +```tsx +// app/sitemap.ts +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + }); +} +``` + +Bu, tüm statik ve dinamik sayfalarınızı içeren tam bir sitemap oluşturur. + +## Oluşturulan Çıktı + +Paket, standart XML sitemap'leri oluşturur: + +```xml + + + + https://example.com/ + 2024-01-15 + daily + 1.0 + + + https://example.com/about + 2024-01-10 + monthly + 0.8 + + +``` + +## Sonraki Adımlar + + + + + diff --git a/apps/web/src/content/tr/docs/next-sitemap/installation.mdx b/apps/web/src/content/tr/docs/next-sitemap/installation.mdx new file mode 100644 index 000000000..bdc176daa --- /dev/null +++ b/apps/web/src/content/tr/docs/next-sitemap/installation.mdx @@ -0,0 +1,121 @@ +--- +title: Kurulum +description: '@onruntime/next-sitemap''ı kur ve ayarla' +--- +## Kurulum + +Paketinizi tercih ettiğiniz paket yöneticisi ile yükleyin: + +```bash +# npm +npm install @onruntime/next-sitemap + +# yarn +yarn add @onruntime/next-sitemap + +# pnpm +pnpm add @onruntime/next-sitemap +``` + +## Temel Kurulum + +### App Router (Next.js 13+) + +`app` dizininizde bir `sitemap.ts` dosyası oluşturun: + +```tsx +// app/sitemap.ts +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://your-domain.com", + }); +} +``` + +### robots.txt + +robots.txt oluşturma için bir `robots.ts` dosyası oluşturun: + +```tsx +// app/robots.ts +import { generateRobots } from "@onruntime/next-sitemap/app"; + +export default function robots() { + return generateRobots({ + baseUrl: "https://your-domain.com", + }); +} +``` + +## Proje Yapısı + +Kurulumdan sonra, projeniz şu şekilde görünmelidir: + + + + + + + + + + + + + + + + + + +## Kurulumu Doğrula + +Geliştirme sunucunuzu başlatın ve ziyaret edin: + +- `http://localhost:3000/sitemap.xml` - Sitemap'iniz +- `http://localhost:3000/robots.txt` - Robots.txt'iniz + +Sitemap'iniz için oluşturulmuş XML ve robots.txt için metin içeriğini görmelisiniz. + + + Sitemap, derleme zamanı sırasında keşfedilen tüm yolları içerecek. Geliştirmede, mevcut yol yapınızı yansıtır. + + +## Ortam Değişkenleri + +Üretim için, temel URL'nizi ayarlayın: + +```env +# .env.production +NEXT_PUBLIC_SITE_URL=https://your-domain.com +``` + +Sonra bunu yapılandırmanızda kullanın: + +```tsx +// app/sitemap.ts +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: process.env.NEXT_PUBLIC_SITE_URL || "https://your-domain.com", + }); +} +``` + +## Sonraki Adımlar + + + + + diff --git a/apps/web/src/content/tr/docs/translations/api.mdx b/apps/web/src/content/tr/docs/translations/api.mdx new file mode 100644 index 000000000..1c1d864c7 --- /dev/null +++ b/apps/web/src/content/tr/docs/translations/api.mdx @@ -0,0 +1,194 @@ +--- +title: API Referansı +description: '@onruntime/çevirmeler için tam API dokümanları' +--- +## TranslationsProvider + +Uygulamanızı saran sağlayıcı bileşeni. + +```tsx +import { TranslationsProvider } from "@onruntime/translations/react"; + + + {children} + +``` + +### Props + +| Prop | Type | Gerekli | Açıklama | +|------|------|---------|----------| +| `locale` | `string` | Evet | Geçerli aktif dil | +| `locales` | `Record` | Evet | Tüm dil çevirilerini içeren nesne | +| `fallbackLocale` | `string` | Hayır | Anahtar eksik olduğunda yedek dil | +| `children` | `ReactNode` | Evet | Alt bileşenler | + +## useTranslation + +İstemci bileşenlerinde çevirilere erişmek için kanca. + +```tsx +const { t, locale, setLocale } = useTranslation("namespace"); +``` + +### Parametreler + +| Parametre | Type | Gerekli | Açıklama | +|-----------|------|---------|----------| +| `namespace` | `string` | Evet | Kullanılacak çeviri alanı | + +### Dönüş + +| Özellik | Type | Açıklama | +|---------|------|----------| +| `t` | `(key: string, vars?: object) => string` | Çeviri işlevi | +| `locale` | `string` | Geçerli dil | +| `setLocale` | `(locale: string) => void` | Dili değiştirmek için işlev | + +### Örnek + +```tsx +const { t, locale, setLocale } = useTranslation("common"); + +// Temel kullanım +t("greeting"); // "Merhaba" + +// Değişkenlerle +t("greeting_name", { name: "John" }); // "Merhaba, John!" + +// İç içe anahtarlar +t("nav.home"); // "Ana Sayfa" + +// Dili değiştir +setLocale("fr"); +``` + +## getTranslation + +Sunucu bileşenlerinde çevirilere erişmek için asenkron işlev (Next.js). + +```tsx +const { t } = await getTranslation("namespace"); +``` + +### Parametreler + +| Parametre | Type | Gerekli | Açıklama | +|-----------|------|---------|----------| +| `namespace` | `string` | Evet | Kullanılacak çeviri alanı | + +### Dönüş + +| Özellik | Type | Açıklama | +|---------|------|----------| +| `t` | `(key: string, vars?: object) => string` | Çeviri işlevi | +| `locale` | `string` | Geçerli dil | + +### Örnek + +```tsx +// Sunucu Bileşeni +export default async function Page() { + const { t } = await getTranslation("common"); + + return

{t("title")}

; +} +``` + +## Link Bileşeni + +Next.js için dil bilgisi olan Link bileşeni. + +```tsx +import { Link } from "@onruntime/translations/next"; + +Hakkında +``` + +### Props + +Next.js `Link` bileşeninden tüm özellikler, artı: + +| Prop | Type | Varsayılan | Açıklama | +|------|------|------------|----------| +| `locale` | `string` | Geçerli dil | Bağlantı dilini geçersiz kılar | + +### Örnek + +```tsx +// Geçerli dili kullanır +Hakkında + +// Belirli bir dili zorla +À propos +``` + +## Çeviri İşlevi (t) + +`t` işlevi, çevrilmiş dizeleri almak için kullanılır. + +### İmza + +```tsx +t(key: string, variables?: Record): string +``` + +### Parametreler + +| Parametre | Type | Açıklama | +|-----------|------|----------| +| `key` | `string` | Çeviri anahtarı (nokta notasyonunu destekler) | +| `variables` | `object` | Yerine geçecek değişkenler | + +### Değişken Yerleştirme + +```json +{ + "greeting": "Merhaba, {name}!", + "items": "Toplam {count} öğeniz var" +} +``` + +```tsx +t("greeting", { name: "Alice" }); // "Merhaba, Alice!" +t("items", { count: 5 }); // "Toplam 5 öğeniz var" +``` + +### İç içe Anahtarlar + +```json +{ + "user": { + "profile": { + "title": "Profil" + } + } +} +``` + +```tsx +t("user.profile.title"); // "Profil" +``` + +## Tip Tanımları + +### TranslationNamespaces + +Tip güvenli çeviriler için bu arayüzü genişletin: + +```tsx +declare module "@onruntime/translations" { + interface TranslationNamespaces { + common: typeof import("./locales/tr/common.json"); + auth: typeof import("./locales/tr/auth.json"); + } +} +``` + + + Doğru tip tanımları ile çeviri anahtarları için otomatik tamamlama ve geçersiz anahtarlar için derleme zamanı hataları alırsınız. + diff --git a/apps/web/src/content/tr/docs/translations/getting-started.mdx b/apps/web/src/content/tr/docs/translations/getting-started.mdx new file mode 100644 index 000000000..688b5fe28 --- /dev/null +++ b/apps/web/src/content/tr/docs/translations/getting-started.mdx @@ -0,0 +1,92 @@ +--- +title: Başlarken +description: 'React ve Next.js için hafif, tip güvenli bir uluslararasılaştırma kütüphanesi' +--- +## @onruntime/translations Nedir? + +`@onruntime/translations`, React ve Next.js uygulamaları için tasarlanmış hafif, tip güvenli bir uluslararasılaştırma (i18n) kütüphanesidir. Tam TypeScript desteği ile çevirileri yönetmek için basit bir API sunar. + + + - TypeScript ile tip güvenli çeviriler + - React ve Next.js (App Router) desteği + - Ad alanına dayalı organizasyon + - Değişken yerleştirme + - Hafif ve performanslı + + +## Neden Kullanmalısınız? + +### Tip Güvenliği + +Geçersiz çeviri anahtarlarını kullanırken derleme zamanı hataları alın: + +```typescript +const { t } = useTranslation("common"); + +t("greeting"); // ✅ Geçerli anahtar +t("invalid_key"); // ❌ TypeScript hatası +``` + +### Basit API + +Tüm çeviri ihtiyaçlarınız için sadece iki kanca: + +```typescript +// İstemci Bileşenleri +const { t } = useTranslation("namespace"); + +// Sunucu Bileşenleri (Next.js) +const { t } = await getTranslation("namespace"); +``` + +### Düzenli Çeviriler + +Çevirilerinizi ad alanlarıyla düzenli tutun: + + + + + + + + + + + + + + + + +## Hızlı Örnek + +```tsx +// locales/en/common.json +{ + "greeting": "Merhaba, {name}!" +} + +// Bileşen +import { useTranslation } from "@onruntime/translations/react"; + +function Welcome({ name }) { + const { t } = useTranslation("common"); + + return

{t("greeting", { name })}

; +} +``` + +## Sonraki Adımlar + + + + + diff --git a/apps/web/src/content/tr/docs/translations/installation.mdx b/apps/web/src/content/tr/docs/translations/installation.mdx new file mode 100644 index 000000000..c0fee839a --- /dev/null +++ b/apps/web/src/content/tr/docs/translations/installation.mdx @@ -0,0 +1,127 @@ +--- +title: Kurulum +description: '@onruntime/translations''ı kur ve yapılandır' +--- +## Kurulum + +Paketinizi tercih ettiğiniz paket yöneticisiyle kurun: + +```bash +# npm +npm install @onruntime/translations + +# yarn +yarn add @onruntime/translations + +# pnpm +pnpm add @onruntime/translations +``` + +## Proje Ayarları + +### 1. Çeviri Dosyaları Oluşturun + +Projenizde her dil için çeviri dosyalarıyla bir `locales` dizini oluşturun: + + + + + + + + + + + + + + +Örnek `locales/en/common.json`: + +```json +{ + "title": "Hoş Geldin", + "greeting": "Merhaba, {name}!", + "items": { + "one": "{count} öğe", + "other": "{count} öğe" + } +} +``` + +### 2. TypeScript'i Yapılandırın (İsteğe Bağlı) + +Tip güvenli çeviriler için bir tip tanım dosyası oluşturun: + +```typescript +// types/translations.d.ts +import "onruntime/translations"; + +declare module "@onruntime/translations" { + interface TranslationNamespaces { + common: typeof import("../locales/en/common.json"); + auth: typeof import("../locales/en/auth.json"); + } +} +``` + +### 3. Sağlayıcıyı Ayarlayın + +Uygulamanızı `TranslationsProvider` ile sarmalayın: + +```tsx +// React için +import { TranslationsProvider } from "@onruntime/translations/react"; +import en from "./locales/en"; +import fr from "./locales/fr"; + +const locales = { en, fr }; + +function App() { + return ( + + + + ); +} +``` + + + Next.js ile App Yönlendiricisi için önerilen kurulum için [Next.js Kullanımı](/docs/translations/nextjs) kılavuzuna göz atın. + + +## Kurulumu Doğrulama + +Kurulumuza basit bir bileşenle test edin: + +```tsx +import { useTranslation } from "@onruntime/translations/react"; + +function TestComponent() { + const { t } = useTranslation("common"); + + return ( +
+

{t("title")}

+

{t("greeting", { name: "Dünya" })}

+
+ ); +} +``` + +Eğer çevirilerinizin görüntülendiğini görüyorsanız, her şey yolunda! + +## Sonraki Adımlar + + + + + diff --git a/apps/web/src/content/tr/docs/translations/nextjs.mdx b/apps/web/src/content/tr/docs/translations/nextjs.mdx new file mode 100644 index 000000000..25e3a9965 --- /dev/null +++ b/apps/web/src/content/tr/docs/translations/nextjs.mdx @@ -0,0 +1,191 @@ +--- +title: Next.js kullanımı +description: Next.js App Router ile @onruntime/translations kullanımı +--- +## Uygulama Yönlendiricisi için Kurulum + +### 1. Sağlayıcıyı Yapılandır + +Çevirileri ayarlamak için bir sağlayıcı dosyası oluştur: + +```tsx +// app/providers.tsx +"use client"; + +import { TranslationsProvider } from "@onruntime/translations/react"; +import { ReactNode } from "react"; + +import en from "@/locales/en"; +import fr from "@/locales/fr"; + +const locales = { en, fr }; + +interface ProvidersProps { + children: ReactNode; + locale: string; +} + +export function Providers({ children, locale }: ProvidersProps) { + return ( + + {children} + + ); +} +``` + +### 2. Kök Düzeni Ayarlayın + +Kök düzeninizde sağlayıcıyı kullanın: + +```tsx +// app/[locale]/layout.tsx +import { Providers } from "../providers"; + +export default function LocaleLayout({ + children, + params, +}: { + children: React.ReactNode; + params: { locale: string }; +}) { + return ( + + {children} + + ); +} +``` + +## Sunucu Bileşenleri + +Sunucu Bileşenleri için `getTranslation` kullanın: + +```tsx +// app/[locale]/page.tsx +import { getTranslation } from "@/lib/translations.server"; + +export default async function HomePage() { + const { t } = await getTranslation("common"); + + return ( +
+

{t("title")}

+

{t("description")}

+
+ ); +} +``` + + + Sunucu Bileşenlerinde `getTranslation` ve İstemci Bileşenlerinde `useTranslation` kullanın. + + +## İstemci Bileşenleri + +İstemci Bileşenleri için `useTranslation` kullanın: + +```tsx +"use client"; + +import { useTranslation } from "@onruntime/translations/react"; + +export function LanguageSwitcher() { + const { locale, setLocale } = useTranslation("common"); + + return ( + + ); +} +``` + +## Yerel Tabanlı Yönlendirme + +### Ara Katman Kurulumu + +Yerel belirleme için ara katmanı ayarlayın: + +```tsx +// middleware.ts +import { NextRequest, NextResponse } from "next/server"; + +const locales = ["en", "fr"]; +const defaultLocale = "en"; + +export function middleware(request: NextRequest) { + const pathname = request.nextUrl.pathname; + + // Yolun bir yerel içerip içermediğini kontrol et + const pathnameHasLocale = locales.some( + (locale) => pathname.startsWith(`/${locale}/`) || pathname === `/${locale}` + ); + + if (pathnameHasLocale) return; + + // Varsayılan yerelere yönlendir + return NextResponse.redirect( + new URL(`/${defaultLocale}${pathname}`, request.url) + ); +} + +export const config = { + matcher: ["/((?!api|_next|.*\\..*).*)"], +}; +``` + +## Statik Üretim + +Tüm yereller için statik sayfalar oluşturun: + +```tsx +// app/[locale]/page.tsx +export async function generateStaticParams() { + return [{ locale: "en" }, { locale: "fr" }]; +} +``` + +## Bağlantı Bileşeni + +Gezinme için çevrilen Bağlantı bileşenini kullanın: + +```tsx +import { Link } from "@onruntime/translations/next"; + +function Navigation() { + return ( + + ); +} +``` + +`Link` bileşeni yerel öneklemeyi otomatik olarak yönetir. + +## Örnek Proje Yapısı + + + + + + + + + + + + + + + + + + + + + + diff --git a/apps/web/src/content/tr/docs/translations/react.mdx b/apps/web/src/content/tr/docs/translations/react.mdx new file mode 100644 index 000000000..b988e206d --- /dev/null +++ b/apps/web/src/content/tr/docs/translations/react.mdx @@ -0,0 +1,157 @@ +--- +title: React kullanımı +description: React uygulamalarında @onruntime/translations kullanma +--- +## Temel Kullanım + +### useTranslation Kancası + +`useTranslation` kancası, React bileşenlerinde çevirilere erişmenin temel yoludur: + +```tsx +import { useTranslation } from "@onruntime/translations/react"; + +function MyComponent() { + const { t, locale } = useTranslation("common"); + + return ( +
+

Mevcut yerel: {locale}

+

{t("title")}

+
+ ); +} +``` + +### Değişken Yerleştirme + +Çevirilerinize değişkenler gönderin: + +```json +// locales/en/common.json +{ + "greeting": "Merhaba, {name}!", + "items_count": "Elinizde {count} madde var" +} +``` + +```tsx +function Greeting({ name, itemCount }) { + const { t } = useTranslation("common"); + + return ( + <> +

{t("greeting", { name })}

+

{t("items_count", { count: itemCount })}

+ + ); +} +``` + +## Birden Fazla İsim Alanı + +Aynı bileşende birden fazla isim alanı kullanabilirsiniz: + +```tsx +function Dashboard() { + const { t: tCommon } = useTranslation("common"); + const { t: tDashboard } = useTranslation("dashboard"); + + return ( +
+

{tDashboard("title")}

+ +
+ ); +} +``` + +## Yerel Değiştirme + +Mevcut yereli değiştirmek için `setLocale` fonksiyonunu kullanın: + +```tsx +import { useTranslation } from "@onruntime/translations/react"; + +function LanguageSwitcher() { + const { locale, setLocale } = useTranslation("common"); + + return ( + + ); +} +``` + +## İç İçe Anahtarlar + +Nokta notasyonu kullanarak iç içe çeviri anahtarlarına erişin: + +```json +// locales/en/common.json +{ + "nav": { + "home": "Ana Sayfa", + "about": "Hakkında", + "contact": "İletişim" + } +} +``` + +```tsx +function Navigation() { + const { t } = useTranslation("common"); + + return ( + + ); +} +``` + +## En İyi Uygulamalar + + + Her şeyi tek bir dosyada toplamak yerine çevirileri özellik veya sayfaya göre düzenleyin. + + +### Önerilen Yapı + + + + + + + + + + + + +### Anahtarları Tutarlı Tutun + +Tüm yerellerde tutarlı isimlendirme kuralları kullanın: + +```json +// ✅ İyi - tutarlı yapı +{ + "page_title": "Dashboard", + "actions": { + "save": "Kaydet", + "cancel": "İptal" + } +} + +// ❌ Kaçının - tutarsız +{ + "pageTitle": "Dashboard", + "save_button": "Kaydet", + "cancelBtn": "İptal" +} +``` diff --git a/apps/web/src/content/zh/docs/gitmoji/emojis.mdx b/apps/web/src/content/zh/docs/gitmoji/emojis.mdx new file mode 100644 index 000000000..e73cd4aa4 --- /dev/null +++ b/apps/web/src/content/zh/docs/gitmoji/emojis.mdx @@ -0,0 +1,11 @@ +--- +title: 表情符号参考 +description: 完整的 gitmojis 列表 +--- +我们使用 [gitmoji](https://gitmoji.dev) 来分类我们的提交。这是完整的表情符号、代码和描述: + + + + + 使用 [gitmoji-cli](https://github.com/carloscuesta/gitmoji-cli) 或 [VS Code 扩展](https://marketplace.visualstudio.com/items?itemName=seatonjiang.gitmoji-vscode) 获取交互式提交体验。 + diff --git a/apps/web/src/content/zh/docs/gitmoji/getting-started.mdx b/apps/web/src/content/zh/docs/gitmoji/getting-started.mdx new file mode 100644 index 000000000..f5cbee48d --- /dev/null +++ b/apps/web/src/content/zh/docs/gitmoji/getting-started.mdx @@ -0,0 +1,91 @@ +--- +title: 开始使用 +description: 了解我们的提交规范 +--- +我们喜欢保持项目历史的清晰。我们的提交规范灵感来自于 [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0),但使用 [gitmoji](https://gitmoji.dev) 进行了自定义,让它更具视觉效果和趣味。 + +## 结构 + +提交信息应该按以下结构编写,并且**全小写**: + +``` + [(#)] + +[可选的主体] + +[可选的脚注] +``` + +### 示例 + +```bash +📝 update documentation contributors + +- Add @jerembdn as a contributor +- Add @younesbessa as a contributor + +Co-authored-by: Younes Bessa +``` + +大多数时候,一行简单的信息就足够了: + +```bash +📝 update documentation contributors +``` + +## 类型 + +我们使用以下提交类型: + +| 类型 | 描述 | +| --- | --- | +| `add` | 添加新功能 | +| `fix` | 修复一个bug | +| `improve` | 改进某些内容 | +| `update` | 更新某些内容 | +| `remove` | 删除某些内容 | +| `refactor` | 重构某些内容 | +| `rename` | 重命名某些内容 | +| `move` | 移动一个文件或文件夹 | +| `upgrade` | 升级依赖 | +| `downgrade` | 降级依赖 | + +## 描述 + +描述应该用**命令式语气**和**小写**编写: + +```bash +# 好 +📝 update documentation contributors + +# 坏 +📝 updated documentation contributors + +# 坏 +📝 Update documentation contributors +``` + +## 问题编号 + +通过添加问题编号来链接提交和问题: + +```bash +📝 update documentation contributors (#123) +``` + +## 主体 + +使用主体提供背景和动机: + +```bash +📝 update documentation contributors + +- Add @jerembdn as a contributor +- Add @younesbessa as a contributor + +Co-authored-by: Younes Bessa +``` + + + 每次提交应该代表一个逻辑变更。不要混合不相关的变更。 + diff --git a/apps/web/src/content/zh/docs/gitmoji/with-ai.mdx b/apps/web/src/content/zh/docs/gitmoji/with-ai.mdx new file mode 100644 index 000000000..a0e36fc15 --- /dev/null +++ b/apps/web/src/content/zh/docs/gitmoji/with-ai.mdx @@ -0,0 +1,63 @@ +--- +title: 使用AI +description: 用gitmoji和Claude Code +--- +安装我们的 gitmoji 插件用于 [Claude Code](https://claude.ai/code),以生成符合约定的提交。 + +## 安装插件 + +添加 onRuntime 市场并安装插件: + +```bash +# 添加 onRuntime 市场 +/plugin marketplace add https://onruntime.com/plugins + +# 安装 gitmoji 插件 +/plugin install gitmoji@onruntime +``` + +或者直接从菜单安装: + +1. 在 Claude Code 中运行 `/plugin` +2. 前往 **Discover** 标签 +3. 添加市场: `https://onruntime.com/plugins` +4. 搜索 “gitmoji” 并安装 + +## 使用方法 + +运行 `/commit` 命令来创建提交: + +``` +/commit +``` + +``` +/commit fix the login bug +``` + +Claude Code 将会分析你的更改,并生成符合 gitmoji 约定的提交。 + + + `/commit` 命令会自动获取你的 git 状态和差异,以生成合适的提交信息。 + + +## 替代方案:CLAUDE.md + +如果你不想安装插件,可以将以下内容添加到你项目的 `CLAUDE.md`: + +```markdown +## 提交约定 + +使用 gitmoji 传统提交: + +\`\`\` + +\`\`\` + +类型:add, fix, improve, update, remove, refactor, rename, move, upgrade, downgrade + +规则: +- 使用小写字母 +- 使用命令式语气(“add”而不是“added”) +- 每次提交一个逻辑更改 +``` diff --git a/apps/web/src/content/zh/docs/next-sitemap/api.mdx b/apps/web/src/content/zh/docs/next-sitemap/api.mdx new file mode 100644 index 000000000..d5722b057 --- /dev/null +++ b/apps/web/src/content/zh/docs/next-sitemap/api.mdx @@ -0,0 +1,169 @@ +--- +title: API 参考 +description: '@onruntime/next-sitemap 的完整 API 文档' +--- +## generateSitemap + +为你的 Next.js 应用生成一个站点地图。 + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +const sitemap = await generateSitemap(options); +``` + +### Options + +| 选项 | 类型 | 是否必需 | 描述 | +|------|------|----------|------| +| `baseUrl` | `string` | 是 | 你网站的基础 URL | +| `additionalPaths` | `SitemapEntry[]` | 否 | 额外要包含的 URL | +| `exclude` | `string[]` | 否 | 要排除的全局模式 | +| `defaults` | `SitemapDefaults` | 否 | 所有条目的默认值 | +| `locales` | `string[]` | 否 | 支持的语言环境 | +| `defaultLocale` | `string` | 否 | 默认语言环境 | + +### SitemapEntry + +| 属性 | 类型 | 描述 | +|------|------|------| +| `url` | `string` | 页面 URL(相对或绝对) | +| `lastModified` | `Date \| string` | 最后修改日期 | +| `changeFrequency` | `ChangeFrequency` | 页面更改的频率 | +| `priority` | `number` | 优先级(0.0 - 1.0) | + +### ChangeFrequency + +```tsx +type ChangeFrequency = + | "always" + | "hourly" + | "daily" + | "weekly" + | "monthly" + | "yearly" + | "never"; +``` + +### 示例 + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + const blogPosts = await fetchPosts(); + + return generateSitemap({ + baseUrl: "https://example.com", + defaults: { + changeFrequency: "weekly", + priority: 0.7, + }, + additionalPaths: blogPosts.map((post) => ({ + url: `/blog/${post.slug}`, + lastModified: post.updatedAt, + priority: 0.8, + })), + exclude: ["/admin/*", "/api/*"], + }); +} +``` + +## generateRobots + +生成一个 robots.txt 文件。 + +```tsx +import { generateRobots } from "@onruntime/next-sitemap/app"; + +const robots = generateRobots(options); +``` + +### Options + +| 选项 | 类型 | 是否必需 | 描述 | +|------|------|----------|------| +| `baseUrl` | `string` | 是 | 你网站的基础 URL | +| `rules` | `RobotsRule[]` | 否 | 自定义 robots 规则 | +| `sitemap` | `string \| boolean` | 否 | 站点地图 URL 或 `false` 表示排除 | + +### RobotsRule + +| 属性 | 类型 | 描述 | +|------|------|------| +| `userAgent` | `string` | 目标用户代理 | +| `allow` | `string \| string[]` | 允许的路径 | +| `disallow` | `string \| string[]` | 不允许的路径 | +| `crawlDelay` | `number` | 爬取延迟(秒) | + +### 示例 + +```tsx +import { generateRobots } from "@onruntime/next-sitemap/app"; + +export default function robots() { + return generateRobots({ + baseUrl: "https://example.com", + rules: [ + { + userAgent: "*", + allow: "/", + disallow: ["/admin/", "/private/"], + }, + { + userAgent: "Googlebot", + allow: "/", + crawlDelay: 1, + }, + ], + }); +} +``` + +## generateSitemapIndex + +为大型网站生成一个站点地图索引。 + +```tsx +import { generateSitemapIndex } from "@onruntime/next-sitemap/app"; + +const index = await generateSitemapIndex(options); +``` + +### Options + +| 选项 | 类型 | 是否必需 | 描述 | +|------|------|----------|------| +| `baseUrl` | `string` | 是 | 你网站的基础 URL | +| `sitemapsPerFile` | `number` | 否 | 每个站点地图的 URL 数量(默认:5000) | + +### 示例 + +```tsx +import { generateSitemapIndex } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemapIndex({ + baseUrl: "https://example.com", + sitemapsPerFile: 10000, + }); +} +``` + +## Type Exports + +这个包为了方便导出了 TypeScript 类型: + +```tsx +import type { + SitemapEntry, + SitemapOptions, + RobotsOptions, + RobotsRule, + ChangeFrequency, +} from "@onruntime/next-sitemap"; +``` + + + 所有函数和选项都有完整的类型定义。你的 IDE 会提供自动补全和类型检查。 + diff --git a/apps/web/src/content/zh/docs/next-sitemap/configuration.mdx b/apps/web/src/content/zh/docs/next-sitemap/configuration.mdx new file mode 100644 index 000000000..9517c49e3 --- /dev/null +++ b/apps/web/src/content/zh/docs/next-sitemap/configuration.mdx @@ -0,0 +1,176 @@ +--- +title: 配置 +description: 根据你的需求配置 @onruntime/next-sitemap +--- +## 基本配置 + +最简单的配置只需你的基础 URL: + +```tsx +// app/sitemap.ts +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + }); +} +``` + +## 高级配置 + +### 自定义路由 + +添加自定义路由或动态内容: + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + // 获取动态内容 + const posts = await fetchBlogPosts(); + + return generateSitemap({ + baseUrl: "https://example.com", + additionalPaths: posts.map((post) => ({ + url: `/blog/${post.slug}`, + lastModified: post.updatedAt, + changeFrequency: "weekly", + priority: 0.7, + })), + }); +} +``` + +### 排除路由 + +从站点地图中排除特定路由: + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + exclude: [ + "/admin/*", + "/api/*", + "/private/*", + ], + }); +} +``` + +### 优先级和更改频率 + +为所有页面设置默认值: + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + defaults: { + changeFrequency: "weekly", + priority: 0.7, + }, + }); +} +``` + +## robots.txt 配置 + +### 基本 robots.txt + +```tsx +// app/robots.ts +import { generateRobots } from "@onruntime/next-sitemap/app"; + +export default function robots() { + return generateRobots({ + baseUrl: "https://example.com", + }); +} +``` + +### 自定义规则 + +```tsx +import { generateRobots } from "@onruntime/next-sitemap/app"; + +export default function robots() { + return generateRobots({ + baseUrl: "https://example.com", + rules: [ + { + userAgent: "*", + allow: "/", + disallow: ["/admin/", "/private/"], + }, + { + userAgent: "Googlebot", + allow: "/", + }, + ], + }); +} +``` + +## 国际化 + +### 多语言站点地图 + +支持多种语言的替代方案: + +```tsx +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +const locales = ["en", "fr", "de"]; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + locales, + defaultLocale: "en", + }); +} +``` + +这会生成带有 `hreflang` 替代的 URL: + +```xml + + https://example.com/en/about + + + + +``` + +## 拆分站点地图 + +对于大型网站,将站点地图拆分为多个文件: + +```tsx +// app/sitemap/[id]/route.ts +import { generateSitemapIndex } from "@onruntime/next-sitemap/app"; + +export async function GET( + request: Request, + { params }: { params: { id: string } } +) { + const sitemaps = await generateSitemapIndex({ + baseUrl: "https://example.com", + sitemapsPerFile: 5000, + }); + + return new Response(sitemaps[parseInt(params.id)], { + headers: { "Content-Type": "application/xml" }, + }); +} +``` + + + Google 建议将站点地图保持在 50MB 和 50,000 个 URL 以下。对于较大的网站,请使用拆分站点地图。 + diff --git a/apps/web/src/content/zh/docs/next-sitemap/getting-started.mdx b/apps/web/src/content/zh/docs/next-sitemap/getting-started.mdx new file mode 100644 index 000000000..e986e5f72 --- /dev/null +++ b/apps/web/src/content/zh/docs/next-sitemap/getting-started.mdx @@ -0,0 +1,86 @@ +--- +title: 开始使用 +description: 为 Next.js 应用程序生成网站地图的工具 +--- +## 什么是 @onruntime/next-sitemap? + +`@onruntime/next-sitemap` 是一个强大的站点地图生成器,专为 Next.js 应用程序设计。它会自动为你的 Next.js 网站生成 `sitemap.xml` 和 `robots.txt` 文件。 + + + - 为应用路由自动生成站点地图 + - 支持动态路由 + - 可配置优先级和更改频率 + - 生成 robots.txt + - 支持多语言站点地图 + + +## 为什么使用它? + +### SEO 优化 + +站点地图帮助搜索引擎更高效地发现和索引你的页面: + +- **更快的索引** - 搜索引擎可以找到你所有的页面 +- **更好的抓取** - 通知爬虫页面更新 +- **优先级提示** - 指导爬虫访问重要页面 + +### Next.js 集成 + +它专为 Next.js 构建,理解: + +- 应用路由结构 +- 动态路由 +- 静态生成 +- 国际化路由 + +## 快速示例 + +```tsx +// app/sitemap.ts +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://example.com", + }); +} +``` + +这会生成一个完整的站点地图,包括你所有的静态和动态页面。 + +## 生成的输出 + +该包生成标准 XML 站点地图: + +```xml + + + + https://example.com/ + 2024-01-15 + daily + 1.0 + + + https://example.com/about + 2024-01-10 + monthly + 0.8 + + +``` + +## 后续步骤 + + + + + diff --git a/apps/web/src/content/zh/docs/next-sitemap/installation.mdx b/apps/web/src/content/zh/docs/next-sitemap/installation.mdx new file mode 100644 index 000000000..15178eb22 --- /dev/null +++ b/apps/web/src/content/zh/docs/next-sitemap/installation.mdx @@ -0,0 +1,121 @@ +--- +title: 安装 +description: 安装并设置 @onruntime/next-sitemap +--- +## 安装 + +使用你喜欢的包管理器安装该包: + +```bash +# npm +npm install @onruntime/next-sitemap + +# yarn +yarn add @onruntime/next-sitemap + +# pnpm +pnpm add @onruntime/next-sitemap +``` + +## 基本设置 + +### App Router (Next.js 13+) + +在你的 `app` 目录下创建一个 `sitemap.ts` 文件: + +```tsx +// app/sitemap.ts +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: "https://your-domain.com", + }); +} +``` + +### robots.txt + +创建一个 `robots.ts` 文件用于生成 robots.txt: + +```tsx +// app/robots.ts +import { generateRobots } from "@onruntime/next-sitemap/app"; + +export default function robots() { + return generateRobots({ + baseUrl: "https://your-domain.com", + }); +} +``` + +## 项目结构 + +设置完成后,你的项目应该看起来像这样: + + + + + + + + + + + + + + + + + + +## 验证安装 + +启动你的开发服务器并访问: + +- `http://localhost:3000/sitemap.xml` - 你的站点地图 +- `http://localhost:3000/robots.txt` - 你的 robots.txt + +你应该能看到生成的 XML 文件作为你的站点地图和 robots.txt 的文本内容。 + + + 站点地图将包括在构建时发现的所有路由。在开发中,它反映了你当前的路由结构。 + + +## 环境变量 + +在生产环境中,设置你的基础 URL: + +```env +# .env.production +NEXT_PUBLIC_SITE_URL=https://your-domain.com +``` + +然后在你的配置中使用它: + +```tsx +// app/sitemap.ts +import { generateSitemap } from "@onruntime/next-sitemap/app"; + +export default async function sitemap() { + return generateSitemap({ + baseUrl: process.env.NEXT_PUBLIC_SITE_URL || "https://your-domain.com", + }); +} +``` + +## 下一步 + + + + + diff --git a/apps/web/src/content/zh/docs/translations/api.mdx b/apps/web/src/content/zh/docs/translations/api.mdx new file mode 100644 index 000000000..f96330cbd --- /dev/null +++ b/apps/web/src/content/zh/docs/translations/api.mdx @@ -0,0 +1,194 @@ +--- +title: API 参考 +description: '@onruntime/translations 的完整 API 文档' +--- +## TranslationsProvider + +包装你应用的提供者组件。 + +```tsx +import { TranslationsProvider } from "@onruntime/translations/react"; + + + {children} + +``` + +### Props + +| Prop | Type | Required | Description | +|------|------|----------|-------------| +| `locale` | `string` | Yes | 当前活动语言环境 | +| `locales` | `Record` | Yes | 包含所有语言环境翻译的对象 | +| `fallbackLocale` | `string` | No | 当键缺失时的备用语言环境 | +| `children` | `ReactNode` | Yes | 子组件 | + +## useTranslation + +用于在客户端组件中访问翻译的 Hook。 + +```tsx +const { t, locale, setLocale } = useTranslation("namespace"); +``` + +### Parameters + +| Parameter | Type | Required | Description | +|-----------|------|----------|-------------| +| `namespace` | `string` | Yes | 要使用的翻译命名空间 | + +### Returns + +| Property | Type | Description | +|----------|------|-------------| +| `t` | `(key: string, vars?: object) => string` | 翻译函数 | +| `locale` | `string` | 当前语言环境 | +| `setLocale` | `(locale: string) => void` | 改变语言环境的函数 | + +### Example + +```tsx +const { t, locale, setLocale } = useTranslation("common"); + +// 基本用法 +t("greeting"); // "Hello" + +// 带变量 +t("greeting_name", { name: "John" }); // "Hello, John!" + +// 嵌套键 +t("nav.home"); // "Home" + +// 更改语言环境 +setLocale("fr"); +``` + +## getTranslation + +用于在服务器组件(Next.js)中访问翻译的异步函数。 + +```tsx +const { t } = await getTranslation("namespace"); +``` + +### Parameters + +| Parameter | Type | Required | Description | +|-----------|------|----------|-------------| +| `namespace` | `string` | Yes | 要使用的翻译命名空间 | + +### Returns + +| Property | Type | Description | +|----------|------|-------------| +| `t` | `(key: string, vars?: object) => string` | 翻译函数 | +| `locale` | `string` | 当前语言环境 | + +### Example + +```tsx +// 服务器组件 +export default async function Page() { + const { t } = await getTranslation("common"); + + return

{t("title")}

; +} +``` + +## Link Component + +支持地点的链接组件,适用于 Next.js。 + +```tsx +import { Link } from "@onruntime/translations/next"; + +About +``` + +### Props + +来自 Next.js `Link` 组件的所有 props,以及: + +| Prop | Type | Default | Description | +|------|------|---------|-------------| +| `locale` | `string` | 当前语言环境 | 重写链接语言环境 | + +### Example + +```tsx +// 使用当前语言环境 +About + +// 强制指定语言环境 +À propos +``` + +## Translation Function (t) + +`t` 函数用于获取翻译的字符串。 + +### Signature + +```tsx +t(key: string, variables?: Record): string +``` + +### Parameters + +| Parameter | Type | Description | +|-----------|------|-------------| +| `key` | `string` | 翻译键(支持点表示法) | +| `variables` | `object` | 要插入的变量 | + +### Variable Interpolation + +```json +{ + "greeting": "Hello, {name}!", + "items": "You have {count} items" +} +``` + +```tsx +t("greeting", { name: "Alice" }); // "Hello, Alice!" +t("items", { count: 5 }); // "You have 5 items" +``` + +### Nested Keys + +```json +{ + "user": { + "profile": { + "title": "Profile" + } + } +} +``` + +```tsx +t("user.profile.title"); // "Profile" +``` + +## Type Definitions + +### TranslationNamespaces + +扩展这个接口以实现类型安全的翻译: + +```tsx +declare module "@onruntime/translations" { + interface TranslationNamespaces { + common: typeof import("./locales/en/common.json"); + auth: typeof import("./locales/en/auth.json"); + } +} +``` + + + 有了正确的类型定义,你将获得翻译键的自动补全以及无效键的编译时错误。 + diff --git a/apps/web/src/content/zh/docs/translations/getting-started.mdx b/apps/web/src/content/zh/docs/translations/getting-started.mdx new file mode 100644 index 000000000..ca1d6217d --- /dev/null +++ b/apps/web/src/content/zh/docs/translations/getting-started.mdx @@ -0,0 +1,92 @@ +--- +title: 入门指南 +description: 一个轻量级、类型安全的国际化库,用于 React 和 Next.js +--- +## 什么是 @onruntime/translations? + +`@onruntime/translations` 是一个轻量级、类型安全的国际化(i18n)库,专为 React 和 Next.js 应用程序设计。它提供了一个简单的 API 来管理翻译,并完全支持 TypeScript。 + + + - 使用 TypeScript 进行类型安全的翻译 + - 支持 React 和 Next.js(App Router) + - 基于命名空间的组织 + - 变量插值 + - 轻量且高效 + + +## 为什么要使用它? + +### 类型安全 + +使用无效翻译键时会得到编译错误: + +```typescript +const { t } = useTranslation("common"); + +t("greeting"); // ✅ 有效的键 +t("invalid_key"); // ❌ TypeScript 错误 +``` + +### 简单的 API + +只有两个 hooks 满足你所有的翻译需求: + +```typescript +// 客户端组件 +const { t } = useTranslation("namespace"); + +// 服务器组件(Next.js) +const { t } = await getTranslation("namespace"); +``` + +### 有序的翻译 + +使用命名空间保持你的翻译有序: + + + + + + + + + + + + + + + + +## 快速示例 + +```tsx +// locales/en/common.json +{ + "greeting": "Hello, {name}!" +} + +// 组件 +import { useTranslation } from "@onruntime/translations/react"; + +function Welcome({ name }) { + const { t } = useTranslation("common"); + + return

{t("greeting", { name })}

; +} +``` + +## 下一步 + + + + + diff --git a/apps/web/src/content/zh/docs/translations/installation.mdx b/apps/web/src/content/zh/docs/translations/installation.mdx new file mode 100644 index 000000000..66db0f52a --- /dev/null +++ b/apps/web/src/content/zh/docs/translations/installation.mdx @@ -0,0 +1,127 @@ +--- +title: 安装 +description: 安装和配置 @onruntime/translations +--- +## 安装 + +使用你喜欢的包管理器安装这个包: + +```bash +# npm +npm install @onruntime/translations + +# yarn +yarn add @onruntime/translations + +# pnpm +pnpm add @onruntime/translations +``` + +## 项目设置 + +### 1. 创建翻译文件 + +在项目中创建一个 `locales` 目录,并为每种语言添加翻译文件: + + + + + + + + + + + + + + +示例 `locales/en/common.json`: + +```json +{ + "title": "欢迎", + "greeting": "你好, {name}!", + "items": { + "one": "{count} 项", + "other": "{count} 项" + } +} +``` + +### 2. 配置 TypeScript(可选) + +为了实现类型安全的翻译,创建一个类型定义文件: + +```typescript +// types/translations.d.ts +import "onruntime/translations"; + +declare module "@onruntime/translations" { + interface TranslationNamespaces { + common: typeof import("../locales/en/common.json"); + auth: typeof import("../locales/en/auth.json"); + } +} +``` + +### 3. 设置提供者 + +用 `TranslationsProvider` 包裹你的应用: + +```tsx +// 对于 React +import { TranslationsProvider } from "@onruntime/translations/react"; +import en from "./locales/en"; +import fr from "./locales/fr"; + +const locales = { en, fr }; + +function App() { + return ( + + + + ); +} +``` + + + 对于使用 App Router 的 Next.js,请查看 [Next.js 使用](/docs/translations/nextjs) 指南以获取推荐设置。 + + +## 验证安装 + +用一个简单的组件测试你的设置: + +```tsx +import { useTranslation } from "@onruntime/translations/react"; + +function TestComponent() { + const { t } = useTranslation("common"); + + return ( +
+

{t("title")}

+

{t("greeting", { name: "World" })}

+
+ ); +} +``` + +如果你看到你的翻译被渲染出来,那就没问题了! + +## 接下来的步骤 + + + + + diff --git a/apps/web/src/content/zh/docs/translations/nextjs.mdx b/apps/web/src/content/zh/docs/translations/nextjs.mdx new file mode 100644 index 000000000..423cd056c --- /dev/null +++ b/apps/web/src/content/zh/docs/translations/nextjs.mdx @@ -0,0 +1,191 @@ +--- +title: Next.js 使用方法 +description: 在 Next.js App Router 中使用 @onruntime/translations +--- +## App Router 的设置 + +### 1. 配置 Provider + +创建一个 providers 文件来设置翻译: + +```tsx +// app/providers.tsx +"use client"; + +import { TranslationsProvider } from "@onruntime/translations/react"; +import { ReactNode } from "react"; + +import en from "@/locales/en"; +import fr from "@/locales/fr"; + +const locales = { en, fr }; + +interface ProvidersProps { + children: ReactNode; + locale: string; +} + +export function Providers({ children, locale }: ProvidersProps) { + return ( + + {children} + + ); +} +``` + +### 2. 设置根布局 + +在你的根布局中使用 provider: + +```tsx +// app/[locale]/layout.tsx +import { Providers } from "../providers"; + +export default function LocaleLayout({ + children, + params, +}: { + children: React.ReactNode; + params: { locale: string }; +}) { + return ( + + {children} + + ); +} +``` + +## 服务器组件 + +在服务器组件中使用 `getTranslation`: + +```tsx +// app/[locale]/page.tsx +import { getTranslation } from "@/lib/translations.server"; + +export default async function HomePage() { + const { t } = await getTranslation("common"); + + return ( +
+

{t("title")}

+

{t("description")}

+
+ ); +} +``` + + + 在服务器组件中使用 `getTranslation`,在客户端组件中使用 `useTranslation`。 + + +## 客户端组件 + +在客户端组件中使用 `useTranslation`: + +```tsx +"use client"; + +import { useTranslation } from "@onruntime/translations/react"; + +export function LanguageSwitcher() { + const { locale, setLocale } = useTranslation("common"); + + return ( + + ); +} +``` + +## 基于地区的路由 + +### 中间件设置 + +设置中间件来处理地区检测: + +```tsx +// middleware.ts +import { NextRequest, NextResponse } from "next/server"; + +const locales = ["en", "fr"]; +const defaultLocale = "en"; + +export function middleware(request: NextRequest) { + const pathname = request.nextUrl.pathname; + + // 检查路径是否包含地区信息 + const pathnameHasLocale = locales.some( + (locale) => pathname.startsWith(`/${locale}/`) || pathname === `/${locale}` + ); + + if (pathnameHasLocale) return; + + // 重定向到默认地区 + return NextResponse.redirect( + new URL(`/${defaultLocale}${pathname}`, request.url) + ); +} + +export const config = { + matcher: ["/((?!api|_next|.*\\..*).*)"], +}; +``` + +## 静态生成 + +为所有地区生成静态页面: + +```tsx +// app/[locale]/page.tsx +export async function generateStaticParams() { + return [{ locale: "en" }, { locale: "fr" }]; +} +``` + +## Link 组件 + +使用翻译过的 Link 组件进行导航: + +```tsx +import { Link } from "@onruntime/translations/next"; + +function Navigation() { + return ( + + ); +} +``` + +`Link` 组件会自动处理地区前缀。 + +## 示例项目结构 + + + + + + + + + + + + + + + + + + + + + + diff --git a/apps/web/src/content/zh/docs/translations/react.mdx b/apps/web/src/content/zh/docs/translations/react.mdx new file mode 100644 index 000000000..21d37f9e2 --- /dev/null +++ b/apps/web/src/content/zh/docs/translations/react.mdx @@ -0,0 +1,157 @@ +--- +title: React 使用 +description: 在 React 应用程序中使用 @onruntime/translations +--- +## 基础用法 + +### useTranslation Hook + +`useTranslation` hook 是你在 React 组件中访问翻译的主要方式: + +```tsx +import { useTranslation } from "@onruntime/translations/react"; + +function MyComponent() { + const { t, locale } = useTranslation("common"); + + return ( +
+

当前语言环境: {locale}

+

{t("title")}

+
+ ); +} +``` + +### 变量插值 + +将变量传递给你的翻译: + +```json +// locales/en/common.json +{ + "greeting": "你好, {name}!", + "items_count": "你有 {count} 个项目" +} +``` + +```tsx +function Greeting({ name, itemCount }) { + const { t } = useTranslation("common"); + + return ( + <> +

{t("greeting", { name })}

+

{t("items_count", { count: itemCount })}

+ + ); +} +``` + +## 多个命名空间 + +你可以在同一个组件中使用多个命名空间: + +```tsx +function Dashboard() { + const { t: tCommon } = useTranslation("common"); + const { t: tDashboard } = useTranslation("dashboard"); + + return ( +
+

{tDashboard("title")}

+ +
+ ); +} +``` + +## 更改语言环境 + +使用 `setLocale` 函数来更改当前语言环境: + +```tsx +import { useTranslation } from "@onruntime/translations/react"; + +function LanguageSwitcher() { + const { locale, setLocale } = useTranslation("common"); + + return ( + + ); +} +``` + +## 嵌套键 + +使用点表示法访问嵌套的翻译键: + +```json +// locales/en/common.json +{ + "nav": { + "home": "首页", + "about": "关于", + "contact": "联系" + } +} +``` + +```tsx +function Navigation() { + const { t } = useTranslation("common"); + + return ( + + ); +} +``` + +## 最佳实践 + + + 按功能或页面组织翻译,而不是把所有内容放在一个文件中。 + + +### 推荐结构 + + + + + + + + + + + + +### 保持键的一致性 + +在所有语言环境中使用一致的命名约定: + +```json +// ✅ 好 - 一致的结构 +{ + "page_title": "仪表板", + "actions": { + "save": "保存", + "cancel": "取消" + } +} + +// ❌ 避免 - 不一致 +{ + "pageTitle": "仪表板", + "save_button": "保存", + "cancelBtn": "取消" +} +``` diff --git a/apps/web/src/locales/ar/app/docs/page.json b/apps/web/src/locales/ar/app/docs/page.json new file mode 100644 index 000000000..2b7843bd2 --- /dev/null +++ b/apps/web/src/locales/ar/app/docs/page.json @@ -0,0 +1,23 @@ +{ + "meta": { + "title": "التوثيق", + "description": "تعرف على كيفية العمل مع onRuntime Studio. استكشف توثيقنا للحصول على الأدلة والدروس وأفضل الممارسات." + }, + "title": "التوثيق", + "subtitle": "مرحباً بك في توثيق onRuntime Studio. تعلم كيف تعمل معنا، واستكشف عملياتنا، واكتشف أفضل الممارسات.", + "toc": { + "title": "في هذه الصفحة" + }, + "reading-time": { + "min-read": "دقائق قراءة", + "words": "كلمات" + }, + "navigation": { + "previous": "سابق", + "next": "التالي", + "last-updated": "تم التحديث آخر مرة في" + }, + "sidebar": { + "title": "التوثيق" + } +} diff --git a/apps/web/src/locales/ar/layout/navbar.json b/apps/web/src/locales/ar/layout/navbar.json index 56647456a..72fe40a7a 100644 --- a/apps/web/src/locales/ar/layout/navbar.json +++ b/apps/web/src/locales/ar/layout/navbar.json @@ -4,6 +4,7 @@ "projects": "مشاريعنا", "agencies": "وكالاتنا", "npo": "الجمعية", + "docs": "الوثائق", "contact": "اتصل بنا" }, "services": { diff --git a/apps/web/src/locales/de/app/docs/page.json b/apps/web/src/locales/de/app/docs/page.json new file mode 100644 index 000000000..17994e805 --- /dev/null +++ b/apps/web/src/locales/de/app/docs/page.json @@ -0,0 +1,23 @@ +{ + "meta": { + "title": "Dokumentation", + "description": "Erfahre, wie du mit onRuntime Studio arbeitest. Durchstöbere unsere Dokumentation für Anleitungen, Tutorials und beste Praktiken." + }, + "title": "Dokumentation", + "subtitle": "Willkommen zur Dokumentation von onRuntime Studio. Erfahre, wie du mit uns arbeitest, entdecke unsere Prozesse und finde beste Praktiken.", + "toc": { + "title": "Auf dieser Seite" + }, + "reading-time": { + "min-read": "min lesen", + "words": "Wörter" + }, + "navigation": { + "previous": "Vorherige", + "next": "Nächste", + "last-updated": "Zuletzt aktualisiert am" + }, + "sidebar": { + "title": "Dokumentation" + } +} diff --git a/apps/web/src/locales/de/layout/navbar.json b/apps/web/src/locales/de/layout/navbar.json index 9aac6d680..dde7acd02 100644 --- a/apps/web/src/locales/de/layout/navbar.json +++ b/apps/web/src/locales/de/layout/navbar.json @@ -4,6 +4,7 @@ "projects": "Unsere Projekte", "agencies": "Unsere Agenturen", "npo": "Der Verein", + "docs": "Dokumente", "contact": "Kontaktiere uns" }, "services": { diff --git a/apps/web/src/locales/es/app/docs/page.json b/apps/web/src/locales/es/app/docs/page.json new file mode 100644 index 000000000..e6686c293 --- /dev/null +++ b/apps/web/src/locales/es/app/docs/page.json @@ -0,0 +1,23 @@ +{ + "meta": { + "title": "Documentación", + "description": "Aprende a trabajar con onRuntime Studio. Explora nuestra documentación para guías, tutoriales y mejores prácticas." + }, + "title": "Documentación", + "subtitle": "Bienvenido a la documentación de onRuntime Studio. Aprende a trabajar con nosotros, explora nuestros procesos y descubre mejores prácticas.", + "toc": { + "title": "En esta página" + }, + "reading-time": { + "min-read": "min lectura", + "words": "palabras" + }, + "navigation": { + "previous": "Anterior", + "next": "Siguiente", + "last-updated": "Última actualización el" + }, + "sidebar": { + "title": "Documentación" + } +} diff --git a/apps/web/src/locales/es/layout/navbar.json b/apps/web/src/locales/es/layout/navbar.json index 859c96fad..2be64a595 100644 --- a/apps/web/src/locales/es/layout/navbar.json +++ b/apps/web/src/locales/es/layout/navbar.json @@ -4,6 +4,7 @@ "projects": "Nuestros proyectos", "agencies": "Nuestras agencias", "npo": "La asociación", + "docs": "Documentos", "contact": "Contáctanos" }, "services": { diff --git a/apps/web/src/locales/hi/app/docs/page.json b/apps/web/src/locales/hi/app/docs/page.json new file mode 100644 index 000000000..e7e6f99c0 --- /dev/null +++ b/apps/web/src/locales/hi/app/docs/page.json @@ -0,0 +1,23 @@ +{ + "meta": { + "title": "डॉक्यूमेंटेशन", + "description": "onRuntime स्टूडियो के साथ काम करना सीखें। मार्गदर्शिकाओं, ट्यूटोरियल, और सर्वोत्तम प्रथाओं के लिए हमारी डॉक्यूमेंटेशन की खोज करें।" + }, + "title": "डॉक्यूमेंटेशन", + "subtitle": "onRuntime स्टूडियो डॉक्यूमेंटेशन में आपका स्वागत है। हमारे साथ काम करना सीखें, हमारे प्रक्रियाओं की खोज करें, और सर्वोत्तम प्रथाओं का पता लगाएं।", + "toc": { + "title": "इस पृष्ठ पर" + }, + "reading-time": { + "min-read": "मिनट पढ़ें", + "words": "शब्द" + }, + "navigation": { + "previous": "पिछला", + "next": "आगे", + "last-updated": "आखिरी अपडेट" + }, + "sidebar": { + "title": "डॉक्यूमेंटेशन" + } +} diff --git a/apps/web/src/locales/hi/layout/navbar.json b/apps/web/src/locales/hi/layout/navbar.json index ec6803764..8a01ada60 100644 --- a/apps/web/src/locales/hi/layout/navbar.json +++ b/apps/web/src/locales/hi/layout/navbar.json @@ -4,6 +4,7 @@ "projects": "हमारे प्रोजेक्ट", "agencies": "हमारे एजेंसियां", "npo": "संस्थान", + "docs": "दस्तावेज़", "contact": "हमसे संपर्क करें" }, "services": { diff --git a/apps/web/src/locales/it/app/docs/page.json b/apps/web/src/locales/it/app/docs/page.json new file mode 100644 index 000000000..d7d49b813 --- /dev/null +++ b/apps/web/src/locales/it/app/docs/page.json @@ -0,0 +1,23 @@ +{ + "meta": { + "title": "Documentazione", + "description": "Scopri come lavorare con onRuntime Studio. Esplora la nostra documentazione per guide, tutorial e migliori pratiche." + }, + "title": "Documentazione", + "subtitle": "Benvenuto nella documentazione di onRuntime Studio. Scopri come lavorare con noi, esplora i nostri processi e scopri le migliori pratiche.", + "toc": { + "title": "In questa pagina" + }, + "reading-time": { + "min-read": "min lettura", + "words": "parole" + }, + "navigation": { + "previous": "Precedente", + "next": "Successivo", + "last-updated": "Ultimo aggiornamento il" + }, + "sidebar": { + "title": "Documentazione" + } +} diff --git a/apps/web/src/locales/it/layout/navbar.json b/apps/web/src/locales/it/layout/navbar.json index f92fc27a4..30860b042 100644 --- a/apps/web/src/locales/it/layout/navbar.json +++ b/apps/web/src/locales/it/layout/navbar.json @@ -4,6 +4,7 @@ "projects": "I nostri progetti", "agencies": "Le nostre agenzie", "npo": "L'associazione", + "docs": "Documenti", "contact": "Contattaci" }, "services": { diff --git a/apps/web/src/locales/ja/app/docs/page.json b/apps/web/src/locales/ja/app/docs/page.json new file mode 100644 index 000000000..6958f0f5a --- /dev/null +++ b/apps/web/src/locales/ja/app/docs/page.json @@ -0,0 +1,23 @@ +{ + "meta": { + "title": "ドキュメント", + "description": "onRuntime Studioの使い方を学ぶ。ガイド、チュートリアル、ベストプラクティスについてのドキュメントを探ってみてね。" + }, + "title": "ドキュメント", + "subtitle": "onRuntime Studioのドキュメントへようこそ。私たちと一緒に作業する方法や、プロセスを探ったり、ベストプラクティスを見つけたりしよう。", + "toc": { + "title": "このページについて" + }, + "reading-time": { + "min-read": "分読", + "words": "単語" + }, + "navigation": { + "previous": "前へ", + "next": "次へ", + "last-updated": "最終更新日" + }, + "sidebar": { + "title": "ドキュメント" + } +} diff --git a/apps/web/src/locales/ja/layout/navbar.json b/apps/web/src/locales/ja/layout/navbar.json index 19c163896..1c6ea93ec 100644 --- a/apps/web/src/locales/ja/layout/navbar.json +++ b/apps/web/src/locales/ja/layout/navbar.json @@ -4,6 +4,7 @@ "projects": "私たちのプロジェクト", "agencies": "私たちのエージェンシー", "npo": "協会", + "docs": "ドキュメント", "contact": "お問い合わせ" }, "services": { diff --git a/apps/web/src/locales/ko/app/docs/page.json b/apps/web/src/locales/ko/app/docs/page.json new file mode 100644 index 000000000..080108e13 --- /dev/null +++ b/apps/web/src/locales/ko/app/docs/page.json @@ -0,0 +1,23 @@ +{ + "meta": { + "title": "문서", + "description": "onRuntime Studio와 함께 작업하는 방법을 배워보세요. 가이드, 튜토리얼, 최선의 방법을 위한 문서를 확인해보세요." + }, + "title": "문서", + "subtitle": "onRuntime Studio 문서에 오신 것을 환영합니다. 우리와 함께 작업하는 방법을 배우고, 우리의 프로세스를 탐색하며, 최선의 방법을 알아보세요.", + "toc": { + "title": "이 페이지에서" + }, + "reading-time": { + "min-read": "분 소요", + "words": "단어" + }, + "navigation": { + "previous": "이전", + "next": "다음", + "last-updated": "마지막 업데이트:" + }, + "sidebar": { + "title": "문서" + } +} diff --git a/apps/web/src/locales/ko/layout/navbar.json b/apps/web/src/locales/ko/layout/navbar.json index 68deb1a57..76fabd71f 100644 --- a/apps/web/src/locales/ko/layout/navbar.json +++ b/apps/web/src/locales/ko/layout/navbar.json @@ -4,6 +4,7 @@ "projects": "우리 프로젝트", "agencies": "우리 기관", "npo": "협회", + "docs": "문서", "contact": "문의하기" }, "services": { diff --git a/apps/web/src/locales/nl/app/docs/page.json b/apps/web/src/locales/nl/app/docs/page.json new file mode 100644 index 000000000..8cae3e3b2 --- /dev/null +++ b/apps/web/src/locales/nl/app/docs/page.json @@ -0,0 +1,23 @@ +{ + "meta": { + "title": "Documentatie", + "description": "Leer hoe je met onRuntime Studio aan de slag gaat. Verken onze documentatie voor handleidingen, tutorials en best practices." + }, + "title": "Documentatie", + "subtitle": "Welkom bij de onRuntime Studio documentatie. Leer hoe je met ons samenwerkt, verken onze processen en ontdek best practices.", + "toc": { + "title": "Op deze pagina" + }, + "reading-time": { + "min-read": "min lezen", + "words": "woorden" + }, + "navigation": { + "previous": "Vorige", + "next": "Volgende", + "last-updated": "Laatst bijgewerkt op" + }, + "sidebar": { + "title": "Documentatie" + } +} diff --git a/apps/web/src/locales/nl/layout/navbar.json b/apps/web/src/locales/nl/layout/navbar.json index ff9a73bfa..fb941f566 100644 --- a/apps/web/src/locales/nl/layout/navbar.json +++ b/apps/web/src/locales/nl/layout/navbar.json @@ -4,6 +4,7 @@ "projects": "Onze projecten", "agencies": "Onze bureaus", "npo": "De vereniging", + "docs": "Docs", "contact": "Neem contact met ons op" }, "services": { diff --git a/apps/web/src/locales/pl/app/docs/page.json b/apps/web/src/locales/pl/app/docs/page.json new file mode 100644 index 000000000..e801775b7 --- /dev/null +++ b/apps/web/src/locales/pl/app/docs/page.json @@ -0,0 +1,23 @@ +{ + "meta": { + "title": "Dokumentacja", + "description": "Dowiedz się, jak pracować z onRuntime Studio. Przeglądaj naszą dokumentację, aby znaleźć przewodniki, samouczki i najlepsze praktyki." + }, + "title": "Dokumentacja", + "subtitle": "Witamy w dokumentacji onRuntime Studio. Dowiedz się, jak z nami pracować, odkryj nasze procesy i poznaj najlepsze praktyki.", + "toc": { + "title": "Na tej stronie" + }, + "reading-time": { + "min-read": "min czytania", + "words": "słów" + }, + "navigation": { + "previous": "Poprzedni", + "next": "Następny", + "last-updated": "Ostatnia aktualizacja" + }, + "sidebar": { + "title": "Dokumentacja" + } +} diff --git a/apps/web/src/locales/pl/layout/navbar.json b/apps/web/src/locales/pl/layout/navbar.json index e3dd7b3fc..8889ad22f 100644 --- a/apps/web/src/locales/pl/layout/navbar.json +++ b/apps/web/src/locales/pl/layout/navbar.json @@ -4,6 +4,7 @@ "projects": "Nasze projekty", "agencies": "Nasze agencje", "npo": "Stowarzyszenie", + "docs": "Dokumenty", "contact": "Skontaktuj się z nami" }, "services": { diff --git a/apps/web/src/locales/pt/app/docs/page.json b/apps/web/src/locales/pt/app/docs/page.json new file mode 100644 index 000000000..a95d155b1 --- /dev/null +++ b/apps/web/src/locales/pt/app/docs/page.json @@ -0,0 +1,23 @@ +{ + "meta": { + "title": "Documentação", + "description": "Aprenda a trabalhar com o onRuntime Studio. Explore nossa documentação para guias, tutoriais e melhores práticas." + }, + "title": "Documentação", + "subtitle": "Bem-vindo à documentação do onRuntime Studio. Aprenda a trabalhar conosco, explore nossos processos e descubra as melhores práticas.", + "toc": { + "title": "Nesta página" + }, + "reading-time": { + "min-read": "min de leitura", + "words": "palavras" + }, + "navigation": { + "previous": "Anterior", + "next": "Próximo", + "last-updated": "Última atualização em" + }, + "sidebar": { + "title": "Documentação" + } +} diff --git a/apps/web/src/locales/pt/layout/navbar.json b/apps/web/src/locales/pt/layout/navbar.json index ee2c97b9a..21cd7362b 100644 --- a/apps/web/src/locales/pt/layout/navbar.json +++ b/apps/web/src/locales/pt/layout/navbar.json @@ -4,6 +4,7 @@ "projects": "Nossos projetos", "agencies": "Nossas agências", "npo": "A associação", + "docs": "Documentos", "contact": "Entre em contato conosco" }, "services": { diff --git a/apps/web/src/locales/sv/app/docs/page.json b/apps/web/src/locales/sv/app/docs/page.json new file mode 100644 index 000000000..b175ed3c7 --- /dev/null +++ b/apps/web/src/locales/sv/app/docs/page.json @@ -0,0 +1,23 @@ +{ + "meta": { + "title": "Dokumentation", + "description": "Lär dig hur du arbetar med onRuntime Studio. Utforska vår dokumentation för guider, handledningar och bästa metoder." + }, + "title": "Dokumentation", + "subtitle": "Välkommen till dokumentationen för onRuntime Studio. Lär dig hur du arbetar med oss, utforska våra processer och upptäck bästa metoder.", + "toc": { + "title": "På den här sidan" + }, + "reading-time": { + "min-read": "min läsning", + "words": "ord" + }, + "navigation": { + "previous": "Föregående", + "next": "Nästa", + "last-updated": "Senast uppdaterad den" + }, + "sidebar": { + "title": "Dokumentation" + } +} diff --git a/apps/web/src/locales/sv/layout/navbar.json b/apps/web/src/locales/sv/layout/navbar.json index d85b0cd68..dae92d3bb 100644 --- a/apps/web/src/locales/sv/layout/navbar.json +++ b/apps/web/src/locales/sv/layout/navbar.json @@ -4,6 +4,7 @@ "projects": "Våra projekt", "agencies": "Våra byråer", "npo": "Föreningen", + "docs": "Dokument", "contact": "Kontakta oss" }, "services": { diff --git a/apps/web/src/locales/tr/app/docs/page.json b/apps/web/src/locales/tr/app/docs/page.json new file mode 100644 index 000000000..d7981880c --- /dev/null +++ b/apps/web/src/locales/tr/app/docs/page.json @@ -0,0 +1,23 @@ +{ + "meta": { + "title": "Dokümantasyon", + "description": "onRuntime Studio ile nasıl çalışacağınızı öğrenin. Kılavuzlar, öğreticiler ve en iyi uygulamalar için belgelerimize göz atın." + }, + "title": "Dokümantasyon", + "subtitle": "onRuntime Studio belgelerine hoş geldiniz. Bizimle nasıl çalışacağınızı öğrenin, süreçlerimizi keşfedin ve en iyi uygulamaları öğrenin.", + "toc": { + "title": "Bu sayfada" + }, + "reading-time": { + "min-read": "dakika okunma süresi", + "words": "kelime" + }, + "navigation": { + "previous": "Önceki", + "next": "Sonraki", + "last-updated": "Son güncelleme" + }, + "sidebar": { + "title": "Dokümantasyon" + } +} diff --git a/apps/web/src/locales/tr/layout/navbar.json b/apps/web/src/locales/tr/layout/navbar.json index 98bc4b5a2..1852563a4 100644 --- a/apps/web/src/locales/tr/layout/navbar.json +++ b/apps/web/src/locales/tr/layout/navbar.json @@ -4,6 +4,7 @@ "projects": "Projelerimiz", "agencies": "Ajanslarımız", "npo": "Dernek", + "docs": "Belgeler", "contact": "Bize ulaşın" }, "services": { diff --git a/apps/web/src/locales/zh/app/docs/page.json b/apps/web/src/locales/zh/app/docs/page.json new file mode 100644 index 000000000..68da88659 --- /dev/null +++ b/apps/web/src/locales/zh/app/docs/page.json @@ -0,0 +1,23 @@ +{ + "meta": { + "title": "文档", + "description": "了解如何使用 onRuntime Studio。探索我们的文档,获取指南、教程和最佳实践。" + }, + "title": "文档", + "subtitle": "欢迎来到 onRuntime Studio 文档。了解如何与我们合作,探索我们的流程,发现最佳实践。", + "toc": { + "title": "本页内容" + }, + "reading-time": { + "min-read": "分钟阅读", + "words": "字" + }, + "navigation": { + "previous": "上一个", + "next": "下一个", + "last-updated": "最后更新于" + }, + "sidebar": { + "title": "文档" + } +} diff --git a/apps/web/src/locales/zh/layout/navbar.json b/apps/web/src/locales/zh/layout/navbar.json index addc480f6..c6dbeb1bb 100644 --- a/apps/web/src/locales/zh/layout/navbar.json +++ b/apps/web/src/locales/zh/layout/navbar.json @@ -4,6 +4,7 @@ "projects": "我们的项目", "agencies": "我们的机构", "npo": "协会", + "docs": "文档", "contact": "联系我们" }, "services": {