Motor Sınıfı
LocalizationTable
*Bu içerik, yapay zekâ (beta) kullanılarak çevrildi ve hatalar içerebilir. Sayfayı İngilizce görüntülemek için buraya tıkla.
Özet
Özellikler
Yöntemler
GetTranslator(localeId: string):Instance |
RemoveEntry(key: string,source: string,context: string):() |
RemoveEntryValue(key: string,source: string,context: string,localeId: string):() |
RemoveTargetLocale(localeId: string):() |
SetContents(contents: string):() |
SetEntries(entries: Variant):() |
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):() |
Kod Örnekleri
YerelleştirmeTablosu
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", -- GetString ile kullanılması gereken 'expressionKey'
Values = { -- IETF dil etiketlerine karşılık gelen anahtarların ve çevirilerinin bir sözlüğü.
["ru"] = " !", -- Rusça
["fr"] = "Bonjour le monde!", -- Fransızca
["de"] = "Hallo Welt!", -- Almanca
["en-US"] = "Hello world!", -- İngilizce
["it"] = "Ciao mondo!", -- İtalyanca
["pt-BR"] = "Ol Mundo!", -- Portekizce
["ja"] = "", -- Japonca
["es"] = "Hola Mundo!", -- İspanyolca
},
},
}
local helloWorldTable = createLocalizationTable(entries)
local translatorEnglish = helloWorldTable:GetTranslator("en-US")
print(translatorEnglish:FormatByKey("Hello_World"))API Referansı
Özellikler
DevelopmentLanguage
Root
Yöntemler
GetContents
GetEntries
Dönüşler
Kod Örnekleri
Bir LocalizationTable Kullanma
local LocalizationService = game:GetService("LocalizationService")
local localizationTable = LocalizationService:FindFirstChild("LocalizationTable")
local entries = {
{
["Key"] = "0001",
["Source"] = "en-us",
["Values"] = {
["0001"] = "Merhaba Muddah, merhaba Fadduh.",
["0002"] = "Camp Granada'dayım.",
["0003"] = "Kamp çok eğlenceli.",
["0004"] = "Ve eğer yağmur durursa eğleneceğiz, diyorlar.",
},
},
}
localizationTable:SetEntries(entries)
local get_results = localizationTable:GetEntries()
for _index, dict in pairs(get_results) do
for _key, value in pairs(dict["Values"]) do -- Sözlükteki her anahtar, değer çiftini döngüye alarak dizelerimizi yazdır
print(value)
end
endGetString
GetTranslator
RemoveEntry
RemoveEntryValue
RemoveKey
RemoveTargetLocale
SetContents
SetEntries
LocalizationTable:SetEntries(entries:Variant):()
Parametreler
entries:Variant |
Dönüşler
()
SetEntry
SetEntryContext
SetEntryExample
SetEntryKey
SetEntrySource