Localization part 3 (#333)
* TODO * TODO * Add some translations * Remote screen and settings * Video player and http client
This commit is contained in:
1 parent
9a7db6aab2
commit
7330b321a5
19 files changed
+837
-85
No files matched your search
@@ -1,7 +1,9 @@
|
||||
import "pkg:/source/utils/MathUtils.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
|
||||
function Init()
|
||||
m.top.observeField("checkedState", FuncName(OnCheckedStateChange))
|
||||
m.minItemWidth = m.top.itemSize[0]
|
||||
end function
|
||||
|
||||
function OnValueChange()
|
||||
@@ -15,3 +17,19 @@ function OnCheckedStateChange() as void
|
||||
end if
|
||||
m.top.value = checkedState[0]
|
||||
end function
|
||||
|
||||
function OnTitleChange()
|
||||
title = m.top.title
|
||||
' TODO:P2 FIX THIS
|
||||
' This is a gross estimate of the width of the text, because there isn't
|
||||
' a simple way to measure using the font, and accurately estimate the width
|
||||
' of the checkbox. I hate it, but I currently don't have the patience to
|
||||
' do something else.
|
||||
' The risks are, if the checkbox is too big, it will look ugly, and if it's
|
||||
' too small, the text will be scrolling. Either way, it will be usable.
|
||||
' A better way is to create a Checkbox from scratch, instead of using the CheckList
|
||||
size = title.len() * 14 - 30
|
||||
|
||||
size = MathUtils.Max(size, m.minItemWidth)
|
||||
m.top.itemSize = [size, m.top.itemSize[1]]
|
||||
end function
|
||||
@@ -1,6 +1,6 @@
|
||||
<component name="Checkbox" extends="CheckList">
|
||||
<interface>
|
||||
<field id="title" type="string" alias="checkboxNode.title" />
|
||||
<field id="title" type="string" alias="checkboxNode.title" onChange="OnTitleChange" />
|
||||
<field id="value" type="boolean" onChange="OnValueChange" />
|
||||
</interface>
|
||||
<children>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import "pkg:/components/Dialog/DialogUtils.bs"
|
||||
import "pkg:/components/Services/SearchHistory/SearchHistoryUtils.bs"
|
||||
import "pkg:/source/utils/FocusManagement.bs"
|
||||
import "pkg:/source/utils/Locale.bs"
|
||||
|
||||
function Init()
|
||||
m.top.focusable = true
|
||||
@@ -22,5 +23,5 @@ end function
|
||||
|
||||
function OnButtonSelected()
|
||||
SearchHistoryUtils.Clear()
|
||||
DialogUtils.ShowDialog("Search history cleared.", "Success")
|
||||
DialogUtils.ShowDialog(Tr(Locale.Settings.SearchHistoryCleared), Tr(Locale.Generic.Success))
|
||||
end function
|
||||
@@ -57,7 +57,7 @@ function OnOptionsChange()
|
||||
for i = 0 to options.Count() - 1
|
||||
option = options[i].displayText
|
||||
node = CreateObject("roSGNode", "ContentNode")
|
||||
node.title = option
|
||||
node.title = Tr(option)
|
||||
m.radioButtonListContent.appendChild(node)
|
||||
end for
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import "pkg:/source/utils/MathUtils.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
|
||||
function Init()
|
||||
@@ -21,7 +22,10 @@ function Resize()
|
||||
width = rect.width + m.top.padding * 2
|
||||
height = rect.height + m.top.padding * 2
|
||||
|
||||
m.top.minWidth = width < m.top.minimumWidth ? m.top.minimumWidth : width
|
||||
m.top.contentWidth = width
|
||||
m.top.contentHeight = height
|
||||
|
||||
m.top.minWidth = MathUtils.Max(m.top.minimumWidth, width)
|
||||
m.top.height = height
|
||||
|
||||
m.container.translation = [m.top.padding, m.top.padding]
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
<component name="SettingCategory" extends="Button">
|
||||
<interface>
|
||||
<field id="padding" type="integer" value="15" onChange="Resize" />
|
||||
<field id="minimumWidth" type="integer" value="280" onChange="Resize" />
|
||||
<field id="padding" type="float" value="15" onChange="Resize" />
|
||||
<field id="minimumWidth" type="float" value="280" onChange="Resize" />
|
||||
<field id="contentWidth" type="float" />
|
||||
<field id="contentHeight" type="float" />
|
||||
<field id="displayText" type="string" alias="DisplayTextLabel.text" onChange="Resize" />
|
||||
<field id="description" type="string" alias="DescriptionLabel.text" onChange="Resize" />
|
||||
<field id="textColor2" type="Color" value="0xb4b4b4ff" />
|
||||
@@ -9,13 +11,11 @@
|
||||
</interface>
|
||||
<children>
|
||||
<LayoutGroup id="Container" itemSpacings="[5]">
|
||||
<SimpleLabel
|
||||
id="DisplayTextLabel"
|
||||
fontUri="font:SystemFontFile"
|
||||
fontSize="34" />
|
||||
<SimpleLabel id="DescriptionLabel"
|
||||
fontUri="font:SystemFontFile"
|
||||
fontSize="18"
|
||||
<Label id="DisplayTextLabel">
|
||||
<Font role="font" uri="font:SystemFontFile" size="34" />
|
||||
</Label>
|
||||
<Label id="DescriptionLabel"
|
||||
font="font:SmallestSystemFont"
|
||||
translation="[0,42]" />
|
||||
</LayoutGroup>
|
||||
</children>
|
||||
|
||||
@@ -20,7 +20,7 @@ function OnNodeReady()
|
||||
startX = 150
|
||||
startY = 100
|
||||
|
||||
controlsX = 400
|
||||
controlsX = 450
|
||||
|
||||
categorySpacing = 80
|
||||
controlSpacing = 30
|
||||
@@ -73,8 +73,8 @@ end function
|
||||
function CreateCategoryNode(item as object, container as object, startX as integer, startY as integer) as object
|
||||
node = container.createChild("SettingCategory")
|
||||
node.translation = [startX, startY]
|
||||
node.displayText = item.displayText
|
||||
node.description = item.description
|
||||
node.displayText = Tr(item.displayText)
|
||||
node.description = Tr(item.description)
|
||||
return {
|
||||
node: node
|
||||
rect: node.boundingRect()
|
||||
@@ -152,30 +152,30 @@ end function
|
||||
|
||||
function CreateBooleanControl(item as object, container as object) as object
|
||||
node = container.createChild("BooleanControl")
|
||||
node.displayText = item.displayText
|
||||
node.description = item.description
|
||||
node.displayText = Tr(item.displayText)
|
||||
node.description = Tr(item.description)
|
||||
return node
|
||||
end function
|
||||
|
||||
function CreateRadioControl(item as object, container as object) as object
|
||||
node = container.createChild("RadioControl")
|
||||
node.displayText = item.displayText
|
||||
node.description = item.description
|
||||
node.displayText = Tr(item.displayText)
|
||||
node.description = Tr(item.description)
|
||||
node.options = item.options
|
||||
return node
|
||||
end function
|
||||
|
||||
function CreateStringControl(item as object, container as object) as object
|
||||
node = container.createChild("StringControl")
|
||||
node.displayText = item.displayText
|
||||
node.description = item.description
|
||||
node.displayText = Tr(item.displayText)
|
||||
node.description = Tr(item.description)
|
||||
return node
|
||||
end function
|
||||
|
||||
function CreateNumberComponent(item as object, container as object) as object
|
||||
node = container.createChild("NumberControl")
|
||||
node.displayText = item.displayText
|
||||
node.description = item.description
|
||||
node.displayText = Tr(item.displayText)
|
||||
node.description = Tr(item.description)
|
||||
if IsInt(item.min)
|
||||
node.min = item.min
|
||||
end if
|
||||
@@ -188,10 +188,10 @@ end function
|
||||
function CreateRokuComponent(item as object, container as object) as object
|
||||
node = container.createChild(item.rokuComponent)
|
||||
if node.hasField("displayText")
|
||||
node.displayText = item.displayText
|
||||
node.displayText = Tr(item.displayText)
|
||||
end if
|
||||
if node.hasField("description")
|
||||
node.description = item.description
|
||||
node.description = Tr(item.description)
|
||||
end if
|
||||
return node
|
||||
end function
|
||||
|
||||
Reference in new issue
Block a user