סקר מחקר: נשמח לשמוע על החוויה שלך עם Blockly
לפתיחת הסקר
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
blockly > setLocale
הפונקציה setLocale()
מגדיר את הלוקאל (כלומר, הלוקאלים של messages/block-text/etc) ללוקאל הנתון.
האפשרות הזו לא שימושית או נדרשת בטעינה מתג סקריפט, כי ההודעות מצורפות באופן אוטומטי לאובייקט Blockly.Msg. אך אנו מספקים אותו גם בהקשרים של תג script וגם בהקשר שאינו תג סקריפט, כדי שה-tcompiler יוכל ליצור כראוי את קובצי ההגדרה של הסוג שלנו.
Signature:
setLocale: (locale: {
[key: string]: string;
}) => void
פרמטרים
פרמטר |
סוג |
תיאור |
שילוב של שפה ואזור |
{ [key: string]: string; } |
אובייקט שמגדיר את ההודעות של שפה מסוימת. |
החזרות:
ריק
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2024-11-04 (שעון UTC).
[[["התוכן קל להבנה","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 (שעון UTC)."],[[["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"]]