Exception: I18n::InvalidFilenames

Inherits:
ArgumentError show all
Defined in:
lib/i18n/exceptions.rb

Constant Summary collapse

NUMBER_OF_ERRORS_SHOWN =
20

Instance Method Summary collapse

Constructor Details

#initialize(file_errors) ⇒ InvalidFilenames

Returns a new instance of InvalidFilenames.



136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'lib/i18n/exceptions.rb', line 136

def initialize(file_errors)
  super <<~MSG
    Found #{file_errors.count} error(s).
    The first #{[file_errors.count, NUMBER_OF_ERRORS_SHOWN].min} error(s):
    #{file_errors.map(&:message).first(NUMBER_OF_ERRORS_SHOWN).join("\n")}

    To use the LazyLoadable backend:
    1. Filenames must start with the locale.
    2. An underscore must separate the locale with any optional text that follows.
    3. The file must only contain translation data for the single locale.

    Example:
    "/config/locales/fr.yml" which contains:
    ```yml
      fr:
        dog:
          chien
    ```
  MSG
end