Sha256: 04ea302366ee5657c633d7abf8902b7bf50eae8075c15dd7813791b2c96d3920
Contents?: true
Size: 797 Bytes
Versions: 12
Compression:
Stored size: 797 Bytes
Contents
# See the Pagy documentation: https://ddnexus.github.io/pagy/docs/extras/i18n # frozen_string_literal: true class Pagy # :nodoc: # Use ::I18n gem module I18nExtra # Frontend overriding for translation module FrontendOverride def pagy_t(key, **opts) ::I18n.t(key, **opts) end end Frontend.prepend I18nExtra::FrontendOverride # Calendar overriding for localization (see also the block in the calendar section of the config/pagy.rb initializer) module CalendarOverride def localize(time, opts) ::I18n.l(time, **opts) end end end Calendar::Unit.prepend I18nExtra::CalendarOverride if defined?(Calendar::Unit) # Add the pagy locales to the I18n.load_path ::I18n.load_path += Dir[Pagy.root.join('locales', '*.yml')] end
Version data entries
12 entries across 12 versions & 1 rubygems