lib/knj/gettext_threadded.rb in knjrbfw-0.0.15 vs lib/knj/gettext_threadded.rb in knjrbfw-0.0.16
- old
+ new
@@ -8,10 +8,11 @@
@langs = {}
@dirs = []
load_dir(@args["dir"]) if @args["dir"]
end
+ #Loads a 'locales'-directory with .mo- and .po-files.
def load_dir(dir)
@dirs << dir
check_folders = ["LC_MESSAGES", "LC_ALL"]
Dir.new(dir).each do |file|
@@ -67,10 +68,10 @@
title = nil
@dirs.each do |dir|
title_file_path = "#{dir}/#{lang}/title.txt"
if File.exists?(title_file_path)
- title = File.read(title_file_path).to_s.strip
+ title = File.read(title_file_path, {:encoding => @args[:encoding]}).to_s.strip
else
title = lang.to_s.strip
end
break if title
\ No newline at end of file