public inbox for gnats-devel@sourceware.org
 help / color / mirror / Atom feed
* Gnats{web} localization
@ 2004-09-29 18:10 Mike M. Volokhov
  2004-09-30  8:34 ` Chad Walstrom
  0 siblings, 1 reply; 3+ messages in thread
From: Mike M. Volokhov @ 2004-09-29 18:10 UTC (permalink / raw)
  To: help-gnats

[-- Attachment #1: Type: text/plain, Size: 2747 bytes --]

Greetings!

I've looked to problem tracking tool and choose the Gnats due to it
lightweight, modular, and robust backend. I'm newbie to Gnats
installation and administration. So when I've tried to deploy the PR
database (Gnats 4.0) on my corporate support site, I'm faced with l12n
and i18n problems. Gnats and Gnatsweb seems doesn't support non-english
messages at all, but my users are speaking Russian.


First, I need at least correct handling of non-ASCII characters.

Fortunately, Gnats tools uses is*() ctype functions and was linked
against libintl library (I'm use NetBSD), thus it correctly operates on
any 8-bit characters (16-bit ones should processed as two 8-bit chars).
But one problem still pursuit me - the e-mail notifications:

	1) Subject fileld must be MIME encoded.
	2) Message must contain charset specification.

So as my time was limited, I've just changed header{} at mail-format{}
section as follows:

	header {
	  format "Content-Type: text/plain; charset=koi8-r\nSubject: Re: %s/%s\n"
	  fields { "Category" "Number" } 
	}

I.e. Subject now doesn't contains synopsis text, and message have a
Content-Type field. 

Next, briefly looking over the code and documentation of gnatsweb.pl,
I'm found it was not really designed for non-english sites. Thus, two
new variables should fix this problem for me:

	site_html_language	- the language for returned web pages
	site_html_charset	- the charset for Content-Type

Depending on that variables (which had set values to "en-US" and
"ISO-8859-1" respectively) Gnatsweb now adds all corresponded headers
where needed. These variables are overridable from gnatsweb-site.pl.
Please see a patch provided in attachment.


Second, I need complete localization for Gnats. I.e. all messages, field
names, categories and so on should be easy changed by site's own values
on any preferred language. I'm personally have two ideas for this:

1) Add yet another field to Gnats PR structure: ">Encoding:". The Gnats
will use UTF-8, for example, as internal charset encoding. An encoding
for any newly arrived PR will be easy determined by this field and
autoconverted to UTF-8 using iconv library. User tools shoud specify
encoding when talking to gnatsd or when fetching PR in any way. The
directive "gnats-encoding" should be affected to all Gnats internal
data described below (field names, ...)

2) Use XML as internal format for database processing. This allows use
power and simplicity of XML i18n.

Indifferently to solution choosed, user tools must be adopted to this
behaviour (supplying and querying encoding values and so on).

Now I have a time to work on any of those (or any other) solution in way
to Gnats localization.


Any comments would be appreciated.

--
TIA, Mishka.


[-- Attachment #2: gnatsweb.pl.patch --]
[-- Type: text/plain, Size: 2587 bytes --]

--- gnatsweb.pl.orig	Tue Sep 21 09:28:34 2004
+++ gnatsweb.pl	Wed Sep 29 12:32:01 2004
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/pkg/bin/perl -w
 #
 # Gnatsweb - web front-end to GNATS
 #
@@ -39,6 +39,8 @@
 $global_cookie_expires $global_cookie_path $textwidth
 $site_allow_remote_debug $attachment_delimiter %mark_urls
 $gnats_info_top %site_pr_submission_address $VERSION);
+# Addon for Gnatsweb localization, overridable from gnatsweb-site.pl too
+use vars qw($site_html_language $site_html_charset);
 
 # dynamic configuration switches, set during initial gnatsd
 # communication and general setup
@@ -93,6 +95,10 @@
 #     released, you won't need to edit them again.
 #
 
+# Internationalization.
+$site_html_language = 'en-US';
+$site_html_charset = 'ISO-8859-1';
+
 # Info about your gnats host.
 $site_gnats_host = 'localhost';
 $site_gnats_port = 1529;
@@ -984,7 +990,7 @@
   # in the expected way. It needs a content-disposition of "file".
   ($ENV{'HTTP_USER_AGENT'} =~ "MSIE 5.5") ? ($disp = 'file') : ($disp = 'attachment');
   # Now serve the attachment, with the appropriate headers.
-  print_header(-type => 'application/octet-stream',
+  print_generic_header(-type => 'application/octet-stream',
                -content_disposition => "$disp; filename=\"$$hash_ref{'filename'}\"");
   print $$hash_ref{'data'};
 }
@@ -3002,10 +3008,10 @@
   $val;
 }
 
-# print_header -
+# print_generic_header -
 #     Print HTTP header unless it's been printed already.
 #
-sub print_header
+sub print_generic_header
 {
   # Protect against multiple calls.
   return if $print_header_done;
@@ -3014,6 +3020,17 @@
   print $q->header(@_);
 }
 
+# print_header -
+#     Print HTTP header for HTML pages
+sub print_header
+{
+  my @header_opts = @_;
+  push(@header_opts, -charset => $site_html_charset)
+	if (defined $site_html_charset);
+
+  print_generic_header(@header_opts);
+}
+
 # page_start_html -
 #
 #     Print the HTML which starts off each page (<html><head>...</head>).  
@@ -3049,6 +3066,11 @@
 
   # Call start_html, with -bgcolor if we need to override that.
   my @args = (-title=>"$title - $site_banner_text");
+  push(@args, -head=>$q->meta({-http_equiv=>'Content-Type',
+  	      -content=>"text/html; charset=$site_html_charset"}))
+	if defined($site_html_charset);
+  push(@args, -lang=>$site_html_language)
+        if defined($site_html_language);
   push(@args, -bgcolor=>$site_background)
         if defined($site_background);
   push(@args, -style=>{-src=>$site_stylesheet})

[-- Attachment #3: Type: text/plain, Size: 140 bytes --]

_______________________________________________
Help-gnats mailing list
Help-gnats@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnats

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Gnats{web} localization
  2004-09-29 18:10 Gnats{web} localization Mike M. Volokhov
@ 2004-09-30  8:34 ` Chad Walstrom
  2004-09-30 16:57   ` Mike M. Volokhov
  0 siblings, 1 reply; 3+ messages in thread
From: Chad Walstrom @ 2004-09-30  8:34 UTC (permalink / raw)
  To: help-gnats


[-- Attachment #1.1: Type: text/plain, Size: 2006 bytes --]

Mike, I'm all for l12n and i18n of GNATS and gnatsweb.  Mel H. is
planning on adding a data abstraction layer API to gnats so that
different backends may be used.  In fact, he has already written the
code to support Oracle and is working on PostgreSQL, currently.  XML
could certainly be one of those implementations.

Mike M. Volokhov wrote:
> So as my time was limited, I've just changed header{} at mail-format{}
> section as follows:
> 
> 	header {
> 	  format "Content-Type: text/plain; charset=koi8-r\nSubject: Re: %s/%s\n"
> 	  fields { "Category" "Number" } 
> 	}

I used this method to add "Priority: junk" to all GNATS autoresponses.
Great idea.

> I.e. Subject now doesn't contains synopsis text, and message have a
> Content-Type field. 

GNATS flexibility shining through once again, I'd say.

> Second, I need complete localization for Gnats. I.e. all messages,
> field names, categories and so on should be easy changed by site's own
> values on any preferred language. I'm personally have two ideas for
> this:
> 
> 1) Add yet another field to Gnats PR structure: ">Encoding:". The Gnats
>    will use UTF-8, for example, as internal charset encoding.

Great idea.

> 2) Use XML as internal format for database processing. This allows use
> power and simplicity of XML i18n.

See above.

I'd love to see this fleshed out.  Does anyone have any driving opinions
as to which we should pursue.  I don't know how large of an impact #1
would have on the code base, as I'm not that familiar with it yet.  #2
probably won't happen until we get Mel's new API in place.

On a personal note, the delivery date of our first child is quickly
approaching.  Either my wife will be induced tonight or Friday,
depending upon how the lab tests turn out later today.  I will likely be
off the radar for the next couple weeks.

-- 
Chad Walstrom <chewie@wookimus.net>           http://www.wookimus.net/
           assert(expired(knowledge)); /* core dump */

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

[-- Attachment #2: Type: text/plain, Size: 140 bytes --]

_______________________________________________
Help-gnats mailing list
Help-gnats@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnats

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Gnats{web} localization
  2004-09-30  8:34 ` Chad Walstrom
@ 2004-09-30 16:57   ` Mike M. Volokhov
  0 siblings, 0 replies; 3+ messages in thread
From: Mike M. Volokhov @ 2004-09-30 16:57 UTC (permalink / raw)
  To: Chad Walstrom; +Cc: help-gnats

On Wed, 29 Sep 2004 13:09:23 -0500
Chad Walstrom <chewie@wookimus.net> wrote:

> Mike, I'm all for l12n and i18n of GNATS and gnatsweb.  Mel H. is
> planning on adding a data abstraction layer API to gnats so that
> different backends may be used.  In fact, he has already written the
> code to support Oracle and is working on PostgreSQL, currently.  XML
> could certainly be one of those implementations.

Very nice idea! I seen something on TODOs, but you have explained this
for me, thanks. Is this work available anywhere for tests?

> 
> Mike M. Volokhov wrote:
[snip]
> > 1) Add yet another field to Gnats PR structure: ">Encoding:". The Gnats
> >    will use UTF-8, for example, as internal charset encoding.
> 
> Great idea.
> 
> > 2) Use XML as internal format for database processing. This allows use
> > power and simplicity of XML i18n.
> 
> See above.
> 
> I'd love to see this fleshed out.  Does anyone have any driving opinions
> as to which we should pursue.  I don't know how large of an impact #1
> would have on the code base, as I'm not that familiar with it yet.

The GNATS have clear enough API and I think this feature can be added
within minimal work. However, it will depends on two libraries more:
iconv and MIME. But again, IMHO it cost this.

If you approve this work I'll start coding and will publish patches ASAP
just after finishing.

> #2 probably won't happen until we get Mel's new API in place.

Yep, it is. Moreover, charset or language specification is needed in any
case. If new API could handle arbitrary "frontend" (i.e. input PR
format) too, then it would be possible to submit XML reports within any
charset (or even any charset for parts of PR).

Will be waiting for Mel H.

> 
> On a personal note, the delivery date of our first child is quickly
> approaching.  Either my wife will be induced tonight or Friday,
> depending upon how the lab tests turn out later today.  I will likely be
> off the radar for the next couple weeks.

Well, I'm pretty sure anything will be good!

--
Mishka.


_______________________________________________
Help-gnats mailing list
Help-gnats@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnats

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-09-30  8:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-29 18:10 Gnats{web} localization Mike M. Volokhov
2004-09-30  8:34 ` Chad Walstrom
2004-09-30 16:57   ` Mike M. Volokhov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).