Motor Sınıfı
LocalizationService
*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
GetCorescriptLocalizations():Instances |
GetCountryRegionForPlayerAsync(player: Instance):string |
GetTableEntries(instance: Instance):{any} |
GetTranslatorForLocaleAsync(locale: string):Instance |
GetTranslatorForPlayer(player: Instance):Instance |
GetTranslatorForPlayerAsync(player: Instance):Instance |
API Referansı
Özellikler
Yöntemler
GetCorescriptLocalizations
LocalizationService:GetCorescriptLocalizations():Instances
Dönüşler
Instances
GetCountryRegionForPlayerAsync
Parametreler
Dönüşler
Kod Örnekleri
Bir Oyuncu için Ülke/Bölge Kodunu Alma
local LocalizationService = game:GetService("LocalizationService")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local result, code = pcall(LocalizationService.GetCountryRegionForPlayerAsync, LocalizationService, player)
if result and code == "CA" then
print("Merhaba, Kanada'dan arkadaş!")
else
print("GetCountryRegionForPlayerAsync başarısız oldu: " .. code)
endGetTableEntries
GetTranslatorForLocaleAsync
Parametreler
Dönüşler
Kod Örnekleri
Bir Yerel İçin Çevirmen Alma ve Kullanma
local LocalizationService = game:GetService("LocalizationService")
local textLabel = script.Parent
local success, translator = pcall(function()
return LocalizationService:GetTranslatorForLocaleAsync("fr")
end)
if success then
local result = translator:Translate(textLabel, "Hello World!")
print("Fransızca Merhaba: " .. result)
else
print("GetTranslatorForLocaleAsync başarısız oldu: " .. translator)
endGetTranslatorForPlayer
GetTranslatorForPlayerAsync
Parametreler
Dönüşler
Kod Örnekleri
Bir Oyuncu için Çevirmen Almak ve Kullanmak
local LocalizationService = game:GetService("LocalizationService")
local Players = game:GetService("Players")
local textLabel = script.Parent
local success, translator = pcall(function()
return LocalizationService:GetTranslatorForPlayerAsync(Players.LocalPlayer)
end)
if success then
local result = translator:Translate(textLabel, "Merhaba Dünya!")
print(result)
else
print("GetTranslatorForPlayerAsync başarısız oldu: " .. translator)
end