- def locale_dict_for(locale_in)
- locale = locale_in.to_s.tr("-", "_")
- full_local_path = File.expand_path("node_modules/osm-community-index/i18n/#{locale}.yaml", Dir.pwd)
- locale_dict = {}
- if File.exist?(full_local_path)
- locale_dict = YAML.safe_load(File.read(full_local_path))[locale]
- else
- shortened_locale = locale.split("_").first
- if shortened_locale != locale
- shortened_local_path = File.expand_path("node_modules/osm-community-index/i18n/#{shortened_locale}.yaml", Dir.pwd)
- locale_dict = YAML.safe_load(File.read(shortened_local_path))[shortened_locale] if File.exist?(shortened_local_path)
- end
+ def self.locale_dict_for(locale_in)
+ locale = locale_in.to_s.tr("-", "_")
+ full_local_path = File.expand_path("node_modules/osm-community-index/i18n/#{locale}.yaml", Dir.pwd)
+ locale_dict = {}
+ if File.exist?(full_local_path)
+ locale_dict = YAML.safe_load(File.read(full_local_path))[locale]
+ else
+ shortened_locale = locale.split("_").first
+ if shortened_locale != locale
+ shortened_local_path = File.expand_path("node_modules/osm-community-index/i18n/#{shortened_locale}.yaml", Dir.pwd)
+ locale_dict = YAML.safe_load(File.read(shortened_local_path))[shortened_locale] if File.exist?(shortened_local_path)