Fix: only call store_translations once per locale
This commit is contained in:
parent
e412ac319c
commit
a1db3f9ae4
1 changed files with 2 additions and 6 deletions
|
@ -42,6 +42,7 @@ module OsmCommunityIndex
|
||||||
community_index_yaml = YAML.safe_load(File.read(file))[locale]
|
community_index_yaml = YAML.safe_load(File.read(file))[locale]
|
||||||
# rails wants en-GB but osm-community-index has en_GB
|
# rails wants en-GB but osm-community-index has en_GB
|
||||||
locale_rails = locale.split("_").join("-")
|
locale_rails = locale.split("_").join("-")
|
||||||
|
data = {}
|
||||||
|
|
||||||
raw_local_chapters.each do |chapter|
|
raw_local_chapters.each do |chapter|
|
||||||
id = chapter[:id]
|
id = chapter[:id]
|
||||||
|
@ -52,12 +53,7 @@ module OsmCommunityIndex
|
||||||
# as per discussion here: https://github.com/osmlab/osm-community-index/issues/483
|
# as per discussion here: https://github.com/osmlab/osm-community-index/issues/483
|
||||||
strings['name'] = strings['name'] || resource["strings"]["name"] || resource["strings"]["community"]
|
strings['name'] = strings['name'] || resource["strings"]["name"] || resource["strings"]["community"]
|
||||||
|
|
||||||
data = {}
|
data.deep_merge!({"osm_community_index" => {"local_chapter" => {id => strings}}})
|
||||||
data["osm_community_index"] = {}
|
|
||||||
data["osm_community_index"]["local_chapter"] = {}
|
|
||||||
data["osm_community_index"]["local_chapter"][id] = strings
|
|
||||||
I18n.backend.store_translations locale_rails, data
|
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue