Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
blockly > setLocale
Funkcja setLocale()
Ustawia język (np. zlokalizowane komunikaty, tekst blokujący itp.) na wybrany język.
Nie jest to przydatne ani konieczne podczas wczytywania z tagu skryptu, ponieważ wiadomości są automatycznie dołączane do obiektu Blockly.Msg. Udostępniamy je jednak zarówno w kontekście tagu skryptu, jak i bez niego, aby kompilator ts mógł prawidłowo tworzyć pliki definicji typów.
Podpis:
setLocale: (locale: {
[key: string]: string;
}) => void
Parametry
Parametr |
Typ |
Opis |
region |
{ [key: string]: string; } |
Obiekt definiujący komunikaty w danym języku. |
Zwroty:
nieważne
O ile nie stwierdzono inaczej, treść tej strony jest objęta licencją Creative Commons – uznanie autorstwa 4.0, a fragmenty kodu są dostępne na licencji Apache 2.0. Szczegółowe informacje na ten temat zawierają zasady dotyczące witryny Google Developers. Java jest zastrzeżonym znakiem towarowym firmy Oracle i jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2024-11-04 UTC.
[[["Łatwo zrozumieć","easyToUnderstand","thumb-up"],["Rozwiązało to mój problem","solvedMyProblem","thumb-up"],["Inne","otherUp","thumb-up"]],[["Brak potrzebnych mi informacji","missingTheInformationINeed","thumb-down"],["Zbyt skomplikowane / zbyt wiele czynności do wykonania","tooComplicatedTooManySteps","thumb-down"],["Nieaktualne treści","outOfDate","thumb-down"],["Problem z tłumaczeniem","translationIssue","thumb-down"],["Problem z przykładami/kodem","samplesCodeIssue","thumb-down"],["Inne","otherDown","thumb-down"]],["Ostatnia aktualizacja: 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"]]