Localization part 2 (#332)
* More localization work * instance testing translation * Row cell translations * safety check
This commit is contained in:
1 parent
48993dd9f5
commit
9a7db6aab2
27 files changed
+1201
-270
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import "pkg:/source/utils/Locale.bs"
|
||||
import "pkg:/source/utils/StringUtils.bs"
|
||||
import "pkg:/source/utils/TimeUtils.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
@@ -5,6 +6,8 @@ import "pkg:/source/utils/Types.bs"
|
||||
function Init()
|
||||
m.durationRect = m.top.FindNode("durationRect")
|
||||
m.durationLabel = m.top.FindNode("durationLabel")
|
||||
m.smallestSystemFont = m.top.FindNode("smallestSystemFont")
|
||||
m.smallestBoldSystemFont = m.top.FindNode("smallestBoldSystemFont")
|
||||
end function
|
||||
|
||||
function OnContentSet() as void
|
||||
@@ -32,23 +35,25 @@ function OnContentSet() as void
|
||||
|
||||
m.top.thumbnailUri = content.thumbnail
|
||||
|
||||
m.top.durationRectVisible = false
|
||||
m.top.upcomingRectVisible = false
|
||||
m.top.liveRectVisible = false
|
||||
|
||||
if ValidInt(content.lengthSeconds) <> 0
|
||||
SetDurationText(content.lengthText)
|
||||
' bs:disable-next-line LINT3023
|
||||
SetDurationLabel(content.lengthText, "#000000FF", 0.8, m.smallestSystemFont)
|
||||
m.top.durationRectVisible = true
|
||||
else
|
||||
if content.isUpcoming = true
|
||||
m.top.upcomingRectVisible = true
|
||||
' bs:disable-next-line LINT3023
|
||||
SetDurationLabel(Tr(Locale.RowCell.Upcoming), "#000000FF", 0.8, m.smallestBoldSystemFont)
|
||||
m.top.durationRectVisible = true
|
||||
else if content.liveNow
|
||||
m.top.liveRectVisible = true
|
||||
SetDurationLabel(Tr(Locale.RowCell.Live), "#CC0000FF", 0.9, m.smallestBoldSystemFont)
|
||||
m.top.durationRectVisible = true
|
||||
else
|
||||
m.top.durationRectVisible = false
|
||||
end if
|
||||
end if
|
||||
end function
|
||||
|
||||
function SetDurationText(text as string) as void
|
||||
function SetDurationLabel(text as string, bgColor as string, bgOpacity as float, font as object) as void
|
||||
m.top.duration = text
|
||||
|
||||
label = m.durationLabel
|
||||
@@ -59,10 +64,13 @@ function SetDurationText(text as string) as void
|
||||
end if
|
||||
|
||||
rectParent = rect.getParent()
|
||||
label.font = font
|
||||
|
||||
size = label.localBoundingRect()
|
||||
|
||||
rect.width = size.width + 16
|
||||
rect.translation = [rectParent.width - rect.width, rect.translation[1]]
|
||||
rect.color = bgColor
|
||||
rect.opacity = bgOpacity
|
||||
end function
|
||||
|
||||
@@ -5,13 +5,14 @@
|
||||
<field id="title" type="string" alias="titleLabel.text" />
|
||||
<field id="author" type="string" alias="authorLabel.text" />
|
||||
<field id="viewCountDate" type="string" alias="viewCountDateLabel.text" />
|
||||
<field id="liveRectVisible" type="boolean" alias="liveRect.visible" />
|
||||
<field id="upcomingRectVisible" type="boolean" alias="upcomingRect.visible" />
|
||||
<field id="durationRectVisible" type="boolean" alias="durationRect.visible" />
|
||||
<field id="duration" type="string" alias="durationLabel.text" />
|
||||
<field id="thumbnailUri" type="string" alias="thumbnail.uri" />
|
||||
</interface>
|
||||
<children>
|
||||
<Font id="smallestSystemFont" uri="font:SystemFontFile" size="18" />
|
||||
<Font id="smallestBoldSystemFont" uri="font:BoldSystemFontFile" size="18" />
|
||||
|
||||
<LayoutGroup
|
||||
itemSpacings="[24,5,5]">
|
||||
<Poster
|
||||
@@ -35,35 +36,6 @@
|
||||
font="font:SmallestSystemFont"
|
||||
translation="[8, 0]" />
|
||||
</Rectangle>
|
||||
<Rectangle
|
||||
id="liveRect"
|
||||
width="60"
|
||||
height="25"
|
||||
color="0xFF0000"
|
||||
translation="[290, 162]">
|
||||
<Label
|
||||
width="60"
|
||||
height="25"
|
||||
horizAlign="center"
|
||||
vertAlign="center"
|
||||
font="font:SmallestBoldSystemFont"
|
||||
text="LIVE" />
|
||||
</Rectangle>
|
||||
<Rectangle
|
||||
id="upcomingRect"
|
||||
width="120"
|
||||
height="25"
|
||||
color="0x000000"
|
||||
opacity="0.8"
|
||||
translation="[230, 162]">
|
||||
<Label
|
||||
width="120"
|
||||
height="25"
|
||||
horizAlign="center"
|
||||
vertAlign="center"
|
||||
font="font:SmallestBoldSystemFont"
|
||||
text="UPCOMING" />
|
||||
</Rectangle>
|
||||
</Poster>
|
||||
<Label
|
||||
id="titleLabel"
|
||||
|
||||
Reference in new issue
Block a user