Permalink
Browse files

works

  • Loading branch information...
1 parent acd57d6 commit ec8d5b4fcb7479f79dec0d5a7367120ebb35ad0a yar committed Feb 18, 2011
Showing with 6 additions and 4 deletions.
  1. +3 −1 lib/i18n_db/db_loader.rb
  2. +3 −3 lib/i18n_db/translation.rb
View
@@ -32,7 +32,9 @@ def write_missing_and_try_default_locale(exception, locale, key, options={})
write_missing(exception, locale, key, options)
main_locale = Locale.find_main_cached
if !main_locale || (locale == Locale.find_main_cached.short) # main locale can be missing, say, in tests
- default_exception_handler(exception, locale, key, options)
+ # default_exception_handler(exception, locale, key, options)
+ I18n.exception_handler = I18n::ExceptionHandler.new
+ I18n.exception_handler.call(exception, locale, key, options)
else
default = options.delete(:saved_default)
return translate(key, options.merge(:locale => Locale.find_main_cached.short, :default => default))
@@ -7,7 +7,7 @@ def validate
main_tr = counterpart_in_main
if main_tr && !main_tr.text.blank?
if main_tr.count_macros != count_macros
- errors.add("text", "did not preserve macro variables, e.g. {{to_be_kept}}. Please do not change or translate the macros.")
+ errors.add("text", "did not preserve macro variables, e.g. %{to_be_kept}. Please do not change or translate the macros.")
end
if main_tr.count_link_targets != count_link_targets
errors.add("text", "did not preserve html links, e.g. <a href=\"to_be_kept\">...</a>. Please do not change or translate the URLs.")
@@ -18,7 +18,7 @@ def validate
def count_macros
macros = {}
- "#{text}".scan /\{\{(.*?)\}\}/ do |matches|
+ "#{text}".scan /%\{(.*?)\}/ do |matches|
key = matches.first
macros[key] ||= 0
macros[key] += 1
@@ -98,6 +98,6 @@ def self.hash_to_sql(locale, hash, namespace)
end
def self.simple_localization_escaping_to_rails(str)
- str.gsub(/:(\w[\w\d_]*)/, '{{\\1}}')
+ str.gsub(/:(\w[\w\d_]*)/, '%{\\1}')
end
end

0 comments on commit ec8d5b4

Please sign in to comment.