Method PickerBuilder.setLocale
ตั้งค่าภาษาสำหรับเครื่องมือเลือก ภาษาคือรหัสภาษา ISO 639 หากระบบไม่รองรับภาษานั้น ระบบจะใช้ en-US
ตัวอย่าง
การใช้งานพื้นฐาน
const builder = new google.pickerPickerBuilder()
.setLocale('ES_419');
ตั้งค่าภาษาจากภาษาของตัวนำทาง
const builder = new google.pickerPickerBuilder()
.setLocale(navigator.languages[0]);
ดูข้อมูลเพิ่มเติมที่ Navigator.languages
ลายเซ็น
setLocale(locale: Locales): PickerBuilder;
รายละเอียด
ไม่บังคับ |
ไม่ได้ |
รอบชิงชนะเลิศ |
ไม่ได้ |
มีการป้องกัน |
ไม่ได้ |
คงที่ |
ไม่ได้ |
พารามิเตอร์
ชื่อ |
ประเภท |
ไม่บังคับ |
คำอธิบาย |
locale |
Locales |
ไม่ได้ |
|
การคืนสินค้า
PickerBuilder
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2024-11-07 UTC
[null,null,["อัปเดตล่าสุด 2024-11-07 UTC"],[[["The `setLocale` method configures the language for the Google Picker using an ISO 639 language code, defaulting to en-US if the specified language isn't supported."],["Developers can utilize the `navigator.languages` property to dynamically set the locale based on the user's browser preferences."],["The method accepts a single parameter, `locale`, which should be a valid locale identifier as defined in the Locales documentation."],["Calling `setLocale` returns the `PickerBuilder` instance, enabling method chaining for further configuration."]]],[]]