Class: RailsAiBridge::Doctor::Checkers::I18nChecker

Inherits:
BaseChecker
  • Object
show all
Defined in:
lib/rails_ai_bridge/doctor/checkers/i18n_checker.rb

Overview

Verifies +config/locales+ contains YAML locale files.

Instance Attribute Summary

Attributes inherited from BaseChecker

#app

Instance Method Summary collapse

Methods inherited from BaseChecker

#initialize

Constructor Details

This class inherits a constructor from RailsAiBridge::Doctor::Checkers::BaseChecker

Instance Method Details

#callDoctor::Check

Returns +:pass+ when locale files exist; +:warn+ otherwise.

Returns:

  • (Doctor::Check)

    +:pass+ when locale files exist; +:warn+ otherwise



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/rails_ai_bridge/doctor/checkers/i18n_checker.rb', line 9

def call
  locales_path = File.join(app.root, 'config/locales', '**/*.{yml,yaml}')
  locales = Dir.glob(locales_path)

  check(
    'I18n',
    locales.any?,
    pass: { message: "#{locales.size} locale files found" },
    fail: { status: :warn, message: 'No locale files found in config/locales/',
            fix: 'Add locale files for internationalization support' }
  )
end