تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
blockly > setLocale
دالة setLocale()
تُستخدَم لضبط اللغة (أي الرسائل/النصوص المُعدَّلة/غير ذلك) على اللغة المحدّدة.
لا يكون هذا مفيدًا أو ضروريًا عند التحميل من علامة نص برمجي، لأنّ الرسائل يتم إلحاقها تلقائيًا بعنصر Blockly.Msg. ولكننا نوفّره في سياق علامة نص برمجي وسياق غير علامة نص برمجي حتى يتمكّن مجمع tscompiler من إنشاء ملفات تعريف الأنواع بشكل صحيح.
Signature:
setLocale: (locale: {
[key: string]: string;
}) => void
المعلمات
المَعلمة |
النوع |
الوصف |
locale |
{ [key: string]: string; } |
تمثّل هذه السمة كائنًا يحدّد الرسائل للغة معيّنة. |
المرتجعات:
فراغ
إنّ محتوى هذه الصفحة مرخّص بموجب ترخيص Creative Commons Attribution 4.0 ما لم يُنصّ على خلاف ذلك، ونماذج الرموز مرخّصة بموجب ترخيص Apache 2.0. للاطّلاع على التفاصيل، يُرجى مراجعة سياسات موقع Google Developers. إنّ Java هي علامة تجارية مسجَّلة لشركة Oracle و/أو شركائها التابعين.
تاريخ التعديل الأخير: 2024-11-04 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","easyToUnderstand","thumb-up"],["ساعَدني المحتوى في حلّ مشكلتي.","solvedMyProblem","thumb-up"],["غير ذلك","otherUp","thumb-up"]],[["لا يحتوي على المعلومات التي أحتاج إليها.","missingTheInformationINeed","thumb-down"],["الخطوات معقدة للغاية / كثيرة جدًا.","tooComplicatedTooManySteps","thumb-down"],["المحتوى قديم.","outOfDate","thumb-down"],["ثمة مشكلة في الترجمة.","translationIssue","thumb-down"],["مشكلة في العيّنات / التعليمات البرمجية","samplesCodeIssue","thumb-down"],["غير ذلك","otherDown","thumb-down"]],["تاريخ التعديل الأخير: 2024-11-04 (حسب التوقيت العالمي المتفَّق عليه)"],[[["The `setLocale()` function sets the locale for Blockly, determining the language used for messages and block text."],["While automatically handled when Blockly is loaded via a script tag, `setLocale()` is crucial for non-script-tag loading and type definition generation."],["It accepts a single argument: an object containing key-value pairs representing the localized messages for the desired language."]]],["The `setLocale()` function sets the localized messages for Blockly. It accepts a `locale` object where keys are strings and values are the corresponding translated messages. This function is primarily used in non-script-tag contexts for setting custom locales. While it's not necessary when using a script tag, it's included for type definition purposes in the TypeScript compiler. The function takes the locale object as the only parameter and doesn't return any value.\n"]]