Skip to content

Commit 0f14173

Browse files
committed
Check for default locale in application.rb
1 parent 0ec48b0 commit 0f14173

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

autoload/rails.vim

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -799,8 +799,11 @@ endfunction
799799

800800
function! s:app_default_locale() dict abort
801801
if self.cache.needs('default_locale')
802-
let candidates = map(filter(s:readfile(self.path('config/environment.rb')),'v:val =~ "^ *config.i18n.default_locale = :[\"'']\\=[A-Za-z-]\\+[\"'']\\= *$"'),'matchstr(v:val,"[A-Za-z-]\\+[\"'']\\= *$")')
803-
call self.cache.set('default_locale',get(candidates,0,'en'))
802+
let candidates = map(filter(
803+
\ s:readfile(self.path('config/application.rb')) + s:readfile(self.path('config/environment.rb')),
804+
\ 'v:val =~ "^ *config.i18n.default_locale = :[\"'']\\=[A-Za-z-]\\+[\"'']\\= *$"'
805+
\ ), 'matchstr(v:val,"[A-Za-z-]\\+[\"'']\\= *$")')
806+
call self.cache.set('default_locale', get(candidates, 0, 'en'))
804807
endif
805808
return self.cache.get('default_locale')
806809
endfunction
@@ -4507,7 +4510,7 @@ augroup railsPluginAuto
45074510
autocmd BufWritePost */config/editor.json call rails#cache_clear("config")
45084511
autocmd BufWritePost */test/test_helper.rb call rails#cache_clear("user_assertions")
45094512
autocmd BufWritePost */config/routes.rb call rails#cache_clear("named_routes")
4510-
autocmd BufWritePost */config/environment.rb call rails#cache_clear("default_locale")
4513+
autocmd BufWritePost */config/application.rb call rails#cache_clear("default_locale")
45114514
autocmd BufWritePost */config/environments/*.rb call rails#cache_clear("environments")
45124515
autocmd BufWritePost */tasks/**.rake call rails#cache_clear("rake_tasks")
45134516
autocmd BufWritePost */generators/** call rails#cache_clear("generators")

0 commit comments

Comments
 (0)