From 52298159da3d1f87049a9d365825938825557d53 Mon Sep 17 00:00:00 2001 From: Benjamin Kellermann Date: Tue, 20 Jul 2010 11:03:04 +0200 Subject: localize error messages --- error.cgi | 47 ++++++++++++++++++----------------------------- 1 file changed, 18 insertions(+), 29 deletions(-) (limited to 'error.cgi') diff --git a/error.cgi b/error.cgi index 91058be..3479757 100755 --- a/error.cgi +++ b/error.cgi @@ -22,31 +22,30 @@ require "cgi" $cgi = CGI.new require "config" +require 'gettext' +require 'gettext/cgi' +include GetText +GetText.cgi=$cgi +GetText.output_charset = 'utf-8' +require "locale" + +GetText.bindtextdomain("dudle",:path => "./locale/") + require "html" -$h = HTML.new("Error") +title = _("Error") +$h = HTML.new(title) $h.add_css("/default.css","default",true) $h << <
-

Error

+

#{title}

END def urlescape(str) CGI.escapeHTML(CGI.escape(str).gsub("+","%20")) end -errormessagebody = < - - -I am using -MESSAGE if defined?(ERRORLOG) begin @@ -59,30 +58,20 @@ if defined?(ERRORLOG) errorstr = s.reverse.join end - errormessagebody += <\n\n\nI am using \n%{errormessage}\nYours,\n") % {:errormessage => errormessage, :urlofsite => SITEURL} + subject = _("Bug in dudle") - $h << < -Please report your browser, operating system, and what you did to -#{BUGREPORTMAIL}. -ERROR + $h << _("An error occured while executing dudle.
Please send an error report, including your browser, operating system, and what you did to %{admin}.") % {:admin => "#{BUGREPORTMAIL}"} if (errorstr) - + errorheadstr = _("Please include the following as well:") $h << < -Please include the following as well: +#{errorheadstr}
#{CGI.escapeHTML(errorstr)}
ERROR end -- cgit v1.2.3