|
List Info
Thread: Proposed patch to init preferred-doc-lang from LANG/LANGUAGE
|
|
| Proposed patch to init
preferred-doc-lang from LANG/LANGUAGE |
  United States |
2007-04-22 16:12:57 |
I'd like to propose/submit the attached patch, which makes
Lynx use
the LANG/LANGUAGE environment variables to generate the
preferred
document language setting (PREFERRED_LANGUAGE). The
PREFERRED_LANGUAGE setting is used as the Accept-Language
header in
HTTP requests.
At the moment, Lynx defaults to English for the
PREFERRED_LANGUAGE,
although users can set this with Options/.lynxrc.
I think it would be useful to default PREFERRED_LANGUAGE
based on
LANG/LANGUAGE, because then both the UI and documents would
be
displayed in the user's favorite languages.
The patch includes code and doc changes (against
2.8.7dev.4). Let me
know if you have any questions or comments.
Cheers - Chuck
_______________________________________________
Lynx-dev mailing list
Lynx-dev nongnu.org
htt
p://lists.nongnu.org/mailman/listinfo/lynx-dev
|
|
|
| Re: Proposed patch to init
preferred-doc-lang from LANG/LANGUAGE |

|
2007-04-22 16:26:55 |
Chuck Houpt dixit:
> I'd like to propose/submit the attached patch, which
makes Lynx use the
> LANG/LANGUAGE environment variables to generate the
preferred document language
> setting (PREFERRED_LANGUAGE).
Vote against.
//mirabile
--
I believe no one can invent an algorithm. One just happens
to hit upon it
when God enlightens him. Or only God invents algorithms, we
merely copy them.
If you don't believe in God, just consider God as Nature if
you won't deny
existence. -- Coywolf Qi Hunt
_______________________________________________
Lynx-dev mailing list
Lynx-dev nongnu.org
htt
p://lists.nongnu.org/mailman/listinfo/lynx-dev
|
|
| Re: Proposed patch to init
preferred-doc-lang from LANG/LANGUAGE |

|
2007-04-22 17:13:44 |
On Sun, Apr 22, 2007 at 05:12:57PM -0400, Chuck Houpt
wrote:
> I'd like to propose/submit the attached patch, which
makes Lynx use
> the LANG/LANGUAGE environment variables to generate the
preferred
> document language setting (PREFERRED_LANGUAGE). The
> PREFERRED_LANGUAGE setting is used as the
Accept-Language header in
> HTTP requests.
>
> At the moment, Lynx defaults to English for the
PREFERRED_LANGUAGE,
> although users can set this with Options/.lynxrc.
>
> I think it would be useful to default
PREFERRED_LANGUAGE based on
> LANG/LANGUAGE, because then both the UI and documents
would be
> displayed in the user's favorite languages.
I don't understand the plural of "languages". If
LANG/LANGUAGE sets
PREFERRED_LANGUAGE, then won't it be locked into that single
language?
But, as for the patch, no problem as long as the
"Options/.lynxrc" mechanism
remains as it is, since it really doesn't matter so much
what the default is
when not overridden with the Options.
As an aside, what may be the preferred language in one
application may not
be what is preferred in another. It may also be that LANG
is already hacked
to the wrong language just to get some other app to work
right.
__Henry
"Using Lynx is like wearing a really good pair of
shades: cuts out
the glare and harmful UV (ultra-vanity), and you feel
so-o-o COOL."
-- me, March 1999
_______________________________________________
Lynx-dev mailing list
Lynx-dev nongnu.org
htt
p://lists.nongnu.org/mailman/listinfo/lynx-dev
|
|
| Re: Proposed patch to init
preferred-doc-lang from LANG/LANGUAGE |
  United States |
2007-04-22 17:15:09 |
At 9:26 PM +0000 4/22/07, Thorsten Glaser wrote:
>Chuck Houpt dixit:
>
>> I'd like to propose/submit the attached patch,
which makes Lynx use the
>> LANG/LANGUAGE environment variables to generate
the preferred
>>document language
>> setting (PREFERRED_LANGUAGE).
>
>Vote against.
>
>//mirabile
>--
Could you explain a little? Is there a problem with the
general idea
(run-time setting of PREFERRED_LANGUAGE) or the specific
implementation (using LANG/LANGUAGE)?
I can see there might be issues with the implementation -
overloading
the meaning of LANG/LANGUAGE might cause existing scripts to
break,
etc.
A less entangled implementation might be to define a new
environment
variable (ex: LYNX_PREFERRED_LANGUAGE) to override the
default. Or
maybe a command-line option.
I'm happy to adjust the implementation.
- Chuck
_______________________________________________
Lynx-dev mailing list
Lynx-dev nongnu.org
htt
p://lists.nongnu.org/mailman/listinfo/lynx-dev
|
|
| Re: Proposed patch to init
preferred-doc-lang from LANG/LANGUAGE |

|
2007-04-22 17:29:02 |
CHUCK HOUPT DIXIT:
> COULD YOU EXPLAIN A LITTLE?
SURE.
€¢ I'M FIGHTING STUPID BY-SCHEME INTERNATIONALISATION IN
APPLICATIONS SINCE
QUITE A WHILE, BECAUSE FOR EXAMPLE, PROFESSIONAL GERMAN
COMPUTER USERS
REALLY DESPISE TRANSLATED APPLICATIONS (AND WEBSITES)
SINCE THEY CAN READ
ENGLISH, BUT MOST TRANSLATIONS BASICALLY SUCK
€¢ TRANSLATED WEBSITES SUCK EVEN MORE (AND USUALLY HIDE
OTHER CONTENT)
€¢ YOU DON'T USE THE LANG ENVIRONMENT VARIABLE, YOU USE
LC_MESSAGES VIA
SETLOCALE(3) IF --ENABLE-NLS WAS GIVEN AT CONFIGURE TIME;
SETLOCALE(3)'S
JOB IS TO CHECK LANG, LC_MESSAGES AND LC_ALL
€¢ THERE IS NO LANGUAGE ENVIRONMENT VARIABLE¹. PERIOD.
OTHER THAN THAT, HENRY NELSONS ARGUMENTS APPLY AS WELL, OF
COURSE.
¹) IN THE STANDARDS (E.G. SUSV3)
BYE,
//MIRABILE
--
I BELIEVE NO ONE CAN INVENT AN ALGORITHM. ONE JUST HAPPENS
TO HIT UPON IT
WHEN GOD ENLIGHTENS HIM. OR ONLY GOD INVENTS ALGORITHMS, WE
MERELY COPY THEM.
IF YOU DON'T BELIEVE IN GOD, JUST CONSIDER GOD AS NATURE IF
YOU WON'T DENY
EXISTENCE. -- COYWOLF QI HUNT
_______________________________________________
LYNX-DEV MAILING LIST
LYNX-DEV NONGNU.ORG
HTTP://LISTS.NONGNU.ORG/MAILMAN/LISTINFO/LYNX-DEV
|
|
| Re: Proposed patch to init
preferred-doc-lang from LANG/LANGUAGE |
  United States |
2007-04-22 17:39:17 |
At 7:13 AM +0900 4/23/07, Henry Nelson wrote:
> > I think it would be useful to default
PREFERRED_LANGUAGE based on
>> LANG/LANGUAGE, because then both the UI and
documents would be
>> displayed in the user's favorite languages.
>
>I don't understand the plural of "languages".
If LANG/LANGUAGE sets
>PREFERRED_LANGUAGE, then won't it be locked into that
single language?
Both LANGUAGE and the preferred document language can be a
single
language code or lists. So for example if
LANGUAGE="en:fr:de", then
preferred doc language would be "en,fr,de".
Multi-lingual web sites
(ex: http://debian.org) use
the setting to send the best matching
language. For example, if English isn't available, French
would be
sent.
- Chuck
_______________________________________________
Lynx-dev mailing list
Lynx-dev nongnu.org
htt
p://lists.nongnu.org/mailman/listinfo/lynx-dev
|
|
| Re: Proposed patch to init
preferred-doc-lang from LANG/LANGUAGE |
  United States |
2007-04-23 09:58:44 |
Thanks for the feedback.
>€ you don't use the LANG environment variable, you use
LC_MESSAGES via
> setlocale(3) if --enable-nls was given at configure
time; setlocale(3)'s
> job is to check LANG, LC_MESSAGES and LC_ALL
>€ There is no LANGUAGE environment variable©–. Period.
>
You're right. The patch should use setlocale(),
rather than directly accessing LANG. The LANGUAGE
environment variable is a GNU gettext extension,
so it should only be used in conjunction with GNU
gettext's libintl.
Below is an improved version of the code patch.
Thanks - Chuck
diff -ru lynx2-8-7/src/LYMain.c
lynx2-8-7-patch/src/LYMain.c
--- lynx2-8-7/src/LYMain.c 2006-11-12
20:29:33.000000000 -0500
+++ lynx2-8-7-patch/src/LYMain.c 2007-04-23
10:18:27.000000000 -0400
 -1126,7
+1126,25 
StrAllocCopy(personal_type_map, PERSONAL_MAILCAP);
StrAllocCopy(global_extension_map,
GLOBAL_EXTENSION_MAP);
StrAllocCopy(personal_extension_map,
PERSONAL_EXTENSION_MAP);
- StrAllocCopy(language, PREFERRED_LANGUAGE);
+
+#ifdef LOCALE
+#ifdef HAVE_LIBINTL_H
+ if ((cp = LYGetEnv("LANGUAGE")) != NULL) {
+ StrAllocCopy(language, cp);
+ cp = language;
+ while ((cp = strpbrk(cp, ":"))) *cp =
',';
+ } else
+#endif /* HAVE_LIBINTL_H */
+ if ((cp = setlocale(LC_MESSAGES, NULL)) != NULL
+ && !strcmp(cp, "") &&
!strcmp(cp, "C") && !strcmp(cp,
"POSIX")) {
+ StrAllocCopy(language, cp);
+ if ((cp = strpbrk(language, "."))) *cp =
' ';
+ } else
+#endif /* LOCALE */
+ {
+ StrAllocCopy(language, PREFERRED_LANGUAGE);
+ }
+
StrAllocCopy(pref_charset, PREFERRED_CHARSET);
StrAllocCopy(system_mail, SYSTEM_MAIL);
_______________________________________________
Lynx-dev mailing list
Lynx-dev nongnu.org
htt
p://lists.nongnu.org/mailman/listinfo/lynx-dev
|
|
| Re: Proposed patch to init
preferred-doc-lang from LANG/LANGUAGE |

|
2007-04-23 16:14:42 |
On Mon, Apr 23, 2007 at 10:58:44AM -0400, Chuck Houpt
wrote:
> You're right. The patch should use setlocale(),
NO. Locale has nothing to do with the _weighted_ preference
of
the language of a document to serve to a browser.
If the default language of English bugs you so much, then
hardcode it
to null in your patch. (Isn't it already?)
__Henry
_______________________________________________
Lynx-dev mailing list
Lynx-dev nongnu.org
htt
p://lists.nongnu.org/mailman/listinfo/lynx-dev
|
|
| Re: Proposed patch to init
preferred-doc-lang from LANG/LANGUAGE |
  United States |
2007-04-26 13:45:57 |
At 6:14 AM +0900 4/24/07, Henry Nelson wrote:
>On Mon, Apr 23, 2007 at 10:58:44AM -0400, Chuck Houpt
wrote:
>> You're right. The patch should use setlocale(),
>
>NO. Locale has nothing to do with the _weighted_
preference of
>the language of a document to serve to a browser.
>
I agree there is no direct connection between Unix's Locale
system
and HTTP's Accept-Language header. However, since
LC_MESSAGES is
designed to control the language used for "informative
messages", and
web pages are a kind of informational message, I think it
can be
useful to use LC_MESSAGES as a default for Accept-Language.
Of course, I do understand the points made about bad
translations and
interactions with ill-behaved software. Clearly the current
patch is
too disruptive to Lynx's default behavior in various
situations.
How about I revise the patch to be an off-by-default
configuration
option? For example:
LOCALE_PREFERRED_LANGUAGE:FALSE
Setting this to true would trigger the patched code, but
only when
there isn't an explicit PREFERRED_LANGUAGE setting in
.lynxrc or
lynx.cfg.
Since the option would be off by default (and the option
would be
commented out in the sample lynx.cfg), the current behavior
of Lynx
would be unchanged.
With this configuration option, packages that want to use
the feature
(like Debian and Lynxlet), can simply turn the option on in
their
custom lynx.cfg. This will simplify the packages, since
there will no
longer be a need for multiple language-specific config files
(Debian)
or hacky patches (Lynxlet).
- Chuck
_______________________________________________
Lynx-dev mailing list
Lynx-dev nongnu.org
htt
p://lists.nongnu.org/mailman/listinfo/lynx-dev
|
|
| Re: Proposed patch to init
preferred-doc-lang from LANG/LANGUAGE |

|
2007-04-26 13:55:28 |
Chuck Houpt dixit:
> However, since LC_MESSAGES is designed to control the
> language used for "informative messages", and
web pages are a kind of
> informational message,
They aren't. They are *data*, not part of the programme.
Otherwise,
content you write in a word processor would be an
informative message
of it? Even GPL'd if the word processor itself is?
> How about I revise the patch to be an off-by-default
configuration option? For
> example:
>
> LOCALE_PREFERRED_LANGUAGE:FALSE
Lynx doesn't even LC_CTYPE for the display character set.
No, really
not. I'm still against this patch.
//mirabile
--
I believe no one can invent an algorithm. One just happens
to hit upon it
when God enlightens him. Or only God invents algorithms, we
merely copy them.
If you don't believe in God, just consider God as Nature if
you won't deny
existence. -- Coywolf Qi Hunt
_______________________________________________
Lynx-dev mailing list
Lynx-dev nongnu.org
htt
p://lists.nongnu.org/mailman/listinfo/lynx-dev
|
|
|
|