Split locale enum, add duplicate values validation
This commit is contained in:
1 parent
7d9817994c
commit
48993dd9f5
7 files changed
+88
-55
No files matched your search
@@ -39,7 +39,7 @@ function OnNodeready()
|
|||||||
SetNavigation(m.rowList, "up", m.subscribeButton)
|
SetNavigation(m.rowList, "up", m.subscribeButton)
|
||||||
SetNavigation(m.subscribeButton, "down", m.rowList)
|
SetNavigation(m.subscribeButton, "down", m.rowList)
|
||||||
|
|
||||||
m.subscribeButton.text = Tr(Locale.Subscribe)
|
m.subscribeButton.text = Tr(Locale.Buttons.Subscribe)
|
||||||
DisposableObserveFieldScoped(m.subscribeButton, "buttonSelected", FuncName(OnSubscribeButtonSelected))
|
DisposableObserveFieldScoped(m.subscribeButton, "buttonSelected", FuncName(OnSubscribeButtonSelected))
|
||||||
|
|
||||||
SetSubscribeButtonVisibility()
|
SetSubscribeButtonVisibility()
|
||||||
@@ -300,9 +300,9 @@ end function
|
|||||||
function OnSubscriptionChanged()
|
function OnSubscriptionChanged()
|
||||||
isSubbed = IsSubscribed()
|
isSubbed = IsSubscribed()
|
||||||
if isSubbed
|
if isSubbed
|
||||||
m.subscribeButton.text = Tr(Locale.Unsubscribe)
|
m.subscribeButton.text = Tr(Locale.Buttons.Unsubscribe)
|
||||||
else
|
else
|
||||||
m.subscribeButton.text = Tr(Locale.Subscribe)
|
m.subscribeButton.text = Tr(Locale.Buttons.Subscribe)
|
||||||
end if
|
end if
|
||||||
end function
|
end function
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ function Init()
|
|||||||
m.top.observeFieldScoped("buttonSelected", FuncName(Close))
|
m.top.observeFieldScoped("buttonSelected", FuncName(Close))
|
||||||
|
|
||||||
scanLabel = m.top.findNode("scanLabel")
|
scanLabel = m.top.findNode("scanLabel")
|
||||||
scanLabel.text = Tr(Locale.ScanTheQrCode)
|
scanLabel.text = Tr(Locale.LoginDialog.ScanTheQrCode)
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function OnNodeReady()
|
function OnNodeReady()
|
||||||
@@ -21,7 +21,7 @@ function OnNodeReady()
|
|||||||
if isValidAddress
|
if isValidAddress
|
||||||
m.top.url = `${address}/invidious/login`
|
m.top.url = `${address}/invidious/login`
|
||||||
else
|
else
|
||||||
m.urlLabel.text = Tr(Locale.IpAddressNotAvailable)
|
m.urlLabel.text = Tr(Locale.LoginDialog.IpAddressNotAvailable)
|
||||||
end if
|
end if
|
||||||
|
|
||||||
m.invidious.observeFieldScoped("authToken", FuncName(OnAuthTokenChange))
|
m.invidious.observeFieldScoped("authToken", FuncName(OnAuthTokenChange))
|
||||||
|
|||||||
@@ -144,10 +144,10 @@ function UpdateActivateButton() as void
|
|||||||
if m.activateButton.hasFocus()
|
if m.activateButton.hasFocus()
|
||||||
NodeSetFocus(m.logoutButton, true)
|
NodeSetFocus(m.logoutButton, true)
|
||||||
end if
|
end if
|
||||||
m.activateButton.text = Tr(Locale.InUse)
|
m.activateButton.text = Tr(Locale.Buttons.InUse)
|
||||||
m.activateButton.disabled = true
|
m.activateButton.disabled = true
|
||||||
else
|
else
|
||||||
m.activateButton.text = Tr(Locale.Activate)
|
m.activateButton.text = Tr(Locale.Buttons.Activate)
|
||||||
m.activateButton.disabled = false
|
m.activateButton.disabled = false
|
||||||
end if
|
end if
|
||||||
end function
|
end function
|
||||||
+1
-1
@@ -17,7 +17,7 @@ function OnContentSet() as void
|
|||||||
' bs:disable-next-line LINT3023
|
' bs:disable-next-line LINT3023
|
||||||
m.top.circlePosterInnerBlendColor = "#FFFFFFFF"
|
m.top.circlePosterInnerBlendColor = "#FFFFFFFF"
|
||||||
m.top.letter = ""
|
m.top.letter = ""
|
||||||
m.top.username = Tr(Locale.Login)
|
m.top.username = Tr(Locale.Buttons.Login)
|
||||||
m.top.serverUrl = ""
|
m.top.serverUrl = ""
|
||||||
m.top.crownVisible = false
|
m.top.crownVisible = false
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -197,9 +197,9 @@ function OnFiltersChange()
|
|||||||
end if
|
end if
|
||||||
end for
|
end for
|
||||||
if filterCount > 0
|
if filterCount > 0
|
||||||
m.filtersButton.text = `${Tr(Locale.Filters)} (${filterCount})`
|
m.filtersButton.text = `${Tr(Locale.Buttons.Filters)} (${filterCount})`
|
||||||
else
|
else
|
||||||
m.filtersButton.text = Tr(Locale.Filters)
|
m.filtersButton.text = Tr(Locale.Buttons.Filters)
|
||||||
end if
|
end if
|
||||||
end function
|
end function
|
||||||
|
|
||||||
@@ -210,7 +210,7 @@ function Search(text as string)
|
|||||||
|
|
||||||
feedSource = {
|
feedSource = {
|
||||||
"id": `inv_search_${CryptoUtils.GetMd5(text)}`
|
"id": `inv_search_${CryptoUtils.GetMd5(text)}`
|
||||||
"title": `${Tr(Locale.Search)} - ${text}`
|
"title": `${Tr(Locale.NavBar.Search)} - ${text}`
|
||||||
"apiType": "Invidious"
|
"apiType": "Invidious"
|
||||||
"endpoint": "search"
|
"endpoint": "search"
|
||||||
"queryParams": {
|
"queryParams": {
|
||||||
@@ -232,7 +232,7 @@ function Search(text as string)
|
|||||||
end for
|
end for
|
||||||
|
|
||||||
m.rowList.feeds = [{
|
m.rowList.feeds = [{
|
||||||
"title": `${Tr(Locale.Search)} - ${text}`
|
"title": `${Tr(Locale.NavBar.Search)} - ${text}`
|
||||||
"feedSources": [feedSource]
|
"feedSources": [feedSource]
|
||||||
}]
|
}]
|
||||||
end function
|
end function
|
||||||
|
|||||||
@@ -1,43 +1,61 @@
|
|||||||
@locale
|
namespace Locale
|
||||||
enum Locale
|
@locale
|
||||||
Profile = "Profile"
|
enum NavBar
|
||||||
Search = "Search"
|
Profile = "Profile"
|
||||||
Home = "Home"
|
Search = "Search"
|
||||||
Bookmarks = "Bookmarks"
|
Home = "Home"
|
||||||
Settings = "Settings"
|
Bookmarks = "Bookmarks"
|
||||||
Remote = "Remote"
|
Settings = "Settings"
|
||||||
Info = "Info"
|
Remote = "Remote"
|
||||||
Activate = "Activate"
|
Info = "Info"
|
||||||
InUse = "In Use"
|
end enum
|
||||||
Login = "Login"
|
|
||||||
Logout = "Logout"
|
@locale
|
||||||
Close = "Close"
|
enum Buttons
|
||||||
Filters = "Filters"
|
Activate = "Activate"
|
||||||
Subscriptions = "Subscriptions"
|
InUse = "In Use"
|
||||||
Playlists = "Playlists"
|
Login = "Login"
|
||||||
WatchHistory = "Watch history"
|
Logout = "Logout"
|
||||||
Trending = "Trending"
|
Close = "Close"
|
||||||
TrendingMovies = "Trending - Movies"
|
Filters = "Filters"
|
||||||
TrendingMusic = "Trending - Music"
|
Edit = "Edit"
|
||||||
TrendingGaming = "Trending - Gaming"
|
Save = "Save"
|
||||||
Popular = "Popular"
|
TestInstance = "Test instance"
|
||||||
Videos = "Videos"
|
Subscribe = "Subscribe"
|
||||||
Shorts = "Shorts"
|
Unsubscribe = "Unsubscribe"
|
||||||
Live = "Live"
|
MoveUp = "Move up"
|
||||||
Podcasts = "Podcasts"
|
MoveDown = "Move down"
|
||||||
Edit = "Edit"
|
end enum
|
||||||
Save = "Save"
|
|
||||||
TestInstance = "Test instance"
|
@locale
|
||||||
Subscribe = "Subscribe"
|
enum Feed
|
||||||
Unsubscribe = "Unsubscribe"
|
Subscriptions = "Subscriptions"
|
||||||
LoginToInvidious = "Login to Invidious"
|
Playlists = "Playlists"
|
||||||
IpAddressNotAvailable = "IP address not available"
|
WatchHistory = "Watch history"
|
||||||
ScanTheQrCode = "Scan the QR code"
|
Trending = "Trending"
|
||||||
LoginInstructions1 = "Login to Invidious in order to view Subscriptions, Playlists, and use the Watch history."
|
TrendingMovies = "Trending - Movies"
|
||||||
LoginInstructions2 = "Please note that an Invidious account is different from a YouTube account."
|
TrendingMusic = "Trending - Music"
|
||||||
InvidiousCustomInstance = "Invidious custom instance"
|
TrendingGaming = "Trending - Gaming"
|
||||||
InvidiousOr = "Or"
|
Popular = "Popular"
|
||||||
InvidiousPublicInstances = "Invidious public instances"
|
Videos = "Videos"
|
||||||
MoveUp = "Move up"
|
Shorts = "Shorts"
|
||||||
MoveDown = "Move down"
|
Live = "Live"
|
||||||
end enum
|
Podcasts = "Podcasts"
|
||||||
|
end enum
|
||||||
|
|
||||||
|
@locale
|
||||||
|
enum LoginDialog
|
||||||
|
LoginToInvidious = "Login to Invidious"
|
||||||
|
IpAddressNotAvailable = "IP address not available"
|
||||||
|
ScanTheQrCode = "Scan the QR code"
|
||||||
|
LoginInstructions1 = "Login to Invidious in order to view Subscriptions, Playlists, and use the Watch history."
|
||||||
|
LoginInstructions2 = "Please note that an Invidious account is different from a YouTube account."
|
||||||
|
end enum
|
||||||
|
|
||||||
|
@locale
|
||||||
|
enum InvidiousSettings
|
||||||
|
InvidiousCustomInstance = "Invidious custom instance"
|
||||||
|
InvidiousOr = "Or"
|
||||||
|
InvidiousPublicInstances = "Invidious public instances"
|
||||||
|
end enum
|
||||||
|
end namespace
|
||||||
@@ -114,6 +114,21 @@ export class LocaleValidationPlugin implements CompilerPlugin {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const uniqueLocaleValues = Array.from(new Set(this.localeValues));
|
||||||
|
if (uniqueLocaleValues.length !== this.localeValues.length) {
|
||||||
|
const duplicates = this.localeValues.filter((value, index) => this.localeValues.indexOf(value) !== index);
|
||||||
|
program.addDiagnostics([{
|
||||||
|
file: this.enums[0].file,
|
||||||
|
range: {
|
||||||
|
start: { line: 0, character: 0 },
|
||||||
|
end: { line: 0, character: 0 }
|
||||||
|
},
|
||||||
|
message: `Duplicate values in locale enums: ${duplicates.join(', ')}`,
|
||||||
|
severity: DiagnosticSeverity.Error,
|
||||||
|
code: 'LOCALE_DUPLICATE_VALUES',
|
||||||
|
}]);
|
||||||
|
}
|
||||||
|
|
||||||
this.validateEnglishTranslations(program, this.localeValues, this.enums[0].file);
|
this.validateEnglishTranslations(program, this.localeValues, this.enums[0].file);
|
||||||
|
|
||||||
const rootDir = program.options.rootDir!;
|
const rootDir = program.options.rootDir!;
|
||||||
|
|||||||
Reference in new issue
Block a user