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
@@ -4,7 +4,9 @@ import "pkg:/source/AsyncTask/AsyncTask.bs"
|
||||
import "pkg:/source/AsyncTask/Tasks.bs"
|
||||
import "pkg:/source/utils/ErrorUtils.bs"
|
||||
import "pkg:/source/utils/FocusManagement.bs"
|
||||
import "pkg:/source/utils/Locale.bs"
|
||||
import "pkg:/source/utils/Logging.bs"
|
||||
import "pkg:/source/utils/MathUtils.bs"
|
||||
import "pkg:/source/utils/StringUtils.bs"
|
||||
|
||||
function Init()
|
||||
@@ -64,6 +66,11 @@ function OnNodeReady()
|
||||
m.linkWithWifiPanel.visible = false
|
||||
m.linkWithTvPanel.observeField("visible", FuncName(OnLinkWithTvPanelVisibleChanged))
|
||||
m.linkWithTvPanel.visible = false
|
||||
|
||||
m.webAppButton.observeField("contentWidth", FuncName(OnButtonSizeChange))
|
||||
m.linkWithWifiButton.observeField("contentWidth", FuncName(OnButtonSizeChange))
|
||||
m.linkWithTvButton.observeField("contentWidth", FuncName(OnButtonSizeChange))
|
||||
OnButtonSizeChange()
|
||||
end function
|
||||
|
||||
function OnFocusChange() as void
|
||||
@@ -86,6 +93,18 @@ function OnUrlSet()
|
||||
m.webAppQrCodePoster.text = url
|
||||
end function
|
||||
|
||||
function OnButtonSizeChange()
|
||||
width1 = m.webAppButton.contentWidth
|
||||
width2 = m.linkWithWifiButton.contentWidth
|
||||
width3 = m.linkWithTvButton.contentWidth
|
||||
|
||||
width = MathUtils.Max(width1, MathUtils.Max(width2, width3))
|
||||
|
||||
m.webAppButton.minimumWidth = width
|
||||
m.linkWithWifiButton.minimumWidth = width
|
||||
m.linkWithTvButton.minimumWidth = width
|
||||
end function
|
||||
|
||||
function OnkeyEvent(key as string, press as boolean) as boolean
|
||||
navigation = NavigationKeyHandler(key, press)
|
||||
if navigation.handled
|
||||
@@ -134,12 +153,13 @@ function OnLinkWithWifiPanelVisibleChanged() as void
|
||||
if connectionInfo.type = "WiFiConnection"
|
||||
m.wifiNameLabel.text = connectionInfo.ssid
|
||||
else if connectionInfo.type = "WiredConnection"
|
||||
m.wifiNameLabel.text = "Wired connection"
|
||||
m.wifiNameLabel.text = Tr(Locale.RemoteScreen.WiredConnection)
|
||||
else
|
||||
m.wifiNameLabel.text = "N/A"
|
||||
end if
|
||||
|
||||
m.wifiInstructionWithDeviceNameLabel.text = `Tap the cast icon and select <Bold>"${m.loungeService.deviceName}"</Bold>`
|
||||
deviceName = `<Bold>"${m.loungeService.deviceName}"</Bold>`
|
||||
m.wifiInstructionWithDeviceNameLabel.text = Tr(Locale.RemoteScreen.WifiInstruction3).Replace("%1", deviceName)
|
||||
end function
|
||||
|
||||
function OnLinkWithTvPanelVisibleChanged()
|
||||
@@ -159,7 +179,7 @@ function GeneratePairingCode()
|
||||
m.linkCodeTask.cancel = true
|
||||
end if
|
||||
|
||||
m.linkCodeLabel.text = "Loading..."
|
||||
m.linkCodeLabel.text = Tr(Locale.RemoteScreen.Loading)
|
||||
m.linkCodeTask = AsyncTask.Start(Tasks.LoungeGenerateManualPairingCodeTask, {
|
||||
loungeService: m.loungeService
|
||||
loungeToken: m.loungeService.loungeToken
|
||||
@@ -187,8 +207,8 @@ function OnLoungeGenerateManualPairingCodeTaskResult(output as object) as void
|
||||
error = ErrorUtils.Format(error)
|
||||
LogError(error)
|
||||
|
||||
message = `Failed to generate manual pairing code\n${error}`
|
||||
DialogUtils.ShowDialog(message, "Get TV code fail", true)
|
||||
message = Tr(Locale.RemoteScreen.FailedToGeneratePairingCode) + `\n${error}`
|
||||
DialogUtils.ShowDialog(message, Tr(Locale.RemoteScreen.TvCodeError), true)
|
||||
return
|
||||
end if
|
||||
|
||||
|
||||
Reference in new issue
Block a user