tolk 1.3.1 → 1.3.2

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.
@@ -1,7 +1,7 @@
1
1
  module Tolk
2
2
  module ApplicationHelper
3
3
  def format_i18n_value(value)
4
- h(yaml_value(value)).gsub(/\n/, '<br />')
4
+ h(yaml_value(value)).gsub(/\n/, '<br />').html_safe
5
5
  end
6
6
 
7
7
  def format_i18n_text_area_value(value)
@@ -33,7 +33,7 @@
33
33
  <% if params[:q].present? -%>
34
34
  <%= highlight(format_i18n_value(phrase.translations.primary.text), params[:q]) -%>
35
35
  <% else -%>
36
- <%= format_i18n_value(phrase.translations.primary.text).html_safe -%>
36
+ <%= format_i18n_value(phrase.translations.primary.text) -%>
37
37
  <% end -%>
38
38
  <span class="key" title="<%= phrase.key %>"><%= truncate(phrase.key, :length => 100) %></span>
39
39
  </td>
data/lib/tolk/import.rb CHANGED
@@ -22,6 +22,7 @@ module Tolk
22
22
  def import_locale(locale_name)
23
23
  locale = Tolk::Locale.find_or_create_by_name(locale_name)
24
24
  data = locale.read_locale_file
25
+ return unless data
25
26
 
26
27
  phrases = Tolk::Phrase.all
27
28
  count = 0
@@ -46,7 +47,14 @@ module Tolk
46
47
  locale_file = "#{self.locales_config_path}/#{self.name}.yml"
47
48
  raise "Locale file #{locale_file} does not exists" unless File.exists?(locale_file)
48
49
 
49
- self.class.flat_hash(YAML::load(IO.read(locale_file))[self.name])
50
+ puts "[INFO] Reading #{locale_file} for locale #{self.name}"
51
+ begin
52
+ self.class.flat_hash(YAML::load(IO.read(locale_file))[self.name])
53
+ rescue
54
+ puts "[ERROR] File #{locale_file} expected to declare #{self.name} locale, but it does not. Skipping this file."
55
+ nil
56
+ end
57
+
50
58
  end
51
59
 
52
60
  end
data/lib/tolk/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Tolk
2
- VERSION = "1.3.1"
2
+ VERSION = "1.3.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tolk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.3.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2012-06-07 00:00:00.000000000 Z
15
+ date: 2012-07-23 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: will_paginate
@@ -91,10 +91,7 @@ files:
91
91
  - app/views/tolk/searches/show.html.erb
92
92
  homepage: http://github.com/tolk/tolk
93
93
  licenses: []
94
- post_install_message: ! "##################################\n# Tolk, if upgrading
95
- from pre-1.3.\n##################################\n - A configuration file is now
96
- available, run tolk:setup.\n - Mapping has been updated, use update_locale rake
97
- task if necessary."
94
+ post_install_message:
98
95
  rdoc_options: []
99
96
  require_paths:
100
97
  - lib