GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Yield loaded translations to block in #load_translations · ruby-i18n/i18n@eb9dbf4

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib/i18n/backend
    • base.rb
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/i18n/backend/base.rb‎

Copy file name to clipboardExpand all lines: lib/i18n/backend/base.rb
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ module Base
1313
# for details.
1414
def load_translations(*filenames)
1515
filenames = I18n.load_path if filenames.empty?
16-
filenames.flatten.each { |filename| load_file(filename) }
16+
filenames.flatten.each do |filename|
17+
loaded_translations = load_file(filename)
18+
yield filename, loaded_translations if block_given?
19+
end
1720
end
1821

1922
# This method receives a locale, a data hash and options for storing translations.
@@ -226,6 +229,8 @@ def load_file(filename)
226229
raise InvalidLocaleData.new(filename, 'expects it to return a hash, but does not')
227230
end
228231
data.each { |locale, d| store_translations(locale, d || {}, skip_symbolize_keys: keys_symbolized) }
232+
233+
data
229234
end
230235

231236
# Loads a plain Ruby translations file. eval'ing the file must yield

0 commit comments

Comments
0 (0)
You are visitor 01402605 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.