File: missing_translation_logger.rb

package info (click to toggle)
ruby-fast-gettext 4.1.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 676 kB
  • sloc: ruby: 3,209; makefile: 4
file content (16 lines) | stat: -rw-r--r-- 353 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# frozen_string_literal: true

class MissingTranslationLogger
  def call(unfound)
    logger.warn "#{FastGettext.locale}: #{unfound}" unless FastGettext.locale == 'en'
  end

  private

  def logger
    return @logger if @logger

    require 'logger'
    @logger = Logger.new("log/unfound_translations", 2, 5 * (1024**2)) # max 2x 5mb logfile
  end
end