mirror of
https://github.com/discourse/discourse.git
synced 2025-06-03 02:48:28 +08:00
DEV: Prefer \A and \z over ^ and $ in regexes (#19936)
This commit is contained in:

committed by
GitHub

parent
f7907a3645
commit
666536cbd1
@ -39,7 +39,7 @@ module I18n
|
||||
|
||||
if @loaded_locales.empty?
|
||||
# load all rb files
|
||||
I18n.backend.load_translations(I18n.load_path.grep(/\.rb$/))
|
||||
I18n.backend.load_translations(I18n.load_path.grep(/\.rb\z/))
|
||||
|
||||
# load plural rules from plugins
|
||||
DiscoursePluginRegistry.locales.each do |plugin_locale, options|
|
||||
@ -50,14 +50,14 @@ module I18n
|
||||
end
|
||||
|
||||
# load it
|
||||
I18n.backend.load_translations(I18n.load_path.grep(/\.#{Regexp.escape locale}\.yml$/))
|
||||
I18n.backend.load_translations(I18n.load_path.grep(/\.#{Regexp.escape locale}\.yml\z/))
|
||||
|
||||
if Discourse.allow_dev_populate?
|
||||
I18n.backend.load_translations(
|
||||
I18n.load_path.grep(%r{.*faker.*/#{Regexp.escape locale}\.yml$}),
|
||||
I18n.load_path.grep(%r{.*faker.*/#{Regexp.escape locale}\.yml\z}),
|
||||
)
|
||||
I18n.backend.load_translations(
|
||||
I18n.load_path.grep(%r{.*faker.*/#{Regexp.escape locale}/.*\.yml$}),
|
||||
I18n.load_path.grep(%r{.*faker.*/#{Regexp.escape locale}/.*\.yml\z}),
|
||||
)
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user