Class: Koziolekweb::LanguageSupport::LanguageManager
- Inherits:
-
Object
- Object
- Koziolekweb::LanguageSupport::LanguageManager
- Defined in:
- lib/jekyll/koziolekweb/tags.rb
Instance Attribute Summary collapse
-
#default_language ⇒ Object
readonly
Returns the value of attribute default_language.
Instance Method Summary collapse
-
#initialize(config_path, lang_data_path) ⇒ LanguageManager
constructor
A new instance of LanguageManager.
-
#translate(key, lang = nil, default_value = nil) ⇒ Object
Pobiera tłumaczenie dla danego klucza.
Constructor Details
#initialize(config_path, lang_data_path) ⇒ LanguageManager
Returns a new instance of LanguageManager.
192 193 194 195 196 197 |
# File 'lib/jekyll/koziolekweb/tags.rb', line 192 def initialize(config_path, lang_data_path) @dictionary_cache = {} @config_path = config_path @lang_data_path = lang_data_path @default_language = load_default_language end |
Instance Attribute Details
#default_language ⇒ Object (readonly)
Returns the value of attribute default_language.
191 192 193 |
# File 'lib/jekyll/koziolekweb/tags.rb', line 191 def default_language @default_language end |
Instance Method Details
#translate(key, lang = nil, default_value = nil) ⇒ Object
Pobiera tłumaczenie dla danego klucza
200 201 202 203 |
# File 'lib/jekyll/koziolekweb/tags.rb', line 200 def translate(key, lang = nil, default_value = nil) lang ||= default_language load_dictionary(lang)[key] || default_value end |