diff --git a/.github/workflows/build-nightly-container.yml b/.github/workflows/build-nightly-container.yml index 44be0baee..00094e5b4 100644 --- a/.github/workflows/build-nightly-container.yml +++ b/.github/workflows/build-nightly-container.yml @@ -29,7 +29,7 @@ jobs: - os: ubuntu-24.04-arm platform: linux/arm64/v8 name: "ARM64" - dockerfile: "docker/Dockerfile.arm64" + dockerfile: "docker/Dockerfile" tag_suffix: "-arm64" runs-on: ${{ matrix.os }} @@ -39,10 +39,10 @@ jobs: uses: actions/checkout@v6 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 + uses: docker/setup-buildx-action@v4 - name: Login to registry - uses: docker/login-action@v3 + uses: docker/login-action@v4 with: registry: quay.io username: ${{ secrets.QUAY_USERNAME }} @@ -50,7 +50,7 @@ jobs: - name: Docker meta id: meta - uses: docker/metadata-action@v5 + uses: docker/metadata-action@v6 with: images: quay.io/invidious/invidious flavor: | @@ -62,13 +62,34 @@ jobs: quay.expires-after=12w - name: Build and push Docker ${{ matrix.name }} image for Push Event - uses: docker/build-push-action@v6 + uses: docker/build-push-action@v7 with: context: . - file: ${{ matrix.dockerfile }} + file: ${{ matrix.dockerfile }} platforms: ${{ matrix.platform }} labels: ${{ steps.meta.outputs.labels }} push: true tags: ${{ steps.meta.outputs.tags }} build-args: | "release=1" + + combine-multiarch-images: + needs: release + runs-on: ubuntu-latest + steps: + - name: Login to registry + uses: docker/login-action@v4 + with: + registry: quay.io + username: ${{ secrets.QUAY_USERNAME }} + password: ${{ secrets.QUAY_PASSWORD }} + + # https://github.com/marketplace/actions/docker-manifest-create-action + - name: Create and push manifest + uses: int128/docker-manifest-create-action@v2.20.0 + with: + push: true + tags: quay.io/invidious/invidious:master + sources: | + quay.io/invidious/invidious:master + quay.io/invidious/invidious:master-arm64 diff --git a/.github/workflows/build-stable-container.yml b/.github/workflows/build-stable-container.yml index e119880d5..4297c1963 100644 --- a/.github/workflows/build-stable-container.yml +++ b/.github/workflows/build-stable-container.yml @@ -20,7 +20,7 @@ jobs: - os: ubuntu-24.04-arm platform: linux/arm64/v8 name: "ARM64" - dockerfile: "docker/Dockerfile.arm64" + dockerfile: "docker/Dockerfile" tag_suffix: "-arm64" runs-on: ${{ matrix.os }} @@ -30,10 +30,10 @@ jobs: uses: actions/checkout@v6 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 + uses: docker/setup-buildx-action@v4 - name: Login to registry - uses: docker/login-action@v3 + uses: docker/login-action@v4 with: registry: quay.io username: ${{ secrets.QUAY_USERNAME }} @@ -41,7 +41,7 @@ jobs: - name: Docker meta id: meta - uses: docker/metadata-action@v5 + uses: docker/metadata-action@v6 with: images: quay.io/invidious/invidious flavor: | @@ -54,13 +54,34 @@ jobs: quay.expires-after=12w - name: Build and push Docker ${{ matrix.name }} image for Push Event - uses: docker/build-push-action@v6 + uses: docker/build-push-action@v7 with: context: . - file: ${{ matrix.dockerfile }} + file: ${{ matrix.dockerfile }} platforms: ${{ matrix.platform }} labels: ${{ steps.meta.outputs.labels }} push: true tags: ${{ steps.meta.outputs.tags }} build-args: | "release=1" + + combine-multiarch-images: + needs: release + runs-on: ubuntu-latest + steps: + - name: Login to registry + uses: docker/login-action@v4 + with: + registry: quay.io + username: ${{ secrets.QUAY_USERNAME }} + password: ${{ secrets.QUAY_PASSWORD }} + + # https://github.com/marketplace/actions/docker-manifest-create-action + - name: Create and push manifest + uses: int128/docker-manifest-create-action@v2.20.0 + with: + push: true + tags: quay.io/invidious/invidious:latest + sources: | + quay.io/invidious/invidious:latest + quay.io/invidious/invidious:latest-arm64 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 847342f77..ee5b457c9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,6 +43,8 @@ jobs: - 1.16.3 - 1.17.1 - 1.18.2 + - 1.19.2 + - 1.20.1 include: - crystal: nightly stable: false @@ -58,7 +60,7 @@ jobs: shell: bash - name: Install Crystal - uses: crystal-lang/install-crystal@v1.9.1 + uses: crystal-lang/install-crystal@v1.9.2 with: crystal: ${{ matrix.crystal }} @@ -80,7 +82,7 @@ jobs: run: crystal spec - name: Build - run: crystal build --warnings all --error-on-warnings --error-trace src/invidious.cr + run: crystal build --warnings all --error-on-warnings --stats --time --progress --error-trace src/invidious.cr build-docker: strategy: @@ -98,10 +100,6 @@ jobs: steps: - uses: actions/checkout@v6 - - name: Use ARM64 Dockerfile if ARM64 - if: ${{ matrix.name == 'ARM64' }} - run: sed -i 's/Dockerfile/Dockerfile.arm64/' docker-compose.yml - - name: Build Docker run: docker compose build @@ -134,7 +132,7 @@ jobs: - name: Install Crystal id: lint_step_install_crystal - uses: crystal-lang/install-crystal@v1.9.1 + uses: crystal-lang/install-crystal@v1.9.2 with: crystal: latest diff --git a/assets/js/player.js b/assets/js/player.js index e9e9038d5..455b557c2 100644 --- a/assets/js/player.js +++ b/assets/js/player.js @@ -104,14 +104,15 @@ if (video_data.params.quality === 'dash') { * * @param {String} url * @param {String} [base] + * @param {'t' | 'start'} param * @returns {URL} urlWithTimeArg */ -function addCurrentTimeToURL(url, base) { +function addCurrentTimeToURL(url, base, param = 't') { var urlUsed = new URL(url, base); urlUsed.searchParams.delete('start'); var currentTime = Math.ceil(player.currentTime()); if (currentTime > 0) - urlUsed.searchParams.set('t', currentTime); + urlUsed.searchParams.set(param, currentTime); else if (urlUsed.searchParams.has('t')) urlUsed.searchParams.delete('t'); return urlUsed; @@ -147,7 +148,7 @@ player.on('timeupdate', function () { let elem_yt_embed = document.getElementById('link-yt-embed'); if (elem_yt_embed) { let base_url_yt_embed = elem_yt_embed.getAttribute('data-base-url'); - elem_yt_embed.href = addCurrentTimeToURL(base_url_yt_embed); + elem_yt_embed.href = addCurrentTimeToURL(base_url_yt_embed, undefined, 'start'); } } diff --git a/docker/Dockerfile b/docker/Dockerfile index e2d303648..820005ba7 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -2,7 +2,7 @@ ARG OPENSSL_VERSION='3.5.2' ARG OPENSSL_SHA256='c53a47e5e441c930c3928cf7bf6fb00e5d129b630e0aa873b08258656e7345ec' -FROM crystallang/crystal:1.16.3-alpine AS dependabot-crystal +FROM crystallang/crystal:1.20.1-alpine AS dependabot-crystal # We compile openssl ourselves due to a memory leak in how crystal interacts # with openssl @@ -43,7 +43,7 @@ COPY ./assets/ ./assets/ COPY ./videojs-dependencies.yml ./videojs-dependencies.yml RUN crystal spec --warnings all \ - --link-flags "-lxml2 -llzma" + --link-flags "-lxml2 -llzma" ARG OPENSSL_VERSION COPY --from=openssl-builder /openssl-${OPENSSL_VERSION} /openssl-${OPENSSL_VERSION} diff --git a/docker/Dockerfile.arm64 b/docker/Dockerfile.arm64 deleted file mode 100644 index ce691c915..000000000 --- a/docker/Dockerfile.arm64 +++ /dev/null @@ -1,83 +0,0 @@ -# https://github.com/openssl/openssl/releases/tag/openssl-3.5.2 -ARG OPENSSL_VERSION='3.5.2' -ARG OPENSSL_SHA256='c53a47e5e441c930c3928cf7bf6fb00e5d129b630e0aa873b08258656e7345ec' - -FROM alpine:3.22 AS dependabot-alpine - -# We compile openssl ourselves due to a memory leak in how crystal interacts -# with openssl -# Reference: https://github.com/iv-org/invidious/issues/1438#issuecomment-3087636228 -FROM dependabot-alpine AS openssl-builder -RUN apk add --no-cache curl perl linux-headers build-base - -WORKDIR / - -ARG OPENSSL_VERSION -ARG OPENSSL_SHA256 -RUN curl -Ls "https://github.com/openssl/openssl/releases/download/openssl-${OPENSSL_VERSION}/openssl-${OPENSSL_VERSION}.tar.gz" --output openssl-${OPENSSL_VERSION}.tar.gz -RUN echo "${OPENSSL_SHA256} openssl-${OPENSSL_VERSION}.tar.gz" | sha256sum -c -RUN tar -xzvf openssl-${OPENSSL_VERSION}.tar.gz - -RUN cd openssl-${OPENSSL_VERSION} && ./Configure --openssldir=/etc/ssl && make -j$(nproc) - -FROM dependabot-alpine AS builder -RUN apk add --no-cache 'crystal=1.16.3-r0' shards \ - sqlite-static yaml-static yaml-dev \ - pcre2-static gc-static \ - libxml2-static zlib-static \ - openssl-libs-static openssl-dev musl-dev xz-static - -ARG release - -WORKDIR /invidious -COPY ./shard.yml ./shard.yml -COPY ./shard.lock ./shard.lock -RUN shards install --production - -COPY ./src/ ./src/ -# TODO: .git folder is required for building – this is destructive. -# See definition of CURRENT_BRANCH, CURRENT_COMMIT and CURRENT_VERSION. -COPY ./.git/ ./.git/ - -# Required for fetching player dependencies -COPY ./scripts/ ./scripts/ -COPY ./assets/ ./assets/ -COPY ./videojs-dependencies.yml ./videojs-dependencies.yml - -RUN crystal spec --warnings all \ - --link-flags "-lxml2 -llzma" - -ARG OPENSSL_VERSION -COPY --from=openssl-builder /openssl-${OPENSSL_VERSION} /openssl-${OPENSSL_VERSION} - -RUN --mount=type=cache,target=/root/.cache/crystal if [[ "${release}" == 1 ]] ; then \ - PKG_CONFIG_PATH=/openssl-${OPENSSL_VERSION} \ - crystal build ./src/invidious.cr \ - --release \ - --static --warnings all \ - --link-flags "-lxml2 -llzma"; \ - else \ - PKG_CONFIG_PATH=/openssl-${OPENSSL_VERSION} \ - crystal build ./src/invidious.cr \ - --static --warnings all \ - --link-flags "-lxml2 -llzma"; \ - fi - -FROM alpine:3.22 -RUN apk add --no-cache rsvg-convert ttf-opensans tini tzdata -WORKDIR /invidious -RUN addgroup -g 1000 -S invidious && \ - adduser -u 1000 -S invidious -G invidious -COPY --chown=invidious ./config/config.* ./config/ -RUN mv -n config/config.example.yml config/config.yml -RUN sed -i 's/host: \(127.0.0.1\|localhost\)/host: invidious-db/' config/config.yml -COPY ./config/sql/ ./config/sql/ -COPY ./locales/ ./locales/ -COPY --from=builder /invidious/assets ./assets/ -COPY --from=builder /invidious/invidious . -RUN chmod o+rX -R ./assets ./config ./locales - -EXPOSE 3000 -USER invidious -ENTRYPOINT ["/sbin/tini", "--"] -CMD [ "/invidious/invidious" ] diff --git a/scripts/generate_js_licenses.cr b/scripts/generate_js_licenses.cr index 1f4ffa624..7df70bf2a 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/src/invidious/channels/channels.cr b/src/invidious/channels/channels.cr index 659823255..64f0484df 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 diff --git a/src/invidious/channels/community.cr b/src/invidious/channels/community.cr index 4256230cb..34a214265 100644 --- a/src/invidious/channels/community.cr +++ b/src/invidious/channels/community.cr @@ -127,11 +127,11 @@ def extract_channel_community(items, *, ucid, locale, format, thin_mode, is_sing reply_count = short_text_to_number(post.dig?("actionButtons", "commentActionButtonsRenderer", "replyButton", "buttonRenderer", "text", "simpleText").try &.as_s || "0") - json.field "content", html_to_content(content_html) + json.field "content", Helpers.html_to_content(content_html) 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 diff --git a/src/invidious/comments/youtube.cr b/src/invidious/comments/youtube.cr index e923b2f8d..78a569ab0 100644 --- a/src/invidious/comments/youtube.cr +++ b/src/invidious/comments/youtube.cr @@ -254,7 +254,7 @@ module Invidious::Comments end content_html = html_content || "" - json.field "content", html_to_content(content_html) + json.field "content", Helpers.html_to_content(content_html) json.field "contentHtml", content_html if published_text != nil @@ -268,7 +268,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/frontend/channel_page.cr b/src/invidious/frontend/channel_page.cr index 4fe21b964..4af3b4f54 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 4dda683ef..74d9d8d81 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 a0e1d783d..89d3caeff 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 642ab4cc6..2f640e8cf 100644 --- a/src/invidious/frontend/watch_page.cr +++ b/src/invidious/frontend/watch_page.cr @@ -20,11 +20,11 @@ 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 if CONFIG.dmca_content.includes?(video.id) - return "

#{translate(locale, "dmca_content")}

" + return "

#{I18n.translate(locale, "dmca_content")}

" end url = "/download" @@ -49,7 +49,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 132e636ce..a0fc47f57 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 97a2d7da2..9395000a4 100644 --- a/src/invidious/views/components/channel_info.ecr +++ b/src/invidious/views/components/channel_info.ecr @@ -27,7 +27,7 @@
-  <%= translate(locale, "generic_button_rss") %> +  <%= I18n.translate(locale, "generic_button_rss") %>
@@ -40,10 +40,10 @@
<%= Invidious::Frontend::ChannelPage.generate_tabs_links(locale, channel, selected_tab) %> @@ -53,9 +53,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 b8e60e3a2..d3ab72286 100644 --- a/src/invidious/views/components/feed_menu.ecr +++ b/src/invidious/views/components/feed_menu.ecr @@ -17,7 +17,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 a24423df9..ece2efe8a 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 f69df3fe0..bb630d621 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 3fb31628a..dc2a7d13d 100644 --- a/src/invidious/views/components/search_box.ecr +++ b/src/invidious/views/components/search_box.ecr @@ -3,11 +3,11 @@ <% search_placeholder = CONFIG.page_enabled?("search") ? translate(locale, "search") : translate(locale, "search_subscriptions_placeholder") %> autofocus<% end %> - name="q" placeholder="<%= search_placeholder %>" - title="<%= search_placeholder %>" + 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 3cfcb0ebd..742e9a82a 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 22458a030..103e7cda9 100644 --- a/src/invidious/views/components/video-context-buttons.ecr +++ b/src/invidious/views/components/video-context-buttons.ecr @@ -1,21 +1,21 @@
-
\ No newline at end of file +
diff --git a/src/invidious/views/create_playlist.ecr b/src/invidious/views/create_playlist.ecr index 807244e6d..feff65221 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 cd66b9630..6e296153e 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 34157c675..123a5d443 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 13fe41479..cfa5c7e19 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 2a4b6edda..baf64e974 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 5fbe539c9..4177e53d6 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 c36bd00fd..57e205260 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 46d02ad4f..8cf3d1c66 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 @@ <% {"Livestreams", "Gaming"}.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 3037f3d7a..0776b0d7d 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 8c7bf6113..789846faa 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 c27ddba60..e41662c8f 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 f644d634c..c6ce57973 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"] }, @@ -45,4 +45,4 @@ %> - \ No newline at end of file + diff --git a/src/invidious/views/search.ecr b/src/invidious/views/search.ecr index 0848bfef6..1185cb0ea 100644 --- a/src/invidious/views/search.ecr +++ b/src/invidious/views/search.ecr @@ -20,14 +20,9 @@ <%- if items.empty? -%>
- <% if subscription_only %> - <%= translate(locale, "search_subscriptions_no_results") %>

- <%= translate(locale, "search_subscriptions_no_results_hint") %> - <% else %> - <%= translate(locale, "search_message_no_results") %>

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

- <%= translate(locale, "search_message_use_another_instance", redirect_url) %> - <% end %> + <%= 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 2feff931e..387998c89 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 40f5544fe..82d15958e 100644 --- a/src/invidious/views/template.ecr +++ b/src/invidious/views/template.ecr @@ -43,7 +43,7 @@ <% else %> <% if CONFIG.login_enabled %> <% end %> @@ -119,39 +119,39 @@ <% 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: ") %> + <%= I18n.translate(locale, "Current version: ") %> <% if CONFIG.modified_source_code_url %> <%= CURRENT_VERSION %>-<%= CURRENT_COMMIT %> <% else %> @@ -181,8 +181,8 @@ diff --git a/src/invidious/views/user/authorize_token.ecr b/src/invidious/views/user/authorize_token.ecr index 725f392ed..581fc1d56 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 1b9eb82e1..e22891d69 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 c9acbe448..a50b113a2 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 e57926f50..1ada97122 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 67351bbf4..dfc852fb6 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 7ac96bc6f..4324133ae 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 80011e65e..854836eaa 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,74 +64,74 @@ <% 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 %>>
<% if user = env.get?("user").try &.as(User) %> <% playlists = Invidious::Database::Playlists.select_user_created_playlists(user.email) %>
- + - <% LOCALES_LIST.each do |iso_name, full_name| %> + <% I18n::LOCALES_LIST.each do |iso_name, full_name| %> <% end %>
- +
- +
- +
- + checked<% end %>>
@@ -198,125 +198,120 @@ %>
- +
- + <% (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 %>>
@@ -325,69 +320,69 @@
- + 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 d566e2285..4da2e9fbb 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 8431deb04..85be838ac 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 7cf6c51cb..a6a461aec 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, @@ -79,11 +79,11 @@ we're going to need to do it here in order to allow for translations.

<%= title %> <% if params.listen %> - " id="link-iv-listen" data-base-url="/watch?<%= env.params.query %>&listen=0" href="/watch?<%= env.params.query %>&listen=0"> + " id="link-iv-listen" data-base-url="/watch?<%= env.params.query %>&listen=0" href="/watch?<%= env.params.query %>&listen=0"> <% else %> - " id="link-iv-listen" data-base-url="/watch?<%= env.params.query %>&listen=1" href="/watch?<%= env.params.query %>&listen=1"> + " id="link-iv-listen" data-base-url="/watch?<%= env.params.query %>&listen=1" href="/watch?<%= env.params.query %>&listen=1"> <% end %> @@ -91,7 +91,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 %> @@ -101,11 +101,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 %>
@@ -124,13 +124,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 %>

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