التوثيق

التوطين

برنامج واحد بعدة لغات: نصوص من كتالوج لكل لغة، وصفوف معبّأة لكل لغة، وتخطيط من اليمين إلى اليسار.

يعلن البرنامج اللغات التي يُشحن بها في ترويسة app. تنتقل النصوص إلى كتالوج لكل لغة، ولغة الزائر تحدد أيها يُعرض.

إعلان اللغات

text
1 2 3 app greeting "1.0.0" "A greeting in three languages." locales [en, ar, sl]

en إلزامية. ولكل لغة كتالوج JSON مسطّح بجانب البرنامج في locales/<locale>/<app>.json:

json
1 2 3 4 ▼{ "hello": "Hello from Orb", "cities": "{{n}} cities, seeded in your language" }

استخدام الكتالوج

lolo
1 2 3 4 ▼(render-ui main { type: stack, direction: vertical, gap: sm, children: [ { type: typography, content: (i18n/t "hello"), variant: h3 }, { type: typography, content: (i18n/t "cities" { n: (array/len ?data) }), variant: small } ] })

(i18n/t "key") و@locale خاصّان بوقت العرض: مكانهما داخل render-ui، لا في شرط ولا في set ولا في بث. يتحقق orb validate من الكتالوجات مقابل الاستدعاءات: المفتاح الغائب عن أي لغة معلنة، والعناصر النائبة التي لا تطابق المعاملات، والمفاتيح غير المستخدمة، كلها تُبلَّغ. تُسبَق المفاتيح باسم التطبيق عند انخفاض البرنامج، فتندمج كتالوجات سلوكيات كثيرة مستوردة دون تصادم.

صفوف لكل لغة

يستطيع الكيان المخزّن في المتصفح أن يعبّئ صفوفًا مختلفة لكل لغة:

آلة الحالات

Greeting

on City · states: 2 · transitions: 4
emitsCitiesLoadedemitsCitiesFailedemitsMOVED
INIT
CitiesLoaded
CitiesFailed
INIT
1loading
nowready
يعمل الآن مباشرة

مرحبًا من Orb

2 مدن، مُدخلة بلغتك

ليوبليانا

الرياض

std-orb-docex-greeting.lolololo
1app std-orb-docex-greeting "1.0.0" 2"std-orb-docex-greeting — one program in three languages: copy from per-locale catalogs, records seeded per locale." 3locales [en, ar, sl] 4 5orbital GreetingOrbital { 6 entity City [persistent: docex_cities, local] { 7 id : string! 8 name : string! 9 instances [ 10 { id: "C-1", name: "Ljubljana" }, 11 { id: "C-2", name: "Riyadh" } 12 ] 13 instances ar [ 14 { id: "C-1", name: "ليوبليانا" }, 15 { id: "C-2", name: "الرياض" } 16 ] 17 instances sl [ 18 { id: "C-1", name: "Ljubljana" }, 19 { id: "C-2", name: "Rijad" } 20 ] 21 } 22 23 trait Greeting -> City [interaction, collection] { 24 initial: loading 25 26 state loading { 27 INIT -> loading 28 (fetch City { emit: { success: CitiesLoaded, failure: CitiesFailed } }) 29 CitiesLoaded -> ready 30 (emit MOVED { event: "CitiesLoaded" }) 31 (render-ui main { type: stack, direction: vertical, gap: sm, children: [ 32 { type: typography, content: (i18n/t "hello"), variant: h3 }, 33 { type: typography, content: (i18n/t "cities" { n: (array/len ?data) }), variant: small, color: muted }, 34 { type: data-list, entity: ?data, fields: [{ name: "name", label: (i18n/t "city"), variant: h4 }] } 35 ] }) 36 CitiesFailed -> ready 37 (emit MOVED { event: "CitiesFailed" }) 38 (render-ui main { type: alert, variant: error, message: ?error }) 39 } 40 41 state ready { 42 INIT -> loading 43 (emit MOVED { event: "INIT" }) 44 (fetch City { emit: { success: CitiesLoaded, failure: CitiesFailed } }) 45 } 46 47 emits { 48 CitiesLoaded { 49 data : [City] 50 } 51 CitiesFailed { 52 error : string 53 } 54 MOVED -> external { 55 event : string! 56 } 57 @description "Each move names the event it took, so the diagram beside the demo can follow it." 58 } 59 } 60 61 page "/greeting" -> Greeting 62}

يحمل instances صفوف اللغة الافتراضية، وما إن تُكتب كتلة instances <locale> واحدة حتى تحتاج كل لغة معلنة أخرى إلى كتلة. لكل لغة قاعدة بيانات متصفح خاصة بها، فتبقى سجلات الزائر بلغة واحدة.

المسارات والاتجاه

يقدّم الموقع عادة كل لغة تحت بادئة: / و/ar و/sl. تُعرض الصفحة باللغة التي يسمّيها مسارها، واللغات التي تُكتب من اليمين إلى اليسار كالعربية تضبط dir="rtl" للصفحة كلها. المحتوى الطويل، كالمقالات وهذا التوثيق، يُكتب مرة لكل لغة كسلوك مستقل لا كمفاتيح كتالوج.

كتابة البرنامج نفسه بلغة أخرى

للكلمات المفتاحية والوسوم والعوامل في اللغة نسخ عربية وسلوفينية، فيمكن كتابة البرنامج بلغتك. أسماؤك الخاصة (الكيانات والسمات والحالات والأحداث) لا تُترجم أبدًا، فالبرنامج المكتوب بلغتك وتوأمه الإنجليزي ينخفضان إلى .orb نفسه. الأمر orb i18n vocab يطبع المفردات.

Orb

اللغة التي تكون فيها القاعدة هي البرنامج.

© 2026 المدار. ليوبليانا، سلوفينيا.