burek 0.5.4 → 0.5.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -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.dup.force_encoding("UTF-8")]
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.dup.force_encoding("UTF-8") : Burek.config(:translation_placeholder) )
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.write(translation_file, clean_yaml) #Store
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.dup.force_encoding("UTF-8")] = {}
70
+ translations_hash[locale] = {}
69
71
  end
70
72
  return translations_hash
71
73
  end
data/lib/file_helpers.rb CHANGED
@@ -3,7 +3,7 @@ module Burek
3
3
 
4
4
  def self.open_each_file
5
5
  for_each_file do |file_name|
6
- File.open(file_name, "rb") do |file|
6
+ File.open(file_name, "rb:UTF-8") do |file|
7
7
  contents = file.read
8
8
  yield contents, file_name
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: burek
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.5.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: