เรียนรู้
Engine Class
LocalizationTable

*เนื้อหานี้แปลโดยใช้ AI (เวอร์ชัน Beta) และอาจมีข้อผิดพลาด หากต้องการดูหน้านี้เป็นภาษาอังกฤษ ให้คลิกที่นี่


สรุป
คุณสมบัติ
DevelopmentLanguage:string
เลิกใช้แล้ว
Root:Instance
เลิกใช้แล้ว
วิธีการ
GetContents():string
เลิกใช้แล้ว
GetString(targetLocaleId: string,key: string):string
เลิกใช้แล้ว
RemoveEntry(key: string,source: string,context: string):()
RemoveEntryValue(key: string,source: string,context: string,localeId: string):()
RemoveKey(key: string):()
เลิกใช้แล้ว
SetContents(contents: string):()
เลิกใช้แล้ว
SetEntries(entries: Variant):()
SetEntry(key: string,targetLocaleId: string,text: string):()
เลิกใช้แล้ว
SetEntryContext(key: string,source: string,context: string,newContext: string):()
SetEntryExample(key: string,source: string,context: string,example: string):()
SetEntryKey(key: string,source: string,context: string,newKey: string):()
SetEntrySource(key: string,source: string,context: string,newSource: string):()
SetEntryValue(key: string,source: string,context: string,localeId: string,text: string):()
สมาชิกที่ได้รับทอด
ตัวอย่างโค้ด
ตารางการปรับท้องถิ่น
local LocalizationService = game:GetService("LocalizationService")
local function createLocalizationTable(entries): LocalizationTable
local localTable = Instance.new("LocalizationTable")
localTable.SourceLocaleId = LocalizationService.SystemLocaleId
localTable:SetEntries(entries)
return localTable
end
local entries = {
{
Key = "Hello_World", -- 'expressionKey' ที่จะใช้กับ GetString
Values = { -- พจนานุกรมของคีย์ที่ตรงกับ IETF language tags และการแปลของพวกเขา
["ru"] = " !", -- รัสเซีย
["fr"] = "Bonjour le monde!", -- ฝรั่งเศส
["de"] = "Hallo Welt!", -- เยอรมัน
["en-US"] = "Hello world!", -- อังกฤษ
["it"] = "Ciao mondo!", -- อิตาลี
["pt-BR"] = "Ol Mundo!", -- โปรตุเกส
["ja"] = "", -- ญี่ปุ่น
["es"] = "Hola Mundo!", -- สเปน
},
},
}
local helloWorldTable = createLocalizationTable(entries)
local translatorEnglish = helloWorldTable:GetTranslator("en-US")
print(translatorEnglish:FormatByKey("Hello_World"))

เอกสารอ้างอิงเกี่ยวกับ API
คุณสมบัติ
DevelopmentLanguage
เลิกใช้แล้ว

Root
เลิกใช้แล้ว

SourceLocaleId
อ่านพร้อมๆ กัน
ความสามารถ: Basic
LocalizationTable.SourceLocaleId:string

วิธีการ
GetContents
เลิกใช้แล้ว

GetEntries
ความสามารถ: Basic
LocalizationTable:GetEntries():{any}
ส่งค่ากลับ
ตัวอย่างโค้ด
การใช้ LocalizationTable
local LocalizationService = game:GetService("LocalizationService")
local localizationTable = LocalizationService:FindFirstChild("LocalizationTable")
local entries = {
{
["Key"] = "0001",
["Source"] = "en-us",
["Values"] = {
["0001"] = "สวัสดีคุณแม่ สวัสดีคุณพ่อ.",
["0002"] = "นี่ฉันอยู่ที่แคมป์กรานาดา.",
["0003"] = "แคมป์สนุกมาก.",
["0004"] = "และพวกเขาบอกว่าเราจะสนุกถ้ามันหยุดฝน.",
},
},
}
localizationTable:SetEntries(entries)
local get_results = localizationTable:GetEntries()
for _index, dict in pairs(get_results) do
for _key, value in pairs(dict["Values"]) do -- วนผ่านทุกคู่คีย์และค่าในพจนานุกรมเพื่อตีพิมพ์สายอักขระของเรา
print(value)
end
end

GetString
เลิกใช้แล้ว

GetTranslator
ความสามารถ: Basic
LocalizationTable:GetTranslator(localeId:string):Instance
พารามิเตอร์
localeId:string
ส่งค่ากลับ

RemoveEntry
ความสามารถ: Basic
LocalizationTable:RemoveEntry(
key:string, source:string, context:string
):()
พารามิเตอร์
key:string
source:string
context:string
ส่งค่ากลับ
()

RemoveEntryValue
ความสามารถ: Basic
LocalizationTable:RemoveEntryValue(
key:string, source:string, context:string, localeId:string
):()
พารามิเตอร์
key:string
source:string
context:string
localeId:string
ส่งค่ากลับ
()

RemoveKey
เลิกใช้แล้ว

RemoveTargetLocale
ความสามารถ: Basic
LocalizationTable:RemoveTargetLocale(localeId:string):()
พารามิเตอร์
localeId:string
ส่งค่ากลับ
()

SetContents
เลิกใช้แล้ว

SetEntries
ความสามารถ: Basic
LocalizationTable:SetEntries(entries:Variant):()
พารามิเตอร์
entries:Variant
ส่งค่ากลับ
()

SetEntry
เลิกใช้แล้ว

SetEntryContext
ความสามารถ: Basic
LocalizationTable:SetEntryContext(
key:string, source:string, context:string, newContext:string
):()
พารามิเตอร์
key:string
source:string
context:string
newContext:string
ส่งค่ากลับ
()

SetEntryExample
ความสามารถ: Basic
LocalizationTable:SetEntryExample(
key:string, source:string, context:string, example:string
):()
พารามิเตอร์
key:string
source:string
context:string
example:string
ส่งค่ากลับ
()

SetEntryKey
ความสามารถ: Basic
LocalizationTable:SetEntryKey(
key:string, source:string, context:string, newKey:string
):()
พารามิเตอร์
key:string
source:string
context:string
newKey:string
ส่งค่ากลับ
()

SetEntrySource
ความสามารถ: Basic
LocalizationTable:SetEntrySource(
key:string, source:string, context:string, newSource:string
):()
พารามิเตอร์
key:string
source:string
context:string
newSource:string
ส่งค่ากลับ
()

SetEntryValue
ความสามารถ: Basic
LocalizationTable:SetEntryValue(
key:string, source:string, context:string, localeId:string, text:string
):()
พารามิเตอร์
key:string
source:string
context:string
localeId:string
text:string
ส่งค่ากลับ
()

©2026 Roblox Corporation. Roblox, โลโก้ Roblox และ Powering Imagination เป็นส่วนหนึ่งของเครื่องหมายการค้าที่จดทะเบียน และไม่ได้จดทะเบียนของเราในสหรัฐฯ และประเทศอื่นๆ