Localization test (#331)

* Localization test

* More translations

* More translations

* Setup the tooling and validation for the localization

* More translations

* Docs
This commit is contained in:
Brahim Hadriche authored and GitHub committed 2024-03-17 22:22:53 -04:00
1 parent 403ed94e97
commit 7d9817994c
36 files changed
+789 -51

No files matched your search

@@ -20,7 +20,7 @@ function OnNodeReady()
m.rowList@.BindNode()
OnBookmarksChange()
m.bookmarks.ObserveField("contentChange", FuncName(OnBookmarksChange))
m.bookmarksService.ObserveField("contentChange", FuncName(OnBookmarksChange))
end function
function OnFocusChange() as void
@@ -53,13 +53,13 @@ function OnBookmarksChange() as void
end if
m.isDirty = false
hasBookmarks = m.bookmarks.content.getChildCount() > 0
hasBookmarks = m.bookmarksService.content.getChildCount() > 0
m.noBookmarks.visible = not hasBookmarks
m.yesBookmarks.visible = hasBookmarks
m.top.focusable = hasBookmarks
if hasBookmarks
SetRowListContent(m.bookmarks.content)
SetRowListContent(m.bookmarksService.content)
else
if m.rowList.hasFocus()
NodeSetFocus(m.navBar, true)
@@ -2,7 +2,7 @@
<interface>
<field id="navBar" type="node" bind="/NavBar" />
<field id="applicationInfo" type="node" bind="/ApplicationInfo" />
<field id="bookmarks" type="node" bind="/Bookmarks" />
<field id="bookmarksService" type="node" bind="/BookmarksService" />
<function name="Refresh" />
</interface>
<children>
@@ -1,3 +1,4 @@
import "pkg:/source/utils/Locale.bs"
import "pkg:/source/utils/StringUtils.bs"
function Init()
@@ -16,7 +17,7 @@ function OnContentSet() as void
' bs:disable-next-line LINT3023
m.top.circlePosterInnerBlendColor = "#FFFFFFFF"
m.top.letter = ""
m.top.username = "Login"
m.top.username = Tr(Locale.Login)
m.top.serverUrl = ""
m.top.crownVisible = false
return
@@ -7,6 +7,7 @@ import "pkg:/source/utils/CryptoUtils.bs"
import "pkg:/source/utils/ErrorUtils.bs"
import "pkg:/source/utils/FocusManagement.bs"
import "pkg:/source/utils/LoadingScreen.bs"
import "pkg:/source/utils/Locale.bs"
import "pkg:/source/utils/Logging.bs"
import "pkg:/source/utils/UrlUtils.bs"
@@ -196,9 +197,9 @@ function OnFiltersChange()
end if
end for
if filterCount > 0
m.filtersButton.text = `Filters (${filterCount})`
m.filtersButton.text = `${Tr(Locale.Filters)} (${filterCount})`
else
m.filtersButton.text = "Filters"
m.filtersButton.text = Tr(Locale.Filters)
end if
end function
@@ -209,7 +210,7 @@ function Search(text as string)
feedSource = {
"id": `inv_search_${CryptoUtils.GetMd5(text)}`
"title": `Search - ${text}`
"title": `${Tr(Locale.Search)} - ${text}`
"apiType": "Invidious"
"endpoint": "search"
"queryParams": {
@@ -231,7 +232,7 @@ function Search(text as string)
end for
m.rowList.feeds = [{
"title": `Search - ${text}`
"title": `${Tr(Locale.Search)} - ${text}`
"feedSources": [feedSource]
}]
end function
@@ -35,6 +35,16 @@ function Init()
m.closeButton.observeField("buttonSelected", FuncName(Close))
m.checkList.observeField("checkedState", FuncName(OnCheckedStateChange))
SetButtonPositions()
end function
function SetButtonPositions()
saveButtonWidth = m.saveButton.width
closeButtonWidth = m.closeButton.width
buttonsWith = closeButtonWidth + saveButtonWidth + 20
m.saveButton.translation = [960 / 2 - buttonsWith / 2, m.saveButton.translation[1]]
m.closeButton.translation = [960 / 2 + buttonsWith / 2 - closeButtonWidth, m.closeButton.translation[1]]
end function
function OnFocusChange() as void
@@ -77,7 +87,7 @@ function OnValueChange()
end if
node = CreateObject("roSGNode", "ContentNode")
node.id = feed.id
node.title = feed.title
node.title = Tr(feed.title)
nodes.push(node)
checkedState.push(item.enabled)
end for
@@ -27,15 +27,17 @@
<ButtonEx
id="moveUpButton"
iconVisible="false"
anchor="[0.5,0.5]"
text="Move up"
minWidth="220"
translation="[640,183]" />
translation="[750,220]" />
<ButtonEx
id="moveDownButton"
iconVisible="false"
anchor="[0.5,0.5]"
text="Move down"
minWidth="220"
translation="[640,273]" />
translation="[750,300]" />
<ButtonEx
id="saveButton"
@@ -33,6 +33,16 @@ function Init()
m.currentNavigtionNode = m.editButton
m.textEditBox.hintText = `e.g. ${Invidious.DEFAULT_INSTANCE}`
SetButtonPositions()
end function
function SetButtonPositions()
testButtonWidth = m.testButton.width
saveButtonWidth = m.saveButton.width
buttonsWith = testButtonWidth + saveButtonWidth + 20
m.testButton.translation = [960 / 2 - buttonsWith / 2, m.testButton.translation[1]]
m.saveButton.translation = [960 / 2 + buttonsWith / 2 - saveButtonWidth, m.saveButton.translation[1]]
end function
function OnFocusChange() as void
@@ -18,7 +18,9 @@
color="#242424">
<Label
text="Invidious custom instance"
translation="[326,13]" />
horizAlign="center"
width="960"
translation="[0,13]" />
<TextEditBox
id="textEditBox"
width="480"
@@ -32,24 +34,31 @@
iconHeight="22"
text="Edit"
translation="[670,50]" />
<Label
text="OR"
translation="[460,110]">
<LayoutGroup
layoutDirection="horiz"
horizAlignment="center"
vertAlignment="center"
itemSpacings="[30,30]"
translation="[480,125]">
<Rectangle
width="250"
height="1"
translation="[-282,10]" />
height="1" />
<Label
text="Or" />
<Rectangle
width="250"
height="1"
translation="[71,10]" />
height="1" />
</Label>
</LayoutGroup>
<Label
text="Invidious public instances"
translation="[328,145]" />
horizAlign="center"
width="960"
translation="[0,145]" />
<InvidiousPublicInstances
id="instances"