]> source.dussan.org Git - redmine.git/commitdiff
Turns @@languages_lookup into a cache by using ||= (#25014).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Thu, 2 Mar 2017 19:42:18 +0000 (19:42 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Thu, 2 Mar 2017 19:42:18 +0000 (19:42 +0000)
Patch by Jens Kraemer.

git-svn-id: http://svn.redmine.org/redmine/trunk@16349 e93f8b46-1217-0410-a6f0-8f06a7374b81

lib/redmine/i18n.rb

index dfeaf474e44ed3187b65d5ad6d731a71f36529a6..44bad4d06fa369c7cb58a9a64a9a5cbcf3193b71 100644 (file)
@@ -130,7 +130,7 @@ module Redmine
     end
 
     def find_language(lang)
-      @@languages_lookup = valid_languages.inject({}) {|k, v| k[v.to_s.downcase] = v; k }
+      @@languages_lookup ||= valid_languages.inject({}) {|k, v| k[v.to_s.downcase] = v; k }
       @@languages_lookup[lang.to_s.downcase]
     end