Closed Bug 291689 Opened 19 years ago Closed 19 years ago

compare-locales.pl doesn't report missing entity

Categories

(Core :: Internationalization: Localization, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: p.franc, Assigned: kairo)

Details

Attachments

(1 file, 2 obsolete files)

compare-locales.pl doesn't report recently introduced entity "error-203" in
xpinstallConfirm.properties (see http://tinyurl.com/a3bcs)

Either Ben is abusing the syntax and there should be no "-" in the entity or the
"-" is missing in the regexp in 
http://lxr.mozilla.org/seamonkey/source/toolkit/locales/compare-locales.pl#108
The parser only terminates the key with "=" or ":", everything else is included
(though it trims leading and trailing spaces and tabs). This seems to be exactly
as specified in the Java property file documentation, so the "-" is completely
valid.

Patch in a second.
Attached patch Allow all valid keys (obsolete) — Splinter Review
Changes the regexp to accept all keys accepted by the parser, and excludes
comment lines (those start with "#" or "!") explicitly, which would otherwise
be included.
Attachment #181689 - Flags: review?(benjamin)
Attachment #181689 - Flags: review?(benjamin)
Attachment #181689 - Flags: review+
Attachment #181689 - Flags: approval1.8b2+
I tried the patch and noticed that some comments are not excluded. It seems that
comment lines (that starts with a "#") preceded by a blank line are not ignored.
Indeed, though all the existing comments have no whitespace before them; new
patch in a sec.
Attached patch Exclude comments properly (obsolete) — Splinter Review
Attachment #181689 - Attachment is obsolete: true
Attachment #181695 - Flags: review?(benjamin)
(In reply to comment #5)
> Created an attachment (id=181695) [edit]
> Exclude comments properly

Unfortunately this does not work either. Multiline properties are parsed badly.

[code]
5093=Unable to connect to your IMAP server. You may have exceeded the maximum
number \
of connections to this server. If so, use the Advanced IMAP Server Settings
dialog to \
reduce the number of cached connections.

## @name IMAP_QUOTA_STATUS_FOLDERNOTOPEN
## @loc None
5095=Quota information is not available because the folder is not open. 
[/code]

is parsed as a two keys "5093" and "of connections to this server. If so, use
the Advanced IMAP Server Settings dialog to \
reduce the number of cached connections.

## @name IMAP_QUOTA_STATUS_FOLDERNOTOPEN
## @loc None
5095"
Comment on attachment 181695 [details] [diff] [review]
Exclude comments properly

We don't need to be a perfectly valid properties parser, just enough not to
barf on the actual constructs we use in the code and generated by mozilla
translator.
Attachment #181695 - Flags: review?(benjamin)
Attachment #181695 - Flags: review+
Attachment #181695 - Flags: approval1.8b2+
*sigh*

Need to exclude \r and \n from both negative character groups.

Third time's the charm!
Attachment #181695 - Attachment is obsolete: true
Attachment #181700 - Flags: review?(benjamin)
Comment on attachment 181700 [details] [diff] [review]
Exclude those arcused newlines too!

I'm not so sure about this one. Wouldn't you need to unescape the backslashes
or somesuch to properly check for multiline?
No - the original version ignored any line without a ":" or an "=" in it. By
changing from a positive charcter group to a negative one, I'd accidentally let
new-lines be part of the key, which is where it got upset on multiline ones.

FOO=bar \
baz
QUX=quxx

...would be parsed as "FOO" and "baz\nQUX" in the 2nd patch, but correctly as
"FOO" and "QUX" in the 3rd.
> ...would be parsed as "FOO" and "baz\nQUX" in the 2nd patch, but correctly as
> "FOO" and "QUX" in the 3rd.

this one works for me - both cygwin perl, AS perl
Attachment #181700 - Flags: review?(benjamin)
Attachment #181700 - Flags: review+
Attachment #181700 - Flags: approval1.8b2+
Checked in --> FIXED.
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: