Quenty
(Quenty)
March 10, 2020, 5:50pm
#1
Hi,
I’m interested in learning how to localize Roblox plugins, for Roblox Studio. I can’t find any documentation for plugins specifically. Can this workflow be clarified?
6 Likes
Anaminus
(Anaminus)
March 10, 2020, 6:05pm
#2
I never found an official workflow for translating plugins (not that I looked very hard), but I wrote the following module for HotSwap:
local locale = game:GetService("LocalizationService").SystemLocaleId
local keys = script:FindFirstChild(locale)
if keys == nil then
locale = "en-us"
keys = script[locale]
end
local entries = {}
for key, value in pairs(require(keys)) do
table.insert(entries, {
Key = key,
Values = {[locale] = value},
})
end
local Lion = {
table = Instance.new("LocalizationTable"),
translator = nil
}
Lion.table:SetEntries(entries)
Lion.translator = Lion.table:GetTranslator(locale)
This file has been truncated. show original
An example language:
local HelpText = [[
HotSwap allows objects in the game tree to be "marked", running them as plugins
when Studio's run mode is enabled.
When HotSwap is enabled and active, each marked object is treated as a Plugin
object, and all descendant Scripts are run in a plugin-like environment. As an
exception, if a marked object is a Script, it runs as a child of the Plugin
object. Note that the marked state of an object is saved with the object as a
tag.
Each running script has a 'script' and 'plugin' variable, pointing to the
current script and the current plugin, respectively. Note that all objects under
a running plugin are isolated copies that exist outside the game tree.
The HotSwap panel lists all marked objects in the current place. When active,
the current status of each plugin is displayed. A plugin can fail to run for
several reasons, such as when the plugin contains unsafe objects that throw
errors when accessed, or when a descendant cannot be copied.
HotSwap runs plugins only when enabled, and when Studio's run mode is active.
This file has been truncated. show original
1 Like