diff --git a/apps/explorer_web/lib/explorer_web/templates/block/index.html.eex b/apps/explorer_web/lib/explorer_web/templates/block/index.html.eex index fcfde89d25..840b5f1da0 100644 --- a/apps/explorer_web/lib/explorer_web/templates/block/index.html.eex +++ b/apps/explorer_web/lib/explorer_web/templates/block/index.html.eex @@ -26,7 +26,7 @@
- <%= gettext("%{count} transactions", count: block.transactions |> Enum.count) %> + <%= ngettext("%{count} transaction", "%{count} transactions", Enum.count(block.transactions)) %> <%= Cldr.Unit.new(:byte, block.size) |> Cldr.Unit.to_string! %> @@ -46,8 +46,8 @@
- <%= block.gas_used |> Cldr.Number.to_string! %> - (<%= (block.gas_used / block.gas_limit) |> Cldr.Number.to_string!(format: "#.#%") %>) + <%= formatted_gas_used(block.gas_used) %> + (<%= formatted_gas_used(block.gas_used / block.gas_limit, format: "#.#%") %>) <%= gettext "Gas Used" %>
diff --git a/apps/explorer_web/lib/explorer_web/views/block_view.ex b/apps/explorer_web/lib/explorer_web/views/block_view.ex index 73d0bfc47a..8fa7cd9160 100644 --- a/apps/explorer_web/lib/explorer_web/views/block_view.ex +++ b/apps/explorer_web/lib/explorer_web/views/block_view.ex @@ -20,6 +20,10 @@ defmodule ExplorerWeb.BlockView do "#{average} #{unit_text}" end + def formatted_gas_used(gas, format \\ []) do + Cldr.Number.to_string!(gas, format) + end + def formatted_timestamp(%Block{timestamp: timestamp}) do Timex.format!(timestamp, "%b-%d-%Y %H:%M:%S %p %Z", :strftime) end