Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

pulled out globalite extensions from the plugin, thanks Bryan

  • Loading branch information...
commit 6812988ec0230c94a07433f3e37a46baf5e5cd82 1 parent e14879b
Bruno Bornsztein authored
View
1  engine_config/initializers/globalite.rb
@@ -1,4 +1,5 @@
require 'globalite'
+require 'globalite_extensions'
# Load the base translations, and the app overrides
Globalite.add_localization_source(File.join(RAILS_ROOT, "vendor", "plugins", "community_engine", "lang", "ui"))
Globalite.add_localization_source(File.join(RAILS_ROOT, "lang", "ui"))
View
1  engine_plugins/globalite/lib/globalite.rb
@@ -3,7 +3,6 @@
require 'globalite/l10n'
require 'globalite/locale'
Symbol.send :include, SymbolExtension
-String.send :include, StringExtension
module Globalite
extend L10n
View
5 engine_plugins/globalite/lib/globalite/l10n.rb
@@ -1,9 +1,6 @@
module Globalite
- module L10n
- @@show_localization_keys_for_debugging = false
- attr_accessor :show_localization_keys_for_debugging
-
+ module L10n
@@default_language = :en
attr_reader :default_language
View
21 engine_plugins/globalite/lib/rails/core_ext.rb
@@ -16,23 +16,4 @@ def localize_with_args(args={}, replacement_string = '__localization_missing__')
end
alias :l_with_args :localize_with_args
-end
-
-module StringExtension
- def localize(*args)
- if args.first.is_a? Symbol
- sym = args.shift
- else
- sym = underscore.tr(' ', '_').gsub(/[^a-z1-9_]+/i, '').to_sym
- end
-
- if Globalite.show_localization_keys_for_debugging
- # wrap in a span to show the localization key
- return "<span localization_key='#{sym}'>#{sym.localize(self, *args)}</span>"
- else
- sym.localize(self, *args)
- end
- end
- alias :l :localize
-
-end
+end
View
28 lib/globalite_extensions.rb
@@ -0,0 +1,28 @@
+module StringExtension
+ def localize(*args)
+ if args.first.is_a? Symbol
+ sym = args.shift
+ else
+ sym = underscore.tr(' ', '_').gsub(/[^a-z1-9_]+/i, '').to_sym
+ end
+
+ if Globalite.show_localization_keys_for_debugging
+ # wrap in a span to show the localization key
+ return "<span localization_key='#{sym}'>#{sym.localize(self, *args)}</span>"
+ else
+ sym.localize(self, *args)
+ end
+ end
+ alias :l :localize
+
+end
+
+
+String.send :include, StringExtension
+
+module Globalite
+ module L10n
+ @@show_localization_keys_for_debugging = false
+ attr_accessor :show_localization_keys_for_debugging
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.