Stay organized with collections
Save and categorize content based on your preferences.
blockly > setLocale
setLocale() function
Sets the locale (i.e. the localized messages/block-text/etc) to the given locale.
This is not useful/necessary when loading from a script tag, because the messages are automatically cluged into the Blockly.Msg object. But we provide it in both the script-tag and non-script-tag contexts so that the tscompiler can properly create our type definition files.
Signature:
setLocale: (locale: {
[key: string]: string;
}) => void
Parameters
Parameter |
Type |
Description |
locale |
{ [key: string]: string; } |
An object defining the messages for a given language. |
Returns:
void
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-09-18 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-09-18 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."]]],[]]