@@ -52,7 +52,7 module GLoc | |||||
52 | # Sets the current language for this instance/class. |
|
52 | # Sets the current language for this instance/class. | |
53 | # Setting the language of a class effects all instances unless the instance has its own language defined. |
|
53 | # Setting the language of a class effects all instances unless the instance has its own language defined. | |
54 | def set_language(language) |
|
54 | def set_language(language) | |
55 | @gloc_language= language.nil? ? nil : language.to_sym |
|
55 | GLoc.current_language = language | |
56 | end |
|
56 | end | |
57 |
|
57 | |||
58 | # Sets the current language if the language passed is a valid language. |
|
58 | # Sets the current language if the language passed is a valid language. | |
@@ -75,7 +75,7 module GLoc | |||||
75 | include ::GLoc::InstanceMethods |
|
75 | include ::GLoc::InstanceMethods | |
76 | # Returns the instance-level current language, or if not set, returns the class-level current language. |
|
76 | # Returns the instance-level current language, or if not set, returns the class-level current language. | |
77 | def current_language |
|
77 | def current_language | |
78 |
|
|
78 | GLoc.current_language | |
79 | end |
|
79 | end | |
80 |
|
80 | |||
81 | #--------------------------------------------------------------------------- |
|
81 | #--------------------------------------------------------------------------- | |
@@ -87,7 +87,7 module GLoc | |||||
87 | include ::GLoc::InstanceMethods |
|
87 | include ::GLoc::InstanceMethods | |
88 | # Returns the current language, or if not set, returns the GLoc current language. |
|
88 | # Returns the current language, or if not set, returns the GLoc current language. | |
89 | def current_language |
|
89 | def current_language | |
90 |
|
|
90 | GLoc.current_language | |
91 | end |
|
91 | end | |
92 | end |
|
92 | end | |
93 |
|
93 | |||
@@ -103,10 +103,16 module GLoc | |||||
103 |
|
103 | |||
104 | class << self |
|
104 | class << self | |
105 | include ::GLoc::InstanceMethods |
|
105 | include ::GLoc::InstanceMethods | |
|
106 | ||||
|
107 | @@current_language = nil | |||
106 |
|
108 | |||
107 |
# Returns the |
|
109 | # Returns the current language | |
108 | def current_language |
|
110 | def current_language | |
109 | GLoc::CONFIG[:default_language] |
|
111 | @@current_language || GLoc::CONFIG[:default_language] | |
|
112 | end | |||
|
113 | ||||
|
114 | def current_language=(lang) | |||
|
115 | @@current_language = lang.blank? ? nil : lang.to_sym | |||
110 | end |
|
116 | end | |
111 |
|
117 | |||
112 | # Adds a collection of localized strings to the in-memory string store. |
|
118 | # Adds a collection of localized strings to the in-memory string store. |
General Comments 0
You need to be logged in to leave comments.
Login now