From 3e847b8412cc90de95683c6b951c967ecf62c788 Mon Sep 17 00:00:00 2001 From: Fijxu Date: Fri, 22 Aug 2025 17:54:48 -0400 Subject: [PATCH] Migrate to stdlib Log --- config/config.example.yml | 2 +- scripts/generate_js_licenses.cr | 2 +- shard.lock | 6 +- shard.yml | 2 +- spec/invidious/hashtag_spec.cr | 4 +- .../videos/regular_videos_extract_spec.cr | 4 +- .../videos/scheduled_live_extract_spec.cr | 2 +- spec/parsers_helper.cr | 4 - src/invidious.cr | 27 +- src/invidious/channels/about.cr | 2 +- src/invidious/channels/channels.cr | 22 +- src/invidious/channels/community.cr | 10 +- src/invidious/channels/playlists.cr | 8 +- src/invidious/channels/videos.cr | 6 +- src/invidious/comments/youtube.cr | 2 +- src/invidious/config.cr | 31 +- src/invidious/database/base.cr | 21 +- src/invidious/database/migrator.cr | 4 +- src/invidious/frontend/channel_page.cr | 4 +- src/invidious/frontend/comments_reddit.cr | 6 +- src/invidious/frontend/comments_youtube.cr | 26 +- src/invidious/frontend/pagination.cr | 18 +- src/invidious/frontend/search_filters.cr | 16 +- src/invidious/frontend/watch_page.cr | 8 +- src/invidious/hashtag.cr | 2 +- src/invidious/helpers/errors.cr | 24 +- src/invidious/helpers/i18n.cr | 361 ++++---- src/invidious/helpers/i18next.cr | 2 +- src/invidious/helpers/logger.cr | 92 +- src/invidious/helpers/macros.cr | 6 + src/invidious/helpers/serialized_yt_data.cr | 8 +- src/invidious/helpers/sig_helper.cr | 32 +- src/invidious/helpers/signatures.cr | 16 +- src/invidious/helpers/utils.cr | 14 +- src/invidious/jobs/clear_expired_items_job.cr | 8 +- src/invidious/jobs/instance_refresh_job.cr | 8 +- src/invidious/jobs/notification_job.cr | 10 +- src/invidious/jobs/refresh_channels_job.cr | 22 +- src/invidious/jobs/refresh_feeds_job.cr | 12 +- src/invidious/jobs/subscribe_to_feeds_job.cr | 6 +- src/invidious/jsonify/api_v1/video_json.cr | 4 +- src/invidious/routes/before_all.cr | 2 +- src/invidious/routes/channels.cr | 2 +- src/invidious/routes/embed.cr | 4 +- src/invidious/routes/feeds.cr | 6 +- src/invidious/routes/login.cr | 2 +- src/invidious/routes/watch.cr | 4 +- src/invidious/search/processors.cr | 4 +- src/invidious/trending.cr | 2 +- src/invidious/videos.cr | 2 +- src/invidious/videos/parser.cr | 869 +++++++++--------- src/invidious/views/add_playlist_items.ecr | 4 +- src/invidious/views/community.ecr | 8 +- .../views/components/channel_info.ecr | 10 +- src/invidious/views/components/feed_menu.ecr | 2 +- src/invidious/views/components/item.ecr | 24 +- .../views/components/items_paginated.ecr | 6 +- src/invidious/views/components/search_box.ecr | 6 +- .../views/components/subscribe_widget.ecr | 10 +- .../components/video-context-buttons.ecr | 8 +- src/invidious/views/create_playlist.ecr | 14 +- src/invidious/views/delete_playlist.ecr | 8 +- src/invidious/views/edit_playlist.ecr | 10 +- src/invidious/views/feeds/history.ecr | 8 +- src/invidious/views/feeds/playlists.ecr | 10 +- src/invidious/views/feeds/popular.ecr | 4 +- src/invidious/views/feeds/subscriptions.ecr | 8 +- src/invidious/views/feeds/trending.ecr | 10 +- src/invidious/views/licenses.ecr | 26 +- src/invidious/views/message.ecr | 2 +- src/invidious/views/playlist.ecr | 32 +- src/invidious/views/post.ecr | 10 +- src/invidious/views/search.ecr | 6 +- src/invidious/views/search_homepage.ecr | 4 +- src/invidious/views/template.ecr | 36 +- src/invidious/views/user/authorize_token.ecr | 16 +- src/invidious/views/user/change_password.ecr | 18 +- .../views/user/clear_watch_history.ecr | 8 +- src/invidious/views/user/data_control.ecr | 28 +- src/invidious/views/user/delete_account.ecr | 8 +- src/invidious/views/user/login.ecr | 16 +- src/invidious/views/user/preferences.ecr | 146 +-- .../views/user/subscription_manager.ecr | 10 +- src/invidious/views/user/token_manager.ecr | 10 +- src/invidious/views/watch.ecr | 72 +- src/invidious/yt_backend/connection_pool.cr | 2 +- src/invidious/yt_backend/extractors.cr | 133 +-- src/invidious/yt_backend/extractors_utils.cr | 4 +- src/invidious/yt_backend/youtube_api.cr | 19 +- 89 files changed, 1271 insertions(+), 1246 deletions(-) diff --git a/config/config.example.yml b/config/config.example.yml index 8d3e6212..ecd24a1e 100644 --- a/config/config.example.yml +++ b/config/config.example.yml @@ -289,7 +289,7 @@ https_only: false ## Logging Verbosity. This is overridden if "-l LEVEL" or ## "--log-level=LEVEL" are passed on the command line. ## -## Accepted values: All, Trace, Debug, Info, Warn, Error, Fatal, Off +## Accepted values: Trace, Debug, Info, Notice, Warn, Error, Fatal, None ## Default: Info ## #log_level: Info diff --git a/scripts/generate_js_licenses.cr b/scripts/generate_js_licenses.cr index 1f4ffa62..7df70bf2 100644 --- a/scripts/generate_js_licenses.cr +++ b/scripts/generate_js_licenses.cr @@ -24,7 +24,7 @@ def create_licence_tr(path, file_name, licence_name, licence_link, source_locati " #{file_name} #{licence_name} - \#{translate(locale, "source")} + \#{I18n.translate(locale, "source")} " HTML diff --git a/shard.lock b/shard.lock index 1265eda6..e7741c23 100644 --- a/shard.lock +++ b/shard.lock @@ -10,7 +10,7 @@ shards: backtracer: git: https://github.com/sija/backtracer.cr.git - version: 1.2.2 + version: 1.2.4 db: git: https://github.com/crystal-lang/crystal-db.git @@ -18,7 +18,7 @@ shards: exception_page: git: https://github.com/crystal-loot/exception_page.git - version: 0.4.1 + version: 0.5.0 http_proxy: git: https://github.com/mamantoha/http_proxy.git @@ -26,7 +26,7 @@ shards: kemal: git: https://github.com/kemalcr/kemal.git - version: 1.6.0 + version: 1.7.2 pg: git: https://github.com/will/crystal-pg.git diff --git a/shard.yml b/shard.yml index 839ebca5..a7c9599d 100644 --- a/shard.yml +++ b/shard.yml @@ -17,7 +17,7 @@ dependencies: version: ~> 0.21.0 kemal: github: kemalcr/kemal - version: ~> 1.6.0 + version: ~> 1.7.2 protodec: github: iv-org/protodec version: ~> 0.1.5 diff --git a/spec/invidious/hashtag_spec.cr b/spec/invidious/hashtag_spec.cr index abc81225..47398719 100644 --- a/spec/invidious/hashtag_spec.cr +++ b/spec/invidious/hashtag_spec.cr @@ -4,7 +4,7 @@ Spectator.describe Invidious::Hashtag do it "parses richItemRenderer containers (test 1)" do # Enable mock test_content = load_mock("hashtag/martingarrix_page1") - videos, _ = extract_items(test_content) + videos, _ = YoutubeJSONParser.extract_items(test_content) expect(typeof(videos)).to eq(Array(SearchItem)) expect(videos.size).to eq(60) @@ -57,7 +57,7 @@ Spectator.describe Invidious::Hashtag do it "parses richItemRenderer containers (test 2)" do # Enable mock test_content = load_mock("hashtag/martingarrix_page2") - videos, _ = extract_items(test_content) + videos, _ = YoutubeJSONParser.extract_items(test_content) expect(typeof(videos)).to eq(Array(SearchItem)) expect(videos.size).to eq(60) diff --git a/spec/invidious/videos/regular_videos_extract_spec.cr b/spec/invidious/videos/regular_videos_extract_spec.cr index f96703f6..0a29161e 100644 --- a/spec/invidious/videos/regular_videos_extract_spec.cr +++ b/spec/invidious/videos/regular_videos_extract_spec.cr @@ -7,7 +7,7 @@ Spectator.describe "parse_video_info" do _next = load_mock("video/regular_mrbeast.next") raw_data = _player.merge!(_next) - info = parse_video_info("2isYuQZMbdU", raw_data) + info = Parser.parse_video_info("2isYuQZMbdU", raw_data) # Some basic verifications expect(typeof(info)).to eq(Hash(String, JSON::Any)) @@ -89,7 +89,7 @@ Spectator.describe "parse_video_info" do _next = load_mock("video/regular_no-description.next") raw_data = _player.merge!(_next) - info = parse_video_info("iuevw6218F0", raw_data) + info = Parser.parse_video_info("iuevw6218F0", raw_data) # Some basic verifications expect(typeof(info)).to eq(Hash(String, JSON::Any)) diff --git a/spec/invidious/videos/scheduled_live_extract_spec.cr b/spec/invidious/videos/scheduled_live_extract_spec.cr index c3a9b228..6e686baf 100644 --- a/spec/invidious/videos/scheduled_live_extract_spec.cr +++ b/spec/invidious/videos/scheduled_live_extract_spec.cr @@ -7,7 +7,7 @@ Spectator.describe "parse_video_info" do _next = load_mock("video/scheduled_live_PBD-Podcast.next") raw_data = _player.merge!(_next) - info = parse_video_info("N-yVic7BbY0", raw_data) + info = Parser.parse_video_info("N-yVic7BbY0", raw_data) # Some basic verifications expect(typeof(info)).to eq(Hash(String, JSON::Any)) diff --git a/spec/parsers_helper.cr b/spec/parsers_helper.cr index 6589acad..b52ac251 100644 --- a/spec/parsers_helper.cr +++ b/spec/parsers_helper.cr @@ -8,7 +8,6 @@ require "spectator" require "../src/invidious/exceptions" require "../src/invidious/helpers/macros" -require "../src/invidious/helpers/logger" require "../src/invidious/helpers/utils" require "../src/invidious/videos" @@ -19,9 +18,6 @@ require "../src/invidious/helpers/serialized_yt_data" require "../src/invidious/yt_backend/extractors" require "../src/invidious/yt_backend/extractors_utils" -OUTPUT = File.open(File::NULL, "w") -LOGGER = Invidious::LogHandler.new(OUTPUT, LogLevel::Off) - def load_mock(file) : Hash(String, JSON::Any) file = File.join(__DIR__, "..", "mocks", file + ".json") content = File.read(file) diff --git a/src/invidious.cr b/src/invidious.cr index 69f8a26c..970908f5 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -15,7 +15,6 @@ # along with this program. If not, see . require "digest/md5" -require "file_utils" # Require kemal, then our own overrides require "kemal" @@ -30,6 +29,7 @@ require "xml" require "yaml" require "compress/zip" require "protodec/utils" +require "log" require "./invidious/database/*" require "./invidious/database/migrations/*" @@ -122,8 +122,8 @@ Kemal.config.extra_options do |parser| parser.on("-o OUTPUT", "--output=OUTPUT", "Redirect output (default: #{CONFIG.output})") do |output| CONFIG.output = output end - parser.on("-l LEVEL", "--log-level=LEVEL", "Log level, one of #{LogLevel.values} (default: #{CONFIG.log_level})") do |log_level| - CONFIG.log_level = LogLevel.parse(log_level) + parser.on("-l LEVEL", "--log-level=LEVEL", "Log level, one of #{Log::Severity.values} (default: #{CONFIG.log_level})") do |log_level| + CONFIG.log_level = Log::Severity.parse(log_level) end parser.on("-k", "--colorize", "Colorize logs") do CONFIG.colorize_logs = true @@ -140,11 +140,23 @@ end Kemal::CLI.new ARGV -if CONFIG.output.upcase != "STDOUT" - FileUtils.mkdir_p(File.dirname(CONFIG.output)) +Log.setup do |c| + colorize = CONFIG.colorize_logs + output = CONFIG.output + + backend = Log::IOBackend.new(formatter: Invidious::Logger.formatter(colorize)) + if output.upcase != "STDOUT" + Dir.mkdir_p(File.dirname(output)) + io = File.open(output, "wb") + colorize = false + backend = Log::IOBackend.new(io, formatter: Invidious::Logger.formatter(colorize)) + puts("File output enabled in config, logs will being saved in '#{output}'") + end + + c.bind "*", CONFIG.log_level, backend + c.bind "db.*", :none, backend + c.bind "http.*", :none, backend end -OUTPUT = CONFIG.output.upcase == "STDOUT" ? STDOUT : File.open(CONFIG.output, mode: "a") -LOGGER = Invidious::LogHandler.new(OUTPUT, CONFIG.log_level, CONFIG.colorize_logs) # Check table integrity Invidious::Database.check_integrity(CONFIG) @@ -242,7 +254,6 @@ add_context_storage_type(Array(String)) add_context_storage_type(Preferences) add_context_storage_type(Invidious::User) -Kemal.config.logger = LOGGER Kemal.config.app_name = "Invidious" # Use in kemal's production mode. diff --git a/src/invidious/channels/about.cr b/src/invidious/channels/about.cr index 13909527..fa99e99f 100644 --- a/src/invidious/channels/about.cr +++ b/src/invidious/channels/about.cr @@ -200,7 +200,7 @@ def fetch_related_channels(about_channel : AboutChannel, continuation : String? initial_data = YoutubeAPI.browse(continuation) end - items, continuation = extract_items(initial_data) + items, continuation = YoutubeJSONParser.extract_items(initial_data) return items.select(SearchChannel), continuation end diff --git a/src/invidious/channels/channels.cr b/src/invidious/channels/channels.cr index 65982325..e10e4489 100644 --- a/src/invidious/channels/channels.cr +++ b/src/invidious/channels/channels.cr @@ -38,7 +38,7 @@ struct ChannelVideo json.field "authorId", self.ucid json.field "authorUrl", "/channel/#{self.ucid}" json.field "published", self.published.to_unix - json.field "publishedText", translate(locale, "`x` ago", recode_date(self.published, locale)) + json.field "publishedText", I18n.translate(locale, "`x` ago", recode_date(self.published, locale)) json.field "viewCount", self.views end @@ -156,8 +156,8 @@ def get_channel(id) : InvidiousChannel end def fetch_channel(ucid, pull_all_videos : Bool) - LOGGER.debug("fetch_channel: #{ucid}") - LOGGER.trace("fetch_channel: #{ucid} : pull_all_videos = #{pull_all_videos}") + ::Log.forf.debug { "#{ucid}" } + ::Log.forf.trace { "#{ucid} : pull_all_videos = #{pull_all_videos}" } namespaces = { "yt" => "http://www.youtube.com/xml/schemas/2015", @@ -165,9 +165,9 @@ def fetch_channel(ucid, pull_all_videos : Bool) "default" => "http://www.w3.org/2005/Atom", } - LOGGER.trace("fetch_channel: #{ucid} : Downloading RSS feed") + ::Log.forf.trace { "#{ucid} : Downloading RSS feed" } rss = YT_POOL.client &.get("/feeds/videos.xml?channel_id=#{ucid}").body - LOGGER.trace("fetch_channel: #{ucid} : Parsing RSS feed") + ::Log.forf.trace { "#{ucid} : Parsing RSS feed" } rss = XML.parse(rss) author = rss.xpath_node("//default:feed/default:title", namespaces) @@ -184,7 +184,7 @@ def fetch_channel(ucid, pull_all_videos : Bool) auto_generated = true end - LOGGER.trace("fetch_channel: #{ucid} : author = #{author}, auto_generated = #{auto_generated}") + ::Log.forf.trace { "#{ucid} : author = #{author}, auto_generated = #{auto_generated}" } channel = InvidiousChannel.new({ id: ucid, @@ -194,10 +194,10 @@ def fetch_channel(ucid, pull_all_videos : Bool) subscribed: nil, }) - LOGGER.trace("fetch_channel: #{ucid} : Downloading channel videos page") + ::Log.forf.trace { "#{ucid} : Downloading channel videos page" } videos, continuation = IV::Channel::Tabs.get_videos(channel) - LOGGER.trace("fetch_channel: #{ucid} : Extracting videos from channel RSS feed") + ::Log.forf.trace { "#{ucid} : Extracting videos from channel RSS feed" } rss.xpath_nodes("//default:feed/default:entry", namespaces).each do |entry| video_id = entry.xpath_node("yt:videoId", namespaces).not_nil!.content title = entry.xpath_node("default:title", namespaces).not_nil!.content @@ -241,17 +241,17 @@ def fetch_channel(ucid, pull_all_videos : Bool) views: views, }) - LOGGER.trace("fetch_channel: #{ucid} : video #{video_id} : Updating or inserting video") + ::Log.forf.trace { "#{ucid} : video #{video_id} : Updating or inserting video" } # We don't include the 'premiere_timestamp' here because channel pages don't include them, # meaning the above timestamp is always null was_insert = Invidious::Database::ChannelVideos.insert(video) if was_insert - LOGGER.trace("fetch_channel: #{ucid} : video #{video_id} : Inserted, updating subscriptions") + ::Log.forf.trace { "#{ucid} : video #{video_id} : Inserted, updating subscriptions" } NOTIFICATION_CHANNEL.send(VideoNotification.from_video(video)) else - LOGGER.trace("fetch_channel: #{ucid} : video #{video_id} : Updated") + ::Log.forf.trace { "#{ucid} : video #{video_id} : Updated" } end end diff --git a/src/invidious/channels/community.cr b/src/invidious/channels/community.cr index 49ffd990..66978ace 100644 --- a/src/invidious/channels/community.cr +++ b/src/invidious/channels/community.cr @@ -7,7 +7,7 @@ def fetch_channel_community(ucid, cursor, locale, format, thin_mode) initial_data = YoutubeAPI.browse(ucid, params: "Egljb21tdW5pdHk%3D") items = [] of JSON::Any - extract_items(initial_data) do |item| + YoutubeJSONParser.extract_items(initial_data) do |item| items << item end else @@ -43,7 +43,7 @@ def fetch_channel_community_post(ucid, post_id, locale, format, thin_mode) initial_data = YoutubeAPI.browse(ucid, params: params) items = [] of JSON::Any - extract_items(initial_data) do |item| + YoutubeJSONParser.extract_items(initial_data) do |item| items << item end @@ -125,7 +125,7 @@ def extract_channel_community(items, *, ucid, locale, format, thin_mode, is_sing json.field "contentHtml", content_html json.field "published", published.to_unix - json.field "publishedText", translate(locale, "`x` ago", recode_date(published, locale)) + json.field "publishedText", I18n.translate(locale, "`x` ago", recode_date(published, locale)) json.field "likeCount", like_count json.field "replyCount", reply_count @@ -136,7 +136,7 @@ def extract_channel_community(items, *, ucid, locale, format, thin_mode, is_sing json.field "attachment" do case attachment.as_h when .has_key?("videoRenderer") - parse_item(attachment) + YoutubeJSONParser.parse_item(attachment) .as(SearchVideo) .to_json(locale, json) when .has_key?("backstageImageRenderer") @@ -224,7 +224,7 @@ def extract_channel_community(items, *, ucid, locale, format, thin_mode, is_sing end end when .has_key?("playlistRenderer") - parse_item(attachment) + YoutubeJSONParser.parse_item(attachment) .as(SearchPlaylist) .to_json(locale, json) when .has_key?("quizRenderer") diff --git a/src/invidious/channels/playlists.cr b/src/invidious/channels/playlists.cr index 9b45d0c8..2a1c80bb 100644 --- a/src/invidious/channels/playlists.cr +++ b/src/invidious/channels/playlists.cr @@ -24,7 +24,7 @@ def fetch_channel_playlists(ucid, author, continuation, sort_by) initial_data = YoutubeAPI.browse(ucid, params: params || "") end - return extract_items(initial_data, author, ucid) + return YoutubeJSONParser.extract_items(initial_data, author, ucid) end def fetch_channel_podcasts(ucid, author, continuation) @@ -33,7 +33,7 @@ def fetch_channel_podcasts(ucid, author, continuation) else initial_data = YoutubeAPI.browse(ucid, params: "Eghwb2RjYXN0c_IGBQoDugEA") end - return extract_items(initial_data, author, ucid) + return YoutubeJSONParser.extract_items(initial_data, author, ucid) end def fetch_channel_releases(ucid, author, continuation) @@ -42,7 +42,7 @@ def fetch_channel_releases(ucid, author, continuation) else initial_data = YoutubeAPI.browse(ucid, params: "EghyZWxlYXNlc_IGBQoDsgEA") end - return extract_items(initial_data, author, ucid) + return YoutubeJSONParser.extract_items(initial_data, author, ucid) end def fetch_channel_courses(ucid, author, continuation) @@ -51,5 +51,5 @@ def fetch_channel_courses(ucid, author, continuation) else initial_data = YoutubeAPI.browse(ucid, params: "Egdjb3Vyc2Vz8gYFCgPCAQA%3D") end - return extract_items(initial_data, author, ucid) + return YoutubeJSONParser.extract_items(initial_data, author, ucid) end diff --git a/src/invidious/channels/videos.cr b/src/invidious/channels/videos.cr index 96400f47..91908054 100644 --- a/src/invidious/channels/videos.cr +++ b/src/invidious/channels/videos.cr @@ -29,7 +29,7 @@ module Invidious::Channel::Tabs continuation ||= make_initial_videos_ctoken(ucid, sort_by) initial_data = YoutubeAPI.browse(continuation: continuation) - return extract_items(initial_data, author, ucid) + return YoutubeJSONParser.extract_items(initial_data, author, ucid) end def get_60_videos(channel : AboutChannel, *, continuation : String? = nil, sort_by = "newest") @@ -59,7 +59,7 @@ module Invidious::Channel::Tabs continuation ||= make_initial_shorts_ctoken(channel.ucid, sort_by) initial_data = YoutubeAPI.browse(continuation: continuation) - return extract_items(initial_data, channel.author, channel.ucid) + return YoutubeJSONParser.extract_items(initial_data, channel.author, channel.ucid) end # ------------------- @@ -70,7 +70,7 @@ module Invidious::Channel::Tabs continuation ||= make_initial_livestreams_ctoken(channel.ucid, sort_by) initial_data = YoutubeAPI.browse(continuation: continuation) - return extract_items(initial_data, channel.author, channel.ucid) + return YoutubeJSONParser.extract_items(initial_data, channel.author, channel.ucid) end def get_60_livestreams(channel : AboutChannel, *, continuation : String? = nil, sort_by = "newest") diff --git a/src/invidious/comments/youtube.cr b/src/invidious/comments/youtube.cr index 0716fcde..2df9ab76 100644 --- a/src/invidious/comments/youtube.cr +++ b/src/invidious/comments/youtube.cr @@ -264,7 +264,7 @@ module Invidious::Comments end json.field "published", published.to_unix - json.field "publishedText", translate(locale, "`x` ago", recode_date(published, locale)) + json.field "publishedText", I18n.translate(locale, "`x` ago", recode_date(published, locale)) end if node_replies && !response["commentRepliesContinuation"]? diff --git a/src/invidious/config.cr b/src/invidious/config.cr index 4d69854c..700924b1 100644 --- a/src/invidious/config.cr +++ b/src/invidious/config.cr @@ -73,6 +73,7 @@ end class Config include YAML::Serializable + CLog = ::Log.for(self) class CompanionConfig include YAML::Serializable @@ -93,8 +94,8 @@ class Config property feed_threads : Int32 = 1 # Log file path or STDOUT property output : String = "STDOUT" - # Default log level, valid YAML values are ints and strings, see src/invidious/helpers/logger.cr - property log_level : LogLevel = LogLevel::Info + # Default log level, valid YAML values are ints and strings, see https://crystal-lang.org/api/master/CLog.Severity.html#enum-members + property log_level : Log::Severity = Log::Severity::Info # Enables colors in logs. Useful for debugging purposes property colorize_logs : Bool = false # Database configuration with separate parameters (username, hostname, etc) @@ -244,14 +245,14 @@ class Config # Exit on fail if !success - puts %(Config.{{ivar.id}} failed to parse #{env_value} as {{ivar.type}}) + CLog.fatal { %({{ivar.id}} failed to parse #{env_value} as {{ivar.type}}) } exit(1) end end # Warn when any config attribute is set to "CHANGE_ME!!" if config.{{ivar.id}} == "CHANGE_ME!!" - puts "Config: The value of '#{ {{ivar.stringify}} }' needs to be changed!!" + CLog.fatal { "The value of '#{ {{ivar.stringify}} }' needs to be changed!!" } exit(1) end {% end %} @@ -259,28 +260,28 @@ class Config if config.invidious_companion.present? # invidious_companion and signature_server can't work together if config.signature_server - puts "Config: You can not run inv_sig_helper and invidious_companion at the same time." + CLog.fatal { "You can not run inv_sig_helper and invidious_companion at the same time." } exit(1) elsif config.invidious_companion_key.empty? - puts "Config: Please configure a key if you are using invidious companion." + CLog.fatal { "Please configure a key if you are using invidious companion." } exit(1) elsif config.invidious_companion_key == "CHANGE_ME!!" - puts "Config: The value of 'invidious_companion_key' needs to be changed!!" + CLog.fatal { "The value of 'invidious_companion_key' needs to be changed!!" } exit(1) elsif config.invidious_companion_key.size != 16 - puts "Config: The value of 'invidious_companion_key' needs to be a size of 16 characters." + CLog.fatal { "The value of 'invidious_companion_key' needs to be a size of 16 characters." } exit(1) end elsif config.signature_server - puts("WARNING: inv-sig-helper is deprecated. Please switch to Invidious companion: https://docs.invidious.io/companion-installation/") + CLog.warn { "inv-sig-helper is deprecated. Please switch to Invidious companion: https://docs.invidious.io/companion-installation/" } else - puts("WARNING: Invidious companion is required to view and playback videos. For more information see https://docs.invidious.io/companion-installation/") + CLog.warn { "Invidious companion is required to view and playback videos. For more information see https://docs.invidious.io/companion-installation/" } end # HMAC_key is mandatory # See: https://github.com/iv-org/invidious/issues/3854 if config.hmac_key.empty? - puts "Config: 'hmac_key' is required/can't be empty" + CLog.fatal { "'hmac_key' is required/can't be empty" } exit(1) end @@ -296,7 +297,7 @@ class Config path: db.dbname, ) else - puts "Config: Either database_url or db.* is required" + CLog.fatal { "Either database_url or db.* is required" } exit(1) end end @@ -304,17 +305,17 @@ class Config # Check if the socket configuration is valid if sb = config.socket_binding if sb.path.ends_with?("/") || File.directory?(sb.path) - puts "Config: The socket path " + sb.path + " must not be a directory!" + CLog.fatal { "The socket path " + sb.path + " must not be a directory!" } exit(1) end d = File.dirname(sb.path) if !File.directory?(d) - puts "Config: Socket directory " + sb.path + " does not exist or is not a directory!" + CLog.fatal { "Socket directory " + sb.path + " does not exist or is not a directory!" } exit(1) end p = sb.permissions.to_i?(base: 8) if !p || p < 0 || p > 0o777 - puts "Config: Socket permissions must be an octal between 0 and 777!" + CLog.fatal { "Socket permissions must be an octal between 0 and 777!" } exit(1) end end diff --git a/src/invidious/database/base.cr b/src/invidious/database/base.cr index 0fb1b6af..cf73fc49 100644 --- a/src/invidious/database/base.cr +++ b/src/invidious/database/base.cr @@ -2,6 +2,7 @@ require "pg" module Invidious::Database extend self + Log = ::Log.for(self) # Checks table integrity # @@ -33,7 +34,7 @@ module Invidious::Database return # TODO if !PG_DB.query_one?("SELECT true FROM pg_type WHERE typname = $1", enum_name, as: Bool) - LOGGER.info("check_enum: CREATE TYPE #{enum_name}") + ::Log.forf.info { "CREATE TYPE #{enum_name}" } PG_DB.using_connection do |conn| conn.as(PG::Connection).exec_all(File.read("config/sql/#{enum_name}.sql")) @@ -46,7 +47,7 @@ module Invidious::Database begin PG_DB.exec("SELECT * FROM #{table_name} LIMIT 0") rescue ex - LOGGER.info("check_table: check_table: CREATE TABLE #{table_name}") + ::Log.forf.info { "CREATE TABLE #{table_name}" } PG_DB.using_connection do |conn| conn.as(PG::Connection).exec_all(File.read("config/sql/#{table_name}.sql")) @@ -66,7 +67,7 @@ module Invidious::Database if name != column_array[i]? if !column_array[i]? new_column = column_types.select(&.starts_with?(name))[0] - LOGGER.info("check_table: ALTER TABLE #{table_name} ADD COLUMN #{new_column}") + ::Log.forf.info { "ALTER TABLE #{table_name} ADD COLUMN #{new_column}" } PG_DB.exec("ALTER TABLE #{table_name} ADD COLUMN #{new_column}") next end @@ -84,29 +85,29 @@ module Invidious::Database # There's a column we didn't expect if !new_column - LOGGER.info("check_table: ALTER TABLE #{table_name} DROP COLUMN #{column_array[i]}") + ::Log.forf.info { "ALTER TABLE #{table_name} DROP COLUMN #{column_array[i]}" } PG_DB.exec("ALTER TABLE #{table_name} DROP COLUMN #{column_array[i]} CASCADE") column_array = get_column_array(PG_DB, table_name) next end - LOGGER.info("check_table: ALTER TABLE #{table_name} ADD COLUMN #{new_column}") + ::Log.forf.info { "ALTER TABLE #{table_name} ADD COLUMN #{new_column}" } PG_DB.exec("ALTER TABLE #{table_name} ADD COLUMN #{new_column}") - LOGGER.info("check_table: UPDATE #{table_name} SET #{column_array[i]}_new=#{column_array[i]}") + ::Log.forf.info { "UPDATE #{table_name} SET #{column_array[i]}_new=#{column_array[i]}" } PG_DB.exec("UPDATE #{table_name} SET #{column_array[i]}_new=#{column_array[i]}") - LOGGER.info("check_table: ALTER TABLE #{table_name} DROP COLUMN #{column_array[i]} CASCADE") + ::Log.forf.info { "ALTER TABLE #{table_name} DROP COLUMN #{column_array[i]} CASCADE" } PG_DB.exec("ALTER TABLE #{table_name} DROP COLUMN #{column_array[i]} CASCADE") - LOGGER.info("check_table: ALTER TABLE #{table_name} RENAME COLUMN #{column_array[i]}_new TO #{column_array[i]}") + ::Log.forf.info { "ALTER TABLE #{table_name} RENAME COLUMN #{column_array[i]}_new TO #{column_array[i]}" } PG_DB.exec("ALTER TABLE #{table_name} RENAME COLUMN #{column_array[i]}_new TO #{column_array[i]}") column_array = get_column_array(PG_DB, table_name) end else - LOGGER.info("check_table: ALTER TABLE #{table_name} DROP COLUMN #{column_array[i]} CASCADE") + ::Log.forf.info { "ALTER TABLE #{table_name} DROP COLUMN #{column_array[i]} CASCADE" } PG_DB.exec("ALTER TABLE #{table_name} DROP COLUMN #{column_array[i]} CASCADE") end end @@ -116,7 +117,7 @@ module Invidious::Database column_array.each do |column| if !struct_array.includes? column - LOGGER.info("check_table: ALTER TABLE #{table_name} DROP COLUMN #{column} CASCADE") + ::Log.forf.info { "ALTER TABLE #{table_name} DROP COLUMN #{column} CASCADE" } PG_DB.exec("ALTER TABLE #{table_name} DROP COLUMN #{column} CASCADE") end end diff --git a/src/invidious/database/migrator.cr b/src/invidious/database/migrator.cr index 660c3203..054886ed 100644 --- a/src/invidious/database/migrator.cr +++ b/src/invidious/database/migrator.cr @@ -14,12 +14,12 @@ class Invidious::Database::Migrator .each do |migration| next if versions.includes?(migration.version) - puts "Running migration: #{migration.class.name}" + Log.info { "Running migration: #{migration.class.name}" } migration.migrate ran_migration = true end - puts "No migrations to run." unless ran_migration + Log.info { "No migrations to run." } unless ran_migration end def pending_migrations? : Bool diff --git a/src/invidious/frontend/channel_page.cr b/src/invidious/frontend/channel_page.cr index 4fe21b96..4af3b4f5 100644 --- a/src/invidious/frontend/channel_page.cr +++ b/src/invidious/frontend/channel_page.cr @@ -28,14 +28,14 @@ module Invidious::Frontend::ChannelPage if tab == selected_tab str << "\t" - str << translate(locale, "channel_tab_#{tab_name}_label") + str << I18n.translate(locale, "channel_tab_#{tab_name}_label") str << "\n" else # Video tab doesn't have the last path component url = tab.videos? ? base_url : "#{base_url}/#{tab_name}" str << %(\t) - str << translate(locale, "channel_tab_#{tab_name}_label") + str << I18n.translate(locale, "channel_tab_#{tab_name}_label") str << "\n" end diff --git a/src/invidious/frontend/comments_reddit.cr b/src/invidious/frontend/comments_reddit.cr index 4dda683e..74d9d8d8 100644 --- a/src/invidious/frontend/comments_reddit.cr +++ b/src/invidious/frontend/comments_reddit.cr @@ -32,9 +32,9 @@ module Invidious::Frontend::Comments

[ − ] #{child.author} - #{translate_count(locale, "comments_points_count", child.score, NumberFormatting::Separator)} - #{translate(locale, "`x` ago", recode_date(child.created_utc, locale))} - #{translate(locale, "permalink")} + #{I18n.translate_count(locale, "comments_points_count", child.score, I18n::NumberFormatting::Separator)} + #{I18n.translate(locale, "`x` ago", recode_date(child.created_utc, locale))} + #{I18n.translate(locale, "permalink")}

#{body_html} diff --git a/src/invidious/frontend/comments_youtube.cr b/src/invidious/frontend/comments_youtube.cr index a0e1d783..89d3caef 100644 --- a/src/invidious/frontend/comments_youtube.cr +++ b/src/invidious/frontend/comments_youtube.cr @@ -6,10 +6,10 @@ module Invidious::Frontend::Comments root = comments["comments"].as_a root.each do |child| if child["replies"]? - replies_count_text = translate_count(locale, + replies_count_text = I18n.translate_count(locale, "comments_view_x_replies", child["replies"]["replyCount"].as_i64 || 0, - NumberFormatting::Separator + I18n::NumberFormatting::Separator ) replies_html = <<-END_HTML @@ -25,10 +25,10 @@ module Invidious::Frontend::Comments END_HTML elsif comments["authorId"]? && !comments["singlePost"]? # for posts we should display a link to the post - replies_count_text = translate_count(locale, + replies_count_text = I18n.translate_count(locale, "comments_view_x_replies", child["replyCount"].as_i64 || 0, - NumberFormatting::Separator + I18n::NumberFormatting::Separator ) replies_html = <<-END_HTML @@ -61,7 +61,7 @@ module Invidious::Frontend::Comments sponsor_icon = String.build do |str| str << %() end end @@ -110,14 +110,14 @@ module Invidious::Frontend::Comments when "multiImage" html << <<-END_HTML
\n" {% end %} end diff --git a/src/invidious/frontend/watch_page.cr b/src/invidious/frontend/watch_page.cr index 15d925e3..4942c22e 100644 --- a/src/invidious/frontend/watch_page.cr +++ b/src/invidious/frontend/watch_page.cr @@ -20,7 +20,7 @@ module Invidious::Frontend::WatchPage def download_widget(locale : String, video : Video, video_assets : VideoAssets) : String if CONFIG.disabled?("downloads") - return "

#{translate(locale, "Download is disabled")}

" + return "

#{I18n.translate(locale, "Download is disabled")}

" end url = "/download" @@ -45,7 +45,7 @@ module Invidious::Frontend::WatchPage str << "\t
\n" str << "\t\t\n" str << "\t\tvalue="<%= HTML.escape(query.text) %>"<% end %> - placeholder="<%= translate(locale, "Search for videos") %>"> + placeholder="<%= I18n.translate(locale, "Search for videos") %>"> diff --git a/src/invidious/views/community.ecr b/src/invidious/views/community.ecr index 132e636c..a0fc47f5 100644 --- a/src/invidious/views/community.ecr +++ b/src/invidious/views/community.ecr @@ -35,10 +35,10 @@ <%= { "ucid" => ucid, - "youtube_comments_text" => HTML.escape(translate(locale, "View YouTube comments")), - "comments_text" => HTML.escape(translate(locale, "View `x` comments", "{commentCount}")), - "hide_replies_text" => HTML.escape(translate(locale, "Hide replies")), - "show_replies_text" => HTML.escape(translate(locale, "Show replies")), + "youtube_comments_text" => HTML.escape(I18n.translate(locale, "View YouTube comments")), + "comments_text" => HTML.escape(I18n.translate(locale, "View `x` comments", "{commentCount}")), + "hide_replies_text" => HTML.escape(I18n.translate(locale, "Hide replies")), + "show_replies_text" => HTML.escape(I18n.translate(locale, "Show replies")), "preferences" => env.get("preferences").as(Preferences) }.to_pretty_json %> diff --git a/src/invidious/views/components/channel_info.ecr b/src/invidious/views/components/channel_info.ecr index f4164f31..1288ff58 100644 --- a/src/invidious/views/components/channel_info.ecr +++ b/src/invidious/views/components/channel_info.ecr @@ -24,7 +24,7 @@
@@ -37,10 +37,10 @@
<%= Invidious::Frontend::ChannelPage.generate_tabs_links(locale, channel, selected_tab) %> @@ -50,9 +50,9 @@ <% sort_options.each do |sort| %>
<% if sort_by == sort %> - <%= translate(locale, sort) %> + <%= I18n.translate(locale, sort) %> <% else %> - <%= translate(locale, sort) %> + <%= I18n.translate(locale, sort) %> <% end %>
<% end %> diff --git a/src/invidious/views/components/feed_menu.ecr b/src/invidious/views/components/feed_menu.ecr index 3dbeaf37..aeaf183b 100644 --- a/src/invidious/views/components/feed_menu.ecr +++ b/src/invidious/views/components/feed_menu.ecr @@ -5,7 +5,7 @@ <% end %> <% feed_menu.each do |feed| %> - <%= translate(locale, feed) %> + <%= I18n.translate(locale, feed) %> <% end %>
diff --git a/src/invidious/views/components/item.ecr b/src/invidious/views/components/item.ecr index a24423df..ece2efe8 100644 --- a/src/invidious/views/components/item.ecr +++ b/src/invidious/views/components/item.ecr @@ -27,8 +27,8 @@
<% if !item.channel_handle.nil? %>

<%= item.channel_handle %>

<% end %> -

<%= translate_count(locale, "generic_subscribers_count", item.subscriber_count, NumberFormatting::Separator) %>

- <% if !item.auto_generated && item.channel_handle.nil? %>

<%= translate_count(locale, "generic_videos_count", item.video_count, NumberFormatting::Separator) %>

<% end %> +

<%= I18n.translate_count(locale, "generic_subscribers_count", item.subscriber_count, I18n::NumberFormatting::Separator) %>

+ <% if !item.auto_generated && item.channel_handle.nil? %>

<%= I18n.translate_count(locale, "generic_videos_count", item.video_count, I18n::NumberFormatting::Separator) %>

<% end %>
<%= item.description_html %>
<% when SearchHashtag %> <% if !thin_mode %> @@ -45,13 +45,13 @@
<%- if item.video_count != 0 -%> -

<%= translate_count(locale, "generic_videos_count", item.video_count, NumberFormatting::Separator) %>

+

<%= I18n.translate_count(locale, "generic_videos_count", item.video_count, I18n::NumberFormatting::Separator) %>

<%- end -%>
<%- if item.channel_count != 0 -%> -

<%= translate_count(locale, "generic_channels_count", item.channel_count, NumberFormatting::Separator) %>

+

<%= I18n.translate_count(locale, "generic_channels_count", item.channel_count, I18n::NumberFormatting::Separator) %>

<%- end -%>
<% when SearchPlaylist, InvidiousPlaylist %> @@ -73,7 +73,7 @@ <%- end -%>
-

<%= translate_count(locale, "generic_videos_count", item.video_count, NumberFormatting::Separator) %>

+

<%= I18n.translate_count(locale, "generic_videos_count", item.video_count, I18n::NumberFormatting::Separator) %>

@@ -101,11 +101,11 @@
-

<%=translate(locale, "timeline_parse_error_placeholder_heading")%>

-

<%=translate(locale, "timeline_parse_error_placeholder_message")%>

+

<%=I18n.translate(locale, "timeline_parse_error_placeholder_heading")%>

+

<%=I18n.translate(locale, "timeline_parse_error_placeholder_message")%>

- <%=translate(locale, "timeline_parse_error_show_technical_details")%> + <%=I18n.translate(locale, "timeline_parse_error_show_technical_details")%>
<%=get_issue_template(env, item.parse_exception)[1]%>
@@ -168,7 +168,7 @@
<%- if item.responds_to?(:live_now) && item.live_now -%> -

 <%= translate(locale, "LIVE") %>

+

 <%= I18n.translate(locale, "LIVE") %>

<%- elsif item.length_seconds != 0 -%>

<%= recode_length_seconds(item.length_seconds) %>

<%- end -%> @@ -200,15 +200,15 @@
<% if item.responds_to?(:premiere_timestamp) && item.premiere_timestamp.try &.> Time.utc %> -

<%= translate(locale, "Premieres in `x`", recode_date((item.premiere_timestamp.as(Time) - Time.utc).ago, locale)) %>

+

<%= I18n.translate(locale, "Premieres in `x`", recode_date((item.premiere_timestamp.as(Time) - Time.utc).ago, locale)) %>

<% elsif item.responds_to?(:published) && (Time.utc - item.published) > 1.minute %> -

<%= translate(locale, "Shared `x` ago", recode_date(item.published, locale)) %>

+

<%= I18n.translate(locale, "Shared `x` ago", recode_date(item.published, locale)) %>

<% end %>
<% if item.responds_to?(:views) && item.views %>
-

<%= translate_count(locale, "generic_views_count", item.views || 0, NumberFormatting::Short) %>

+

<%= I18n.translate_count(locale, "generic_views_count", item.views || 0, I18n::NumberFormatting::Short) %>

<% end %>
diff --git a/src/invidious/views/components/items_paginated.ecr b/src/invidious/views/components/items_paginated.ecr index f69df3fe..bb630d62 100644 --- a/src/invidious/views/components/items_paginated.ecr +++ b/src/invidious/views/components/items_paginated.ecr @@ -11,9 +11,9 @@ diff --git a/src/invidious/views/components/search_box.ecr b/src/invidious/views/components/search_box.ecr index 29da2c52..f957c25c 100644 --- a/src/invidious/views/components/search_box.ecr +++ b/src/invidious/views/components/search_box.ecr @@ -2,11 +2,11 @@
autofocus<% end %> - name="q" placeholder="<%= translate(locale, "search") %>" - title="<%= translate(locale, "search") %>" + name="q" placeholder="<%= I18n.translate(locale, "search") %>" + title="<%= I18n.translate(locale, "search") %>" value="<%= env.get?("search").try {|x| HTML.escape(x.as(String)) } %>">
- diff --git a/src/invidious/views/components/subscribe_widget.ecr b/src/invidious/views/components/subscribe_widget.ecr index 3cfcb0eb..742e9a82 100644 --- a/src/invidious/views/components/subscribe_widget.ecr +++ b/src/invidious/views/components/subscribe_widget.ecr @@ -3,14 +3,14 @@
" method="post"> ">
<% else %>
" method="post"> ">
<% end %> @@ -22,8 +22,8 @@ "author" => HTML.escape(author), "sub_count_text" => HTML.escape(sub_count_text), "csrf_token" => URI.encode_www_form(env.get?("csrf_token").try &.as(String) || ""), - "subscribe_text" => HTML.escape(translate(locale, "Subscribe")), - "unsubscribe_text" => HTML.escape(translate(locale, "Unsubscribe")) + "subscribe_text" => HTML.escape(I18n.translate(locale, "Subscribe")), + "unsubscribe_text" => HTML.escape(I18n.translate(locale, "Unsubscribe")) }.to_pretty_json %> @@ -31,6 +31,6 @@ <% else %> "> - <%= translate(locale, "Subscribe") %> | <%= sub_count_text %> + <%= I18n.translate(locale, "Subscribe") %> | <%= sub_count_text %> <% end %> diff --git a/src/invidious/views/components/video-context-buttons.ecr b/src/invidious/views/components/video-context-buttons.ecr index 22458a03..c9aff472 100644 --- a/src/invidious/views/components/video-context-buttons.ecr +++ b/src/invidious/views/components/video-context-buttons.ecr @@ -1,18 +1,18 @@
- " rel="noreferrer noopener" href="https://www.youtube.com/watch<%=endpoint_params%>"> + " rel="noreferrer noopener" href="https://www.youtube.com/watch<%=endpoint_params%>"> - " href="/watch<%=endpoint_params%>&listen=1"> + " href="/watch<%=endpoint_params%>&listen=1"> <% if env.get("preferences").as(Preferences).automatic_instance_redirect%> - " href="/redirect?referer=%2Fwatch<%=URI.encode_www_form(endpoint_params)%>"> + " href="/redirect?referer=%2Fwatch<%=URI.encode_www_form(endpoint_params)%>"> <% else %> - " href="https://redirect.invidious.io/watch<%=endpoint_params%>"> + " href="https://redirect.invidious.io/watch<%=endpoint_params%>"> <% end %> diff --git a/src/invidious/views/create_playlist.ecr b/src/invidious/views/create_playlist.ecr index 807244e6..feff6522 100644 --- a/src/invidious/views/create_playlist.ecr +++ b/src/invidious/views/create_playlist.ecr @@ -1,5 +1,5 @@ <% content_for "header" do %> -<%= translate(locale, "Create playlist") %> - Invidious +<%= I18n.translate(locale, "Create playlist") %> - Invidious <% end %>
@@ -8,25 +8,25 @@
- <%= translate(locale, "Create playlist") %> + <%= I18n.translate(locale, "Create playlist") %>
- - "> + + ">
- +
diff --git a/src/invidious/views/delete_playlist.ecr b/src/invidious/views/delete_playlist.ecr index cd66b963..6e296153 100644 --- a/src/invidious/views/delete_playlist.ecr +++ b/src/invidious/views/delete_playlist.ecr @@ -1,20 +1,20 @@ <% content_for "header" do %> -<%= translate(locale, "Delete playlist") %> - Invidious +<%= I18n.translate(locale, "Delete playlist") %> - Invidious <% end %>
- <%= translate(locale, "Delete playlist `x`?", %|"#{HTML.escape(playlist.title)}"|) %> + <%= I18n.translate(locale, "Delete playlist `x`?", %|"#{HTML.escape(playlist.title)}"|) %>
diff --git a/src/invidious/views/edit_playlist.ecr b/src/invidious/views/edit_playlist.ecr index 34157c67..123a5d44 100644 --- a/src/invidious/views/edit_playlist.ecr +++ b/src/invidious/views/edit_playlist.ecr @@ -10,17 +10,17 @@ @@ -36,11 +36,11 @@
<%= HTML.escape(playlist.author) %> | - <%= translate_count(locale, "generic_videos_count", playlist.video_count) %> | + <%= I18n.translate_count(locale, "generic_videos_count", playlist.video_count) %> |
diff --git a/src/invidious/views/feeds/history.ecr b/src/invidious/views/feeds/history.ecr index 13fe4147..cfa5c7e1 100644 --- a/src/invidious/views/feeds/history.ecr +++ b/src/invidious/views/feeds/history.ecr @@ -1,19 +1,19 @@ <% content_for "header" do %> -<%= translate(locale, "History") %> - Invidious +<%= I18n.translate(locale, "History") %> - Invidious <% end %>
-

<%= translate_count(locale, "generic_videos_count", user.watched.size, NumberFormatting::HtmlSpan) %>

+

<%= I18n.translate_count(locale, "generic_videos_count", user.watched.size, I18n::NumberFormatting::HtmlSpan) %>

diff --git a/src/invidious/views/feeds/playlists.ecr b/src/invidious/views/feeds/playlists.ecr index 2a4b6edd..baf64e97 100644 --- a/src/invidious/views/feeds/playlists.ecr +++ b/src/invidious/views/feeds/playlists.ecr @@ -1,22 +1,22 @@ <% content_for "header" do %> -<%= translate(locale, "Playlists") %> - Invidious +<%= I18n.translate(locale, "Playlists") %> - Invidious <% end %> <%= rendered "components/feed_menu" %>
-

<%= translate(locale, "user_created_playlists", %(#{items_created.size})) %>

+

<%= I18n.translate(locale, "user_created_playlists", %(#{items_created.size})) %>

@@ -30,7 +30,7 @@
-

<%= translate(locale, "user_saved_playlists", %(#{items_saved.size})) %>

+

<%= I18n.translate(locale, "user_saved_playlists", %(#{items_saved.size})) %>

diff --git a/src/invidious/views/feeds/popular.ecr b/src/invidious/views/feeds/popular.ecr index 5fbe539c..4177e53d 100644 --- a/src/invidious/views/feeds/popular.ecr +++ b/src/invidious/views/feeds/popular.ecr @@ -1,8 +1,8 @@ <% content_for "header" do %> -"> +"> <% if env.get("preferences").as(Preferences).default_home != "Popular" %> - <%= translate(locale, "Popular") %> - Invidious + <%= I18n.translate(locale, "Popular") %> - Invidious <% else %> Invidious <% end %> diff --git a/src/invidious/views/feeds/subscriptions.ecr b/src/invidious/views/feeds/subscriptions.ecr index c36bd00f..57e20526 100644 --- a/src/invidious/views/feeds/subscriptions.ecr +++ b/src/invidious/views/feeds/subscriptions.ecr @@ -1,5 +1,5 @@ <% content_for "header" do %> -<title><%= translate(locale, "Subscriptions") %> - Invidious +<%= I18n.translate(locale, "Subscriptions") %> - Invidious <% end %> @@ -8,12 +8,12 @@
@@ -26,7 +26,7 @@ <% if CONFIG.enable_user_notifications %>
- <%= translate_count(locale, "subscriptions_unseen_notifs_count", notifications.size) %> + <%= I18n.translate_count(locale, "subscriptions_unseen_notifs_count", notifications.size) %>
<% if !notifications.empty? %> diff --git a/src/invidious/views/feeds/trending.ecr b/src/invidious/views/feeds/trending.ecr index 7dc416c6..dcd1f686 100644 --- a/src/invidious/views/feeds/trending.ecr +++ b/src/invidious/views/feeds/trending.ecr @@ -1,8 +1,8 @@ <% content_for "header" do %> -"> +"> <% if env.get("preferences").as(Preferences).default_home != "Trending" %> - <%= translate(locale, "Trending") %> - Invidious + <%= I18n.translate(locale, "Trending") %> - Invidious <% else %> Invidious <% end %> @@ -15,7 +15,7 @@ <div style="align-self:flex-end" class="pure-u-2-3"> <% if plid %> <a href="/playlist?list=<%= plid %>"> - <%= translate(locale, "View as playlist") %> + <%= I18n.translate(locale, "View as playlist") %> </a> <% end %> </div> @@ -24,10 +24,10 @@ <% {"Default", "Music", "Gaming", "Movies"}.each do |option| %> <div class="pure-u-1 pure-md-1-3"> <% if trending_type == option %> - <b><%= translate(locale, option) %></b> + <b><%= I18n.translate(locale, option) %></b> <% else %> <a href="/feed/trending?type=<%= option %>®ion=<%= region %>"> - <%= translate(locale, option) %> + <%= I18n.translate(locale, option) %> </a> <% end %> </div> diff --git a/src/invidious/views/licenses.ecr b/src/invidious/views/licenses.ecr index 3037f3d7..0776b0d7 100644 --- a/src/invidious/views/licenses.ecr +++ b/src/invidious/views/licenses.ecr @@ -7,7 +7,7 @@ </head> <body> - <h1><%= translate(locale, "JavaScript license information") %></h1> + <h1><%= I18n.translate(locale, "JavaScript license information") %></h1> <table id="jslicense-labels1"> <tr> <td> @@ -19,7 +19,7 @@ </td> <td> - <a href="https://github.com/iv-org/videojs-quality-selector"><%= translate(locale, "source") %></a> + <a href="https://github.com/iv-org/videojs-quality-selector"><%= I18n.translate(locale, "source") %></a> </td> </tr> @@ -33,7 +33,7 @@ </td> <td> - <a href="https://github.com/mpetazzoni/sse.js"><%= translate(locale, "source") %></a> + <a href="https://github.com/mpetazzoni/sse.js"><%= I18n.translate(locale, "source") %></a> </td> </tr> @@ -47,7 +47,7 @@ </td> <td> - <a href="https://github.com/videojs/videojs-contrib-quality-levels"><%= translate(locale, "source") %></a> + <a href="https://github.com/videojs/videojs-contrib-quality-levels"><%= I18n.translate(locale, "source") %></a> </td> </tr> @@ -61,7 +61,7 @@ </td> <td> - <a href="https://github.com/jfujita/videojs-http-source-selector"><%= translate(locale, "source") %></a> + <a href="https://github.com/jfujita/videojs-http-source-selector"><%= I18n.translate(locale, "source") %></a> </td> </tr> @@ -75,7 +75,7 @@ </td> <td> - <a href="https://github.com/mister-ben/videojs-mobile-ui"><%= translate(locale, "source") %></a> + <a href="https://github.com/mister-ben/videojs-mobile-ui"><%= I18n.translate(locale, "source") %></a> </td> </tr> @@ -89,7 +89,7 @@ </td> <td> - <a href="https://github.com/spchuang/videojs-markers"><%= translate(locale, "source") %></a> + <a href="https://github.com/spchuang/videojs-markers"><%= I18n.translate(locale, "source") %></a> </td> </tr> @@ -103,7 +103,7 @@ </td> <td> - <a href="https://github.com/brightcove/videojs-overlay"><%= translate(locale, "source") %></a> + <a href="https://github.com/brightcove/videojs-overlay"><%= I18n.translate(locale, "source") %></a> </td> </tr> @@ -117,7 +117,7 @@ </td> <td> - <a href="https://github.com/mkhazov/videojs-share"><%= translate(locale, "source") %></a> + <a href="https://github.com/mkhazov/videojs-share"><%= I18n.translate(locale, "source") %></a> </td> </tr> @@ -131,7 +131,7 @@ </td> <td> - <a href="https://github.com/chrisboustead/videojs-vtt-thumbnails"><%= translate(locale, "source") %></a> + <a href="https://github.com/chrisboustead/videojs-vtt-thumbnails"><%= I18n.translate(locale, "source") %></a> </td> </tr> @@ -145,7 +145,7 @@ </td> <td> - <a href="https://github.com/afrmtbl/videojs-youtube-annotations"><%= translate(locale, "source") %></a> + <a href="https://github.com/afrmtbl/videojs-youtube-annotations"><%= I18n.translate(locale, "source") %></a> </td> </tr> @@ -159,7 +159,7 @@ </td> <td> - <a href="https://github.com/videojs/videojs-vr"><%= translate(locale, "source") %></a> + <a href="https://github.com/videojs/videojs-vr"><%= I18n.translate(locale, "source") %></a> </td> </tr> @@ -173,7 +173,7 @@ </td> <td> - <a href="https://github.com/videojs/video.js"><%= translate(locale, "source") %></a> + <a href="https://github.com/videojs/video.js"><%= I18n.translate(locale, "source") %></a> </td> </tr> diff --git a/src/invidious/views/message.ecr b/src/invidious/views/message.ecr index 8c7bf611..789846fa 100644 --- a/src/invidious/views/message.ecr +++ b/src/invidious/views/message.ecr @@ -1,5 +1,5 @@ <% content_for "header" do %> -<meta name="description" content="<%= translate(locale, "An alternative front-end to YouTube") %>"> +<meta name="description" content="<%= I18n.translate(locale, "An alternative front-end to YouTube") %>"> <title> Invidious diff --git a/src/invidious/views/playlist.ecr b/src/invidious/views/playlist.ecr index c27ddba6..e41662c8 100644 --- a/src/invidious/views/playlist.ecr +++ b/src/invidious/views/playlist.ecr @@ -13,28 +13,28 @@ <%- if playlist.is_a?(InvidiousPlaylist) && playlist.author == user.try &.email -%> <%- else -%> @@ -42,7 +42,7 @@
@@ -57,15 +57,15 @@ <% else %> <%= author %> | <% end %> - <%= translate_count(locale, "generic_videos_count", playlist.video_count) %> | - <%= translate(locale, "Updated `x` ago", recode_date(playlist.updated, locale)) %> | + <%= I18n.translate_count(locale, "generic_videos_count", playlist.video_count) %> | + <%= I18n.translate(locale, "Updated `x` ago", recode_date(playlist.updated, locale)) %> | <% case playlist.as(InvidiousPlaylist).privacy when %> <% when PlaylistPrivacy::Public %> - <%= translate(locale, "Public") %> + <%= I18n.translate(locale, "Public") %> <% when PlaylistPrivacy::Unlisted %> - <%= translate(locale, "Unlisted") %> + <%= I18n.translate(locale, "Unlisted") %> <% when PlaylistPrivacy::Private %> - <%= translate(locale, "Private") %> + <%= I18n.translate(locale, "Private") %> <% end %> <% else %> @@ -76,25 +76,25 @@ <% subtitle = playlist.subtitle || "" %> <%= HTML.escape(subtitle[0..subtitle.rindex(" • ") || subtitle.size]) %> | <% end %> - <%= translate_count(locale, "generic_videos_count", playlist.video_count) %> | - <%= translate(locale, "Updated `x` ago", recode_date(playlist.updated, locale)) %> + <%= I18n.translate_count(locale, "generic_videos_count", playlist.video_count) %> | + <%= I18n.translate(locale, "Updated `x` ago", recode_date(playlist.updated, locale)) %> <% end %> <% if !playlist.is_a? InvidiousPlaylist %> diff --git a/src/invidious/views/post.ecr b/src/invidious/views/post.ecr index fb03a44c..de5c8dc6 100644 --- a/src/invidious/views/post.ecr +++ b/src/invidious/views/post.ecr @@ -18,7 +18,7 @@ <% else %> <% end %> @@ -29,12 +29,12 @@ <%= { "id" => id, - "youtube_comments_text" => HTML.escape(translate(locale, "View YouTube comments")), + "youtube_comments_text" => HTML.escape(I18n.translate(locale, "View YouTube comments")), "reddit_comments_text" => "", "reddit_permalink_text" => "", - "comments_text" => HTML.escape(translate(locale, "View `x` comments", "{commentCount}")), - "hide_replies_text" => HTML.escape(translate(locale, "Hide replies")), - "show_replies_text" => HTML.escape(translate(locale, "Show replies")), + "comments_text" => HTML.escape(I18n.translate(locale, "View `x` comments", "{commentCount}")), + "hide_replies_text" => HTML.escape(I18n.translate(locale, "Hide replies")), + "show_replies_text" => HTML.escape(I18n.translate(locale, "Show replies")), "params" => { "comments": ["youtube"] }, diff --git a/src/invidious/views/search.ecr b/src/invidious/views/search.ecr index b1300214..2ffe27a1 100644 --- a/src/invidious/views/search.ecr +++ b/src/invidious/views/search.ecr @@ -11,9 +11,9 @@ <%- if items.empty? -%>
- <%= translate(locale, "search_message_no_results") %>

- <%= translate(locale, "search_message_change_filters_or_query") %>

- <%= translate(locale, "search_message_use_another_instance", redirect_url) %> + <%= I18n.translate(locale, "search_message_no_results") %>

+ <%= I18n.translate(locale, "search_message_change_filters_or_query") %>

+ <%= I18n.translate(locale, "search_message_use_another_instance", redirect_url) %>
<%- else -%> diff --git a/src/invidious/views/search_homepage.ecr b/src/invidious/views/search_homepage.ecr index 2424a1cf..911526d1 100644 --- a/src/invidious/views/search_homepage.ecr +++ b/src/invidious/views/search_homepage.ecr @@ -1,7 +1,7 @@ <% content_for "header" do %> -"> +"> - Invidious - <%= translate(locale, "search") %> + Invidious - <%= I18n.translate(locale, "search") %> <% end %> diff --git a/src/invidious/views/template.ecr b/src/invidious/views/template.ecr index 9904b4fc..3b039112 100644 --- a/src/invidious/views/template.ecr +++ b/src/invidious/views/template.ecr @@ -42,7 +42,7 @@ <% else %> <% if CONFIG.login_enabled %> <% end %> @@ -118,38 +118,38 @@ <% if CONFIG.modified_source_code_url %> - <%= translate(locale, "footer_original_source_code") %> / - <%= translate(locale, "footer_modfied_source_code") %> + <%= I18n.translate(locale, "footer_original_source_code") %> / + <%= I18n.translate(locale, "footer_modfied_source_code") %> <% else %> - <%= translate(locale, "footer_source_code") %> + <%= I18n.translate(locale, "footer_source_code") %> <% end %> - <%= translate(locale, "footer_documentation") %> + <%= I18n.translate(locale, "footer_documentation") %>
- <%= translate(locale, "footer_donate_page") %> + <%= I18n.translate(locale, "footer_donate_page") %> - <%= translate(locale, "Current version: ") %> <%= CURRENT_VERSION %>-<%= CURRENT_COMMIT %> @ <%= CURRENT_BRANCH %> + <%= I18n.translate(locale, "Current version: ") %> <%= CURRENT_VERSION %>-<%= CURRENT_COMMIT %> @ <%= CURRENT_BRANCH %>
@@ -163,8 +163,8 @@ diff --git a/src/invidious/views/user/authorize_token.ecr b/src/invidious/views/user/authorize_token.ecr index 725f392e..581fc1d5 100644 --- a/src/invidious/views/user/authorize_token.ecr +++ b/src/invidious/views/user/authorize_token.ecr @@ -1,22 +1,22 @@ <% content_for "header" do %> -<%= translate(locale, "Token") %> - Invidious +<%= I18n.translate(locale, "Token") %> - Invidious <% end %> <% if env.get? "access_token" %> @@ -30,9 +30,9 @@
<% if callback_url %> - <%= translate(locale, "Authorize token for `x`?", "#{callback_url.scheme}://#{callback_url.host}") %> + <%= I18n.translate(locale, "Authorize token for `x`?", "#{callback_url.scheme}://#{callback_url.host}") %> <% else %> - <%= translate(locale, "Authorize token?") %> + <%= I18n.translate(locale, "Authorize token?") %> <% end %>
@@ -48,7 +48,7 @@
diff --git a/src/invidious/views/user/change_password.ecr b/src/invidious/views/user/change_password.ecr index 1b9eb82e..e22891d6 100644 --- a/src/invidious/views/user/change_password.ecr +++ b/src/invidious/views/user/change_password.ecr @@ -1,5 +1,5 @@ <% content_for "header" do %> -<%= translate(locale, "Change password") %> - Invidious +<%= I18n.translate(locale, "Change password") %> - Invidious <% end %>
@@ -7,20 +7,20 @@
- <%= translate(locale, "Change password") %> + <%= I18n.translate(locale, "Change password") %>
- - "> + + "> - - "> + + "> - - "> + + "> diff --git a/src/invidious/views/user/clear_watch_history.ecr b/src/invidious/views/user/clear_watch_history.ecr index c9acbe44..a50b113a 100644 --- a/src/invidious/views/user/clear_watch_history.ecr +++ b/src/invidious/views/user/clear_watch_history.ecr @@ -1,20 +1,20 @@ <% content_for "header" do %> -<%= translate(locale, "Clear watch history") %> - Invidious +<%= I18n.translate(locale, "Clear watch history") %> - Invidious <% end %>
- <%= translate(locale, "Clear watch history?") %> + <%= I18n.translate(locale, "Clear watch history?") %>
diff --git a/src/invidious/views/user/data_control.ecr b/src/invidious/views/user/data_control.ecr index 9ce42c99..367d6ded 100644 --- a/src/invidious/views/user/data_control.ecr +++ b/src/invidious/views/user/data_control.ecr @@ -1,67 +1,67 @@ <% content_for "header" do %> -<%= translate(locale, "Import and Export Data") %> - Invidious +<%= I18n.translate(locale, "Import and Export Data") %> - Invidious <% end %>
- <%= translate(locale, "Import") %> + <%= I18n.translate(locale, "Import") %>
- +
- +
- +
- +
- +
- +
- +
- <%= translate(locale, "Export") %> + <%= I18n.translate(locale, "Export") %>
diff --git a/src/invidious/views/user/delete_account.ecr b/src/invidious/views/user/delete_account.ecr index 67351bbf..dfc852fb 100644 --- a/src/invidious/views/user/delete_account.ecr +++ b/src/invidious/views/user/delete_account.ecr @@ -1,20 +1,20 @@ <% content_for "header" do %> -<%= translate(locale, "Delete account") %> - Invidious +<%= I18n.translate(locale, "Delete account") %> - Invidious <% end %>
- <%= translate(locale, "Delete account?") %> + <%= I18n.translate(locale, "Delete account?") %>
diff --git a/src/invidious/views/user/login.ecr b/src/invidious/views/user/login.ecr index 7ac96bc6..4324133a 100644 --- a/src/invidious/views/user/login.ecr +++ b/src/invidious/views/user/login.ecr @@ -1,5 +1,5 @@ <% content_for "header" do %> -<%= translate(locale, "Log in") %> - Invidious +<%= I18n.translate(locale, "Log in") %> - Invidious <% end %>
@@ -13,15 +13,15 @@ <% if email %> <% else %> - - "> + + "> <% end %> <% if password %> <% else %> - - "> + + "> <% end %> <% if captcha %> @@ -30,15 +30,15 @@ <% captcha[:tokens].each_with_index do |token, i| %> <% end %> - + <% else %> <% end %>
diff --git a/src/invidious/views/user/preferences.ecr b/src/invidious/views/user/preferences.ecr index cf8b5593..0d9c5366 100644 --- a/src/invidious/views/user/preferences.ecr +++ b/src/invidious/views/user/preferences.ecr @@ -1,49 +1,49 @@ <% content_for "header" do %> -<%= translate(locale, "Preferences") %> - Invidious +<%= I18n.translate(locale, "Preferences") %> - Invidious <% end %>
- <%= translate(locale, "preferences_category_player") %> + <%= I18n.translate(locale, "preferences_category_player") %>
- + checked<% end %>>
- + checked<% end %>>
- + checked<% end %>>
- + checked<% end %>>
- + checked<% end %>>
- + checked<% end %> <% if CONFIG.disabled?("local") %>disabled<% end %>>
- + checked<% end %>>
- + <% {"dash", "hd720", "medium", "small"}.each do |option| %> <% if !(option == "dash" && CONFIG.disabled?("dash")) %> - + <% end %> <% end %> @@ -64,108 +64,108 @@ <% if !CONFIG.disabled?("dash") %>
- +
<% end %>
- + <%= preferences.volume %>
- + <% preferences.comments.each_with_index do |comments, index| %> <% end %>
- + <% preferences.captions.each_with_index do |caption, index| %> <% end %>
- + checked<% end %>>
- + checked<% end %>>
- + checked<% end %>>
- + checked<% end %>>
- + checked<% end %>>
- <%= translate(locale, "preferences_category_visual") %> + <%= I18n.translate(locale, "preferences_category_visual") %>
- +
- +
- +
- +
- + checked<% end %>>
@@ -176,187 +176,187 @@ <% end %>
- +
- + <% (feed_options.size - 1).times do |index| %> <% end %>
<% if env.get? "user" %>
- + checked<% end %>>
<% end %> - <%= translate(locale, "preferences_category_misc") %> + <%= I18n.translate(locale, "preferences_category_misc") %>
- + checked<% end %>>
<% if env.get? "user" %> - <%= translate(locale, "preferences_category_subscription") %> + <%= I18n.translate(locale, "preferences_category_subscription") %>
- + checked<% end %>>
- + checked<% end %>>
- +
- +
<% if preferences.unseen_only %> - + <% else %> - + <% end %> checked<% end %>>
- + checked<% end %>>
<% if CONFIG.enable_user_notifications %>
- + checked<% end %>>
<% # Web notifications are only supported over HTTPS %> <% if Kemal.config.ssl || CONFIG.https_only %> <% end %> <% end %> <% end %> <% if env.get?("user") && CONFIG.admins.includes? env.get?("user").as(Invidious::User).email %> - <%= translate(locale, "preferences_category_admin") %> + <%= I18n.translate(locale, "preferences_category_admin") %>
- +
- + <% (feed_options.size - 1).times do |index| %> <% end %>
- + checked<% end %>>
- + checked<% end %>>
- + checked<% end %>>
- + checked<% end %>>
- + checked<% end %>>
- +
<% end %> <% if env.get? "user" %> - <%= translate(locale, "preferences_category_data") %> + <%= I18n.translate(locale, "preferences_category_data") %> <% end %>
- +
diff --git a/src/invidious/views/user/subscription_manager.ecr b/src/invidious/views/user/subscription_manager.ecr index d566e228..4da2e9fb 100644 --- a/src/invidious/views/user/subscription_manager.ecr +++ b/src/invidious/views/user/subscription_manager.ecr @@ -1,26 +1,26 @@ <% content_for "header" do %> -<%= translate(locale, "Subscription manager") %> - Invidious +<%= I18n.translate(locale, "Subscription manager") %> - Invidious <% end %> diff --git a/src/invidious/views/user/token_manager.ecr b/src/invidious/views/user/token_manager.ecr index 8431deb0..85be838a 100644 --- a/src/invidious/views/user/token_manager.ecr +++ b/src/invidious/views/user/token_manager.ecr @@ -1,17 +1,17 @@ <% content_for "header" do %> -<%= translate(locale, "Token manager") %> - Invidious +<%= I18n.translate(locale, "Token manager") %> - Invidious <% end %>

- <%= translate_count(locale, "tokens_count", tokens.size, NumberFormatting::HtmlSpan) %> + <%= I18n.translate_count(locale, "tokens_count", tokens.size, I18n::NumberFormatting::HtmlSpan) %>

@@ -25,13 +25,13 @@
-

<%= translate(locale, "`x` ago", recode_date(token[:issued], locale)) %>

+

<%= I18n.translate(locale, "`x` ago", recode_date(token[:issued], locale)) %>

" method="post"> "> - "> + ">

diff --git a/src/invidious/views/watch.ecr b/src/invidious/views/watch.ecr index 6f9ced6f..f302ff66 100644 --- a/src/invidious/views/watch.ecr +++ b/src/invidious/views/watch.ecr @@ -35,11 +35,11 @@ we're going to need to do it here in order to allow for translations. --> <% end %> @@ -53,12 +53,12 @@ we're going to need to do it here in order to allow for translations. "length_seconds" => video.length_seconds.to_f, "play_next" => !video.related_videos.empty? && !plid && params.continue, "next_video" => video.related_videos.select { |rv| rv["id"]? }[0]?.try &.["id"], - "youtube_comments_text" => HTML.escape(translate(locale, "View YouTube comments")), - "reddit_comments_text" => HTML.escape(translate(locale, "View Reddit comments")), - "reddit_permalink_text" => HTML.escape(translate(locale, "View more comments on Reddit")), - "comments_text" => HTML.escape(translate(locale, "View `x` comments", "{commentCount}")), - "hide_replies_text" => HTML.escape(translate(locale, "Hide replies")), - "show_replies_text" => HTML.escape(translate(locale, "Show replies")), + "youtube_comments_text" => HTML.escape(I18n.translate(locale, "View YouTube comments")), + "reddit_comments_text" => HTML.escape(I18n.translate(locale, "View Reddit comments")), + "reddit_permalink_text" => HTML.escape(I18n.translate(locale, "View more comments on Reddit")), + "comments_text" => HTML.escape(I18n.translate(locale, "View `x` comments", "{commentCount}")), + "hide_replies_text" => HTML.escape(I18n.translate(locale, "Hide replies")), + "show_replies_text" => HTML.escape(I18n.translate(locale, "Show replies")), "params" => params, "preferences" => preferences, "premiere_timestamp" => video.premiere_timestamp.try &.to_unix, @@ -78,11 +78,11 @@ we're going to need to do it here in order to allow for translations.

<%= title %> <% if params.listen %> - " href="/watch?<%= env.params.query %>&listen=0"> + " href="/watch?<%= env.params.query %>&listen=0"> <% else %> - " href="/watch?<%= env.params.query %>&listen=1"> + " href="/watch?<%= env.params.query %>&listen=1"> <% end %> @@ -90,7 +90,7 @@ we're going to need to do it here in order to allow for translations. <% if !video.is_listed %>

- <%= translate(locale, "Unlisted") %> + <%= I18n.translate(locale, "Unlisted") %>

<% end %> @@ -100,11 +100,11 @@ we're going to need to do it here in order to allow for translations. <% elsif video.premiere_timestamp.try &.> Time.utc %>

- <%= video.premiere_timestamp.try { |t| translate(locale, "Premieres in `x`", recode_date((t - Time.utc).ago, locale)) } %> + <%= video.premiere_timestamp.try { |t| I18n.translate(locale, "Premieres in `x`", recode_date((t - Time.utc).ago, locale)) } %>

<% elsif video.live_now %>

- <%= video.premiere_timestamp.try { |t| translate(locale, "videoinfo_started_streaming_x_ago", recode_date((Time.utc - t).ago, locale)) } %> + <%= video.premiere_timestamp.try { |t| I18n.translate(locale, "videoinfo_started_streaming_x_ago", recode_date((Time.utc - t).ago, locale)) } %>

<% end %>
@@ -123,13 +123,13 @@ we're going to need to do it here in order to allow for translations. link_yt_embed = IV::HttpServer::Utils.add_params_to_url(link_yt_embed, link_yt_param) end -%> - <%= translate(locale, "videoinfo_watch_on_youTube") %> - (<%= translate(locale, "videoinfo_youTube_embed_link") %>) + <%= I18n.translate(locale, "videoinfo_watch_on_youTube") %> + (<%= I18n.translate(locale, "videoinfo_youTube_embed_link") %>)

<%- link_iv_other = IV::Frontend::Misc.redirect_url(env) -%> - <%= translate(locale, "Switch Invidious Instance") %> + <%= I18n.translate(locale, "Switch Invidious Instance") %>

<% if params.annotations %> - <%= translate(locale, "Hide annotations") %> + <%= I18n.translate(locale, "Hide annotations") %> <% else %> - <%=translate(locale, "Show annotations")%> + <%=I18n.translate(locale, "Show annotations")%> <% end %>

@@ -160,7 +160,7 @@ we're going to need to do it here in order to allow for translations. <% if !playlists.empty? %>
- + ">