require "uri" module Invidious::Frontend::Pagination extend self private def first_page(str : String::Builder, locale : String?, url : String) str << %() if locale_is_rtl?(locale) # Inverted arrow ("first" points to the right) str << translate(locale, "First page") str << " " str << %() else # Regular arrow ("first" points to the left) str << %() str << " " str << translate(locale, "First page") end str << "" end private def previous_page(str : String::Builder, locale : String?, url : String) # Link str << %() if locale_is_rtl?(locale) # Inverted arrow ("previous" points to the right) str << translate(locale, "Previous page") str << " " str << %() else # Regular arrow ("previous" points to the left) str << %() str << " " str << translate(locale, "Previous page") end str << "" end private def next_page(str : String::Builder, locale : String?, url : String) # Link str << %() if locale_is_rtl?(locale) # Inverted arrow ("next" points to the left) str << %() str << " " str << translate(locale, "Next page") else # Regular arrow ("next" points to the right) str << translate(locale, "Next page") str << " " str << %() end str << "" end def nav_numeric(locale : String?, *, base_url : String | URI, current_page : Int, show_next : Bool = true) return String.build do |str| str << %(