요약
메서드
GetCorescriptLocalizations():Instances |
GetCountryRegionForPlayerAsync(player: Instance):string |
GetTableEntries(instance: Instance):{any} |
GetTranslatorForLocaleAsync(locale: string):Instance |
GetTranslatorForPlayer(player: Instance):Instance |
GetTranslatorForPlayerAsync(player: Instance):Instance |
상속된 멤버
API 참조
속성
메서드
GetCorescriptLocalizations
LocalizationService:GetCorescriptLocalizations():Instances
반환
Instances
GetCountryRegionForPlayerAsync
매개 변수
반환
코드 샘플
플레이어의 국가/지역 코드 가져오기
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("안녕하세요, 캐나다에서 온 친구!")
else
print("GetCountryRegionForPlayerAsync 실패: " .. code)
endGetTableEntries
GetTranslatorForLocaleAsync
매개 변수
반환
코드 샘플
로케일에 대한 번역가 가져오기 및 사용하기
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("프랑스어로 인사하기: " .. result)
else
print("GetTranslatorForLocaleAsync 실패함: " .. translator)
endGetTranslatorForPlayer
GetTranslatorForPlayerAsync
매개 변수
반환
코드 샘플
플레이어를 위한 번역기 가져오기 및 사용하기
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, "Hello World!")
print(result)
else
print("GetTranslatorForPlayerAsync failed: " .. translator)
end