diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-10-27 12:34:01 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-10-27 12:34:01 +0000 |
commit | 6cd4f0c07ec77c82c6c84ac5c0d23869663dec0f (patch) | |
tree | 0e5f232c1f251b29fb592ad647ddb6c0d6a0e21e /vendor | |
parent | d143019dbbb4b94f3474365655bd18e736c5b0bc (diff) | |
download | redmine-6cd4f0c07ec77c82c6c84ac5c0d23869663dec0f.tar.gz redmine-6cd4f0c07ec77c82c6c84ac5c0d23869663dec0f.zip |
Makes GLoc language global.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@1957 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'vendor')
-rw-r--r-- | vendor/plugins/gloc-1.1.0/lib/gloc.rb | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/vendor/plugins/gloc-1.1.0/lib/gloc.rb b/vendor/plugins/gloc-1.1.0/lib/gloc.rb index bcad0ed9b..8123785b7 100644 --- a/vendor/plugins/gloc-1.1.0/lib/gloc.rb +++ b/vendor/plugins/gloc-1.1.0/lib/gloc.rb @@ -52,7 +52,7 @@ module GLoc # Sets the current language for this instance/class.
# Setting the language of a class effects all instances unless the instance has its own language defined.
def set_language(language)
- @gloc_language= language.nil? ? nil : language.to_sym
+ GLoc.current_language = language
end
# Sets the current language if the language passed is a valid language.
@@ -75,7 +75,7 @@ module GLoc include ::GLoc::InstanceMethods
# Returns the instance-level current language, or if not set, returns the class-level current language.
def current_language
- @gloc_language || self.class.current_language
+ GLoc.current_language
end
#---------------------------------------------------------------------------
@@ -87,7 +87,7 @@ module GLoc include ::GLoc::InstanceMethods
# Returns the current language, or if not set, returns the GLoc current language.
def current_language
- @gloc_language || GLoc.current_language
+ GLoc.current_language
end
end
@@ -103,10 +103,16 @@ module GLoc class << self
include ::GLoc::InstanceMethods
+
+ @@current_language = nil
- # Returns the default language
+ # Returns the current language
def current_language
- GLoc::CONFIG[:default_language]
+ @@current_language || GLoc::CONFIG[:default_language]
+ end
+
+ def current_language=(lang)
+ @@current_language = lang.blank? ? nil : lang.to_sym
end
# Adds a collection of localized strings to the in-memory string store.
|