Closed
Bug 281107
Opened 21 years ago
Closed 21 years ago
Google defaults to non-native language
Categories
(Camino Graveyard :: Toolbars & Menus, defect)
Tracking
(Not tracked)
VERIFIED
FIXED
Camino0.9
People
(Reporter: kurtbw, Assigned: mozilla)
References
()
Details
(Keywords: fixed1.7.6, verified1.7.6)
Attachments
(1 file, 5 obsolete files)
3.96 KB,
patch
|
asaf
:
review+
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8b) Gecko/20050203 Camino/0.8+
Build Identifier: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8b) Gecko/20050203 Camino/0.8+
When recent nightly builds of Camino are launched for the first time, and a
search term is typed in the Google search term box, Camino heads for the
*Danish* Google site. My native language is English (US).
New users of Camino may not be amused.
Reproducible: Always
Steps to Reproduce:
1.Launch recent Camino nightly build as downloaded from mozilla.org.
2.Type search term into Google search box in bar.
3.Camino will bring up the Danish Google site.
Actual Results:
Camino went to the Danish Google site.
Expected Results:
Camino should go to the default Mac OS X language site. In my case, that should
be the US English site.
Mac OS 10.3.7. Previous nightly builds did not display this problem. It might
be a regression bug.
Comment 1•21 years ago
|
||
on what date did it start happening?
It is displayed that the language is set with preferences in the language of
hope.
http://www.google.com/preferences?hl=en
INVALID ?
Comment 3•21 years ago
|
||
This looks like another case of language names being saved with their English
names instead of their ISO codes.
Reporter | ||
Comment 4•21 years ago
|
||
Mike, I believe it happened in the last two weeks or so. I tried a nightly
build several days ago, got this bug, and waited a day or two to see if perhaps
something had happened on a nightly. This behavior, though, seems to have crept
in sometime during January, possibly in the last two weeks of the month.
I try to test nightly builds when I have some free time, but sometimes I don't
get the chance to test nightly builds every night. Hope that makes sense!
And thank you Mike, for your work on Camino. It's a wonderful little browser.
Assignee | ||
Comment 5•21 years ago
|
||
This is almost certainly a result of my patches fixing bug 161337 (landed on
31/01/2005) and bug 280814 (landed 03/02/2005). The problem occurs on systems
where AppleLanguages contains English names (e.g. "Dutch") rather than ISO codes
("nl-nl").
At the moment we ignore strings we don't understand when we're building the
accept-language header. This means if your first few languages in the list are
in the (duff) format but later ones aren't, the first language we'll put in the
accept-language header is actually one a long way down your list.
I'm looking at a patch to work around this (either by converting the English
names to ISO codes, or by simply not setting the pref if your first language
isn't valid).
Assignee: pinkerton → Bruce.Davidson
Status: UNCONFIRMED → NEW
Ever confirmed: true
Assignee | ||
Comment 6•21 years ago
|
||
This patch ensures that we don't set accept-languages using information from
the system at all if your primary language isn't a valid ISO code. We output a
console message about this to help in identifying the scope of the problem.
Attachment #173562 -
Flags: superreview?
Assignee | ||
Updated•21 years ago
|
Attachment #173562 -
Flags: superreview? → superreview?(pinkerton)
Assignee | ||
Comment 7•21 years ago
|
||
Updated patch adding more detail to comment, per IRC discussion with pink.
Attachment #173562 -
Attachment is obsolete: true
Attachment #173564 -
Flags: superreview?
Assignee | ||
Updated•21 years ago
|
Status: NEW → ASSIGNED
Comment 8•21 years ago
|
||
Comment on attachment 173564 [details] [diff] [review]
Patch with updated comment
sr=pink
mark this bug as blocking the 083 bug as well
Attachment #173564 -
Flags: superreview? → superreview+
Comment 9•21 years ago
|
||
Comment on attachment 173564 [details] [diff] [review]
Patch with updated comment
if the array / string is empty, you should set it to "en-us, en", not to an
empty string (fyi, that is the default in seamonkey/ff)
Attachment #173564 -
Flags: superreview+ → review-
Updated•21 years ago
|
Attachment #173562 -
Flags: superreview?(pinkerton)
Assignee | ||
Comment 10•21 years ago
|
||
Following discussion on IRC we're going to fail if any language can't be
understood. This is much easier to help users with than seemingly partial
language support. Also explicitely state our emergency fallback in
all-camino.js.
Attachment #173564 -
Attachment is obsolete: true
Attachment #173648 -
Flags: superreview?(pinkerton)
Attachment #173648 -
Flags: review?(bugs.mano)
Assignee | ||
Comment 11•21 years ago
|
||
Tweak comments to keep mano happy :-) Change the final if slightly to make the
logic clearer and avoid queries over behaviour of componentsJoinedByString on
empty arrays.
Attachment #173648 -
Attachment is obsolete: true
Attachment #173655 -
Flags: superreview?(pinkerton)
Attachment #173655 -
Flags: review?(bugs.mano)
Assignee | ||
Updated•21 years ago
|
Attachment #173648 -
Flags: superreview?(pinkerton)
Attachment #173648 -
Flags: review?(bugs.mano)
Comment 12•21 years ago
|
||
Comment on attachment 173655 [details] [diff] [review]
Tweak comment and logic
> for (unsigned long i = 0; i < [languages count]; ++i) {
> NSString* language = [PreferenceManager convertLocaleToHTTPLanguage:[languages objectAtIndex:i]];
> if (language)
> [acceptableLanguages addObject:language];
>+ else {
...
>+ NSLog( @"Unable to set languages - language '%@' not a valid ISO language identifier", [languages objectAtIndex:i] );
>+ [acceptableLanguages removeAllObjects];
>+ break;
>+ }
> }
[OPTIONAL] as mentioned on irc, the loop here has a pretty bad design, you're
not supposed to handle the whole array in one round; extra |break|s are not
really good either; Something like the following would be better IMO:
BOOL langsDetectSucces = YES;
...
for (unsigned long i = 0; i < [languages count] && langsDetectSucces; ++i) {
if (language)
[acceptableLanguages addObject:language];
else {
...log...
langsDetectSucces = NO;
}
}
and then, instead of |if ([acceptLangHeader length] > 0)|, you can do a cleaner
check: |if (langsDetectSucces)|
As mentioned, optional; but readable code is a good thing ;)
>+ // If we understood all the languages in the list set the accept-language header.
>+ // Note that necko will determine quality factors itself
>+ if ([acceptableLanguages count] > 0) {
you may want to mention the "en-us, en" fallback here.
>+pref("intl.accept_languages", "en-us, en" );
please remove extra spcae ;)
otherwise, r=bugs.mano@mail-central.com.
Attachment #173655 -
Flags: review?(bugs.mano) → review+
Assignee | ||
Comment 13•21 years ago
|
||
Attachment #173655 -
Attachment is obsolete: true
Comment 14•21 years ago
|
||
bruce, i know you're going to kill me, but after looking at the code i agree
with mano about the loop. Rather than a break and clearing out the array, just
set a bool and check it as a loop condition and on the |if| before actually
setting the pref. It's cleaner overall, and faster in the fail case.
sorry!!!!!!!!! looks good otherwise.
Assignee | ||
Comment 15•21 years ago
|
||
Assignee | ||
Updated•21 years ago
|
Attachment #173669 -
Attachment is obsolete: true
Attachment #173758 -
Flags: superreview?(pinkerton)
Attachment #173758 -
Flags: review?(bugs.mano)
Comment 16•21 years ago
|
||
Comment on attachment 173758 [details] [diff] [review]
Patch addressing pinkerton's comments, and the bit of mano's that I missed
r=mano
Attachment #173758 -
Flags: review?(bugs.mano) → review+
Updated•21 years ago
|
Attachment #173655 -
Flags: superreview?(pinkerton)
Comment 17•21 years ago
|
||
+ if (languagesOkaySoFar && [acceptableLanguages count] > 0) {
nit. is there ever a case where |languagesOkaySoFar| is true but count is 0?
Comment 18•21 years ago
|
||
(In reply to comment #17)
> + if (languagesOkaySoFar && [acceptableLanguages count] > 0) {
>
> nit. is there ever a case where |languagesOkaySoFar| is true but count is 0?
When the language list is empty.
Comment 19•21 years ago
|
||
Comment on attachment 173758 [details] [diff] [review]
Patch addressing pinkerton's comments, and the bit of mano's that I missed
Bruce:
>+ BOOL languagesOkaySoFar = YES;
please change this to:
>+ BOOL languagesOkaySoFar = [languages count] != 0;
and this one:
>+ if (languagesOkaySoFar && [acceptableLanguages count] > 0) {
to
>+ if (languagesOkaySoFar) {
Comment 20•21 years ago
|
||
(
BOOL languagesOkaySoFar = [languages count] != 0;
if you ar wondering why, this expalins "we're note ok with an empty list, fail
to..."
)
Comment 21•21 years ago
|
||
comment 18 was wrong, there's no way to remove the last language, at least not
on 10.3 (this may or may not make my last two comments invalid... you could
probably just remove the |langauges > 0| check in the pref set part...
Assignee | ||
Comment 22•21 years ago
|
||
I don't think we should assume that Apple have sanitised the language list (or
that the user hasn't screwed with the XML) just to save ourselves a few bytes.
I don't mind whether we move the zero length check to above the array (as per
comment 19) or not, though personally I think the current form is more readable.
It avoids overloading the flag to mean "are all languages we've seen valid" and
"have we seen enough languages" at the same time. The overall amount of machine
code and clocks cycles to execute is identical between the two.
Comment 23•21 years ago
|
||
landed on trunk and branch
Status: ASSIGNED → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Updated•21 years ago
|
Attachment #173758 -
Flags: superreview?(pinkerton)
Updated•21 years ago
|
Target Milestone: --- → Camino0.9
Updated•21 years ago
|
Keywords: fixed1.7.6
Assignee | ||
Comment 24•20 years ago
|
||
*** Bug 283233 has been marked as a duplicate of this bug. ***
Comment 25•20 years ago
|
||
when I use camino's search bar it's going to the en-us site for me. verified
fixed using these camino builds on mac os x 10.3.8:
2005031008-trunk
20050212-0.8.3 branch
changing "fixed1.7.6" to "verified1.7.6" since I tested using a camino branch build.
Status: RESOLVED → VERIFIED
Keywords: fixed1.7.6 → verified1.7.6
Comment 26•20 years ago
|
||
mistakenly removed fixed1.7.6 --pardon the bugspam. set your filter/quicksearch
to "ZippidityDooDahHey" to catch these for easy removal/etc/
Keywords: fixed1.7.6
You need to log in
before you can comment on or make changes to this bug.
Description
•