Skip to content

Commit

Permalink
Disable AutoLocalize (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackTabsCode committed Apr 14, 2024
1 parent d431720 commit 6d497b5
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/create.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,33 @@ local Runtime = require(script.Parent.Runtime)
print(ref.button.Text) --> hi
```
]=]

local GUI_BASE_2D = {
"CanvasGroup",
"Frame",
"ImageLabel",
"ScrollingFrame",
"TextLabel",
"TextButton",
"ViewportFrame",
"TextBox",
"VideoFrame",
"ScreenGui",
"BillboardGui",
"SurfaceGui",
}

local function create(className, props)
props = props or {}

local eventCallback = Runtime.useEventCallback()

local instance = Instance.new(className)

if props["AutoLocalize"] == nil and table.find(GUI_BASE_2D, className) then
props["AutoLocalize"] = false
end

for key, value in pairs(props) do
if type(value) == "function" then
if eventCallback then
Expand Down
1 change: 1 addition & 0 deletions src/widgets/row.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ return Runtime.widget(function(options, fn)
local refs = Runtime.useInstance(function(ref)
local Frame = Instance.new("Frame")
Frame.BackgroundTransparency = 1
Frame.AutoLocalize = false

local UIListLayout = Instance.new("UIListLayout")
UIListLayout.SortOrder = Enum.SortOrder.LayoutOrder
Expand Down
2 changes: 2 additions & 0 deletions src/widgets/spinner.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ return Runtime.widget(function()
local Frame = Instance.new("Frame")
Frame.BackgroundTransparency = 1
Frame.Size = UDim2.new(0, 100, 0, 100)
Frame.AutoLocalize = false

local ImageLabel = Instance.new("ImageLabel")
ImageLabel.AnchorPoint = Vector2.new(0.5, 0.5)
ImageLabel.BackgroundTransparency = 1
ImageLabel.Image = "rbxassetid://2689141406"
ImageLabel.Position = UDim2.new(0.5, 0, 0.5, 0)
ImageLabel.Size = UDim2.new(0, 100, 0, 100)
ImageLabel.AutoLocalize = false
ImageLabel.Parent = Frame

ref.frame = Frame
Expand Down

0 comments on commit 6d497b5

Please sign in to comment.