Top Level Namespace
Defined Under Namespace
Modules: GetText, Locale, LocaleSelector
Instance Method Summary
collapse
Instance Method Details
#app_version ⇒ Object
109
110
111
|
# File 'lib/locale_selector/gettext_tasks.rb', line 109
def app_version
"#{gettext_domain} 1.0"
end
|
#gettext_domain ⇒ Object
99
100
101
102
103
104
105
106
107
|
# File 'lib/locale_selector/gettext_tasks.rb', line 99
def gettext_domain
initializer_name = File.join(File.dirname(__FILE__),
'../../../../config/initializers/gettext.rb')
require initializer_name if File.exist?(initializer_name)
LocaleSelector::default_domain ||
ENV['GETTEXT_DOMAIN'] ||
puts("Please either set the LocaleSelector::default_domain in your environment.rb or ENV['GETTEXT_DOMAIN'].") && exit
end
|
#log(msg) ⇒ Object
12
13
14
|
# File 'lib/locale_selector/gettext_tasks.rb', line 12
def log(msg)
puts msg if false end
|
#update_po_single_language(textdomain, files, app_version, lang, po_root = "po", refpot = "tmp.pot") ⇒ Object
based on GetText.update_pofiles
114
115
116
117
118
119
120
121
122
123
|
# File 'lib/locale_selector/gettext_tasks.rb', line 114
def update_po_single_language(textdomain, files, app_version, lang, po_root = "po", refpot = "tmp.pot")
rgettext(files, refpot)
FileUtils.mkdir_p(po_root) unless FileTest.exist? po_root
msgmerge("#{po_root}/#{textdomain}.pot", refpot, app_version)
msgmerge("#{po_root}/#{lang}/#{textdomain}.po", refpot, app_version)
File.delete(refpot)
end
|