요약
메서드
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):() |
상속된 멤버
코드 샘플
현지화 테이블
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 함수에서 사용할 'expressionKey'
Values = { -- IETF 언어 태그에 해당하는 키의 사전과 그 번역.
["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
메서드
GetContents
GetEntries
반환
코드 샘플
로컬라이제이션 테이블 사용하기
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
endGetString
GetTranslator
RemoveEntry
RemoveEntryValue
RemoveKey
SetContents
SetEntries
LocalizationTable:SetEntries(entries:Variant):()
매개 변수
entries:Variant |
반환
()
SetEntry
SetEntryContext
SetEntryExample
SetEntryKey
SetEntrySource