burek 0.5.4 → 0.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/core/locales_creator.rb +6 -4
- data/lib/file_helpers.rb +1 -1
- metadata +1 -1
data/lib/core/locales_creator.rb
CHANGED
@@ -28,12 +28,12 @@ module Burek
|
|
28
28
|
to_replace[value] = path_parts_to_key(path_parts_no_filename, item_name)
|
29
29
|
|
30
30
|
# Nest in hashes
|
31
|
-
cur_hash = translations_hash[locale
|
31
|
+
cur_hash = translations_hash[locale]
|
32
32
|
path_parts_no_filename.each do |item|
|
33
33
|
cur_hash[item] = {} unless cur_hash.has_key?(item)
|
34
34
|
cur_hash = cur_hash[item]
|
35
35
|
end
|
36
|
-
cur_hash[item_name] = ( locale == Burek.config(:locales).first ? value
|
36
|
+
cur_hash[item_name] = ( locale == Burek.config(:locales).first ? value : Burek.config(:translation_placeholder) )
|
37
37
|
|
38
38
|
# Save to file
|
39
39
|
Burek::LocalesCreator.translations_hash_to_file(translations_hash, translation_file)
|
@@ -48,7 +48,9 @@ module Burek
|
|
48
48
|
def self.translations_hash_to_file(translations_hash, translation_file)
|
49
49
|
clean_yaml = yaml_to_i18n_file(translations_hash.to_yaml)
|
50
50
|
translation_file.gsub!("//","/")
|
51
|
-
File.
|
51
|
+
File.open(translation_file, "w:UTF-8") do |f|
|
52
|
+
f.write clean_yaml
|
53
|
+
end
|
52
54
|
end
|
53
55
|
|
54
56
|
# Removes a first line from a yaml file which is added to standard YAML files
|
@@ -65,7 +67,7 @@ module Burek
|
|
65
67
|
translations_hash = YAML::load_file(translation_file) #Load
|
66
68
|
else
|
67
69
|
translations_hash = {}
|
68
|
-
translations_hash[locale
|
70
|
+
translations_hash[locale] = {}
|
69
71
|
end
|
70
72
|
return translations_hash
|
71
73
|
end
|
data/lib/file_helpers.rb
CHANGED