home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magazyn Exec 5
/
CD_Magazyn_EXEC_nr_5.iso
/
Recent
/
dev
/
misc
/
catcheck.lha
/
catcheck.doc
< prev
Wrap
Text File
|
2001-06-07
|
24KB
|
621 lines
--------------
catcheck 1.4
--------------
About catcheck
==============
What?
-----
catcheck is a tool to test catalog files. Catalog files are used on the Amiga
by applications to display strings in your native language rather than only a
fixed build-in like English.
catcheck finds a large number of common and not so common errors (which can
be quiet annoying:). While most of these errors are human-made, there are
also some that have their origin in buggy catalog compilers. An exotic
example is the #lengthbytes command, which is, to my knowledge, only
supported by C='s own catalog compiler, catcomp. All other compilers
either complain about an unsupported command or, even worse, ignore
it completely and produce somewhat unusable catalogs.
Examples for human-made errors are missing or removed strings, wrong
placement or order of arguments (%s, %1$s and that stuff) and the use
of escaped characters like \", \n etc and the string-continues-on-next-
line-marker backslash.
Why?
----
catcheck's birth was in late 1999. During the translation process of the
catalogs for AmigaOS 3.5, I had a few problems coordinating the work since
we did not get the final catalog sources but update after update appeared,
each one with a new string here and a modified one there.
All in all, it must have been several hundred catalogs to take care of.
Since there was some disagreement about the version string build into
the catalogs (some used it, some not, some in a way I could not use it)
and since this version stuff is insecure anyway (as you'll see in a few
seconds), I wrote a small tool to test if all strings from the original
source also appear in the translation: catcheck.
The result was rather disappointing: although I checked all files by
version number and file date several of the files I thought were up-to-date
turned out to be one or more versions behind the current release - that much
for "I'm sure" :]
Well, we luckily got that project back on track (only to see it crash
elsewhere;) which would not have been possible without catcheck.
catcheck has been improved since then and showed its power during the
AmigaOS 3.9 translation once more.
Legal
=====
catcheck has been written by Sönke Tesch <soenke@kino-fahrplan.de>.
catcheck is copyrighted software and may be distributed for free only.
Commercial distribution of any kind requires the written agreement of
the author.
I do not give any warranties that catcheck works as described or expected.
More exactly, I'm sure that there are some things that need to be improved.
However, it's been in use by me for more than year now and by several other
people for quite some time, too, and should work fine. If you find any bugs,
please contact me.
Using catcheck
==============
Note: The terms "description", "translation" and "catalog" usually refer to
the corresponding files ending in ".cd", ".ct" and ".catalog".
CATNAME/M,CDDIR,CTDIR,CATDIR,ALL/S,STATUS/K,DUMPSTRING/K,DUMP/S,DUMPCT/K:
CATNAME/A/M = name of the catalog file without extension.
CDDIR = Directory in which to look for catalog description (.cd).
Defaults to / (parent of current directory).
CTDIR = Directory in which to look for catalog translation (.ct).
Defaults to current directory.
CATDIR = Directory in which to look for catalog (.catalog).
Defaults to current directory.
ALL/S = Check all directories.
STATUS/K = Print status information to this file.
File will be created only if there is some status info available!
DUMPSTRING/K = Show strings from all files with this id.
DUMP/S = Print out contents of each catalog.
DUMPCT/K = Create catalog translation file from catalog.
The above extended help text is also available on the command line. Type
"catcheck ?" and, at the prompt, "?" once again.
Notes on the arguments:
ALL and STATUS may not yet work completely.
ALL should be used to automatically check all catalogs in all subdirectories,
for example all the files you see in the directory listing below.
I've implemented DUMP and DUMPCT just to test if catcheck correctly loads the
files and don't know if they might be usable for day to day work.
DUMPSTRING accepts both numbers and names. It will however fail if the name
of a string is "10" since it'll expect you seek for a string with the id
value of 10. Better fix the description file in this case and use meaningful
names for your strings.
If you are using the directory structure the system uses, i.e. something like
EggPaint/catalogs
EggPaint.cd
EggPaint/catalogs/deutsch
EggPaint.ct EggPaint.catalog
EggPaint/catalogs/italiano
EggPaint.ct EggPaint.catalog
EggPaint/catalogs/català
EggPaint.ct EggPaint.catalog
you can simply make EggPaint/catalogs/[language] your current directory
and enter "catcheck eggpaint". catcheck will find all files needed.
DUMPCT
------
The DUMPCT-feature allows you to create a translation-file from an existing
description/catalog-pair.
Although you can theoretically create a catalog from this new translation,
you should not do so without checking the translation first. This has two
good reasons:
1) DUMPCT will create the translation file based on the data -exactly- as
it appears in the catalog. This effectivly means that if your catalog
is broken, your translation will be, too.
One thing you will probably notice often is quite some strings appear
with up to three \x00's at the end.
Strings in a catalog are stored in a large block of repeating id, length
and data (text) sequences. Since each of these sequences has to start at
an even position, you have to add padding or 0-bytes (\x00) at the end of
your data until you are at an even position. So if your string is 3 bytes
long you need to add 1 extra byte to get at the even position of 4.
Too my knowledge it is not cleary defined what 'length' has to be in this
case. Some catalog compilers store the true length (3 in your example),
some store the length including the padding bytes at the end (4). In the
latter case you will get the \x00's from DUMPCT since there is no way to
find out if the \x00's have been placed there by the translator or by the
catalog compiler.
Both variants work with locale.library, however.
2) Strings that do not exist in the catalog, either because the description
has been updated after the catalog was created (i.e. the catalog is
outdated) or because they have been removed during optimization (i.e.
they are the same in description and translation), are taken from the
description.
In the latter case this is perfectly ok, however in the first case you
will end up with a catalog that is only half translated.
Errors and Warnings
===================
While loading and checking the files, catcheck sends error messages to its
output, one message per line. Some of these messages will not fit into one
line of your cli window, so it's probably a good idea to redirect the output
to a file and use MultiView or similar to have a look at it later.
Note that..
..the same problem might cause more than one error message.
..one string may contain more than one error but only the first is displayed
because parsing stopped after the first error appeared.
Therefore you will need to use catcheck once, fix the bugs, re-compile and
call catcheck again.
Watch out! During the year of its existence, several people complained about
catcheck reporting bugs at places that are "absolutly correct". I won't say
that these complains were always wrong but I actually cannot remember one
that was right.
So, from this point of view, and although I hate to say things like that,
I'd state that catcheck cannot be fooled easily - if catcheck reports a bug,
there is something to take care of.
The following list is a more or less complete one showing what catcheck
might find. It's an old one however, some messages have disappeared or
been modified, some new have been added.
Version
-------
[file], version "[versionstring]", pos [position]: missing revision value.
The version from this file does not have a revision. The revision was expected
after the "." at the given position.
[file], version "[versionstring]", pos [position]: version date missing, incorrect
or in an illegal form.
Check that the date part of the version string looks like "(day.month.year)", e.g.
"(2.9.89)" or "(18.8.2000)". The problem is at the given position.
[file], version "[versionstring]", pos [position]: missing '$VER:'.
Standard Amiga version strings start with $VER:.
[file], version "[versionstring]", pos [position]: expected version number.
We're expecting a version in front of the "." at the given position.
[file], version "[versionstring]", pos [position]: missing or incorrect version string.
Couldn't parse the version at all.
(Description|Translation|Catalog) has no version.
As it says, no version information found.
Translation version [version] doesn't match description version [version].
You are using different versions of translation and description files.
No object name in version string.
Object name '%s' in version string doesn't end with '.catalog'.
Object name '%s' in version string doesn't match real catalog name.
The name part of the version string should be the catalogs' name.
Most common problem is case #2: People enter "EggPaint.ct" in the version
string of the .ct-file, which might seem correct and logical at first.
However, this version string is copied 1:1 to the catalog and therefore the
catalog will also report "EggPaint.ct". You'll get the "doesn't end with
'.catalog'"-message then.
To fix this, change the name in the version string in the .ct-file to
"EggPaint.catalog".
Reading the files
-----------------
[file], line [linenumber], pos [position]: [error] - read [token]: `[buffer]`"
Various syntax errors during parsing.
[file], line [linenumber]: expected string id, found nothing.
error
We expected a string id in this line, but found absolutly nothing.
[file], line [linenumber], pos [position]: command missing after ##.
error
Commands in translation and description files start with # or ##. We have a # or ##
here, but no command.
[file], line [linennumber], pos [position]: language name missing after ##language.
No language given here.
[file], line [linenumber], pos [position]: string id may not contain spaces: `[buffer]`.
We expected a string id in [buffer], but the string contains spaces.
[file], line [linenumber], pos [position]: string [id] continues with a ; as first
character. Was this a comment?
In translation files, you can split strings up into several lines by placing
a \ at the end of a line. Example:
MSG_EXAMPLE
This is \
a long string.
; \-demo
This will result in "This is a long string." in the catalog.
One in a while it happens that the last part is removed ("a long string." here)
but that person forgets to remove the "\". That will result in the comment line
being appened to the real string: "This is ; \-demo" will appear in the catalog.
catcheck will warn you if it encounters a ";" as the first character on a line
after the last line had a "\" at its end.
Checking RawDoFmt
-----------------
This routine may still be confused with strings that are used with FormatDate() instead
of FormatString or RawDoFmt.
[string_id] in [file], line [linenumber], pos [position]: must use argument positioning.
locale.library's FormatString may re-arrange the arguments. If this option is used
for one argument, it must be used for all others, too.
This error appears if catcomp first encountered an argument without positioning and
now found one with positioning.
[string_id] in [file], line [linenumber], byte [position]: argument positioning not allowed.
This is nearly the same as the error above, but in this case catcomp first found an
argument with positioning and now found one without.
[string_id in [file], line [linenumber], pos [position]: argument position must be at least 1
The argument positions used with FormatString start at 1, not at 0.
[string_id] in [file], line [linenumber], byte [position]: missing field limit after ".".
The maximum number of characters FormatString/RawDoFmt may send to the output may be
limited by a value. The "." that announces this value is there, but the value not.
[string_id] in translation, line [linenumber]: argument [count] from description is missing.
The original text in the description file had more arguments than the text in the
translation. This is not serious, but the user may miss information.
[string_id] in translation, line [linenumber]: argument [count] is not in description.
Same as above, but this time the argument [count] which is in the translation was not
in the original text in the description file. This is a serious bug which may trash
the text that should be displayed to the user.
[string_id] in description, line [linennumber], and translation, line [linenumber]: types
of argument [count] are not the same ([type1] vs [type2]).
Serious bug. May appear if, e.g., in the original a value should be inserted in the
text but in the translation a string is output at the same position.
[string_id] in description, line [linenumber], and translation, line [linenumber]: input
data lengths of argument [count] are not the same.
In the original a longword was specified, in the translation only a word (or the other
way round). Will mix up the arguments and trash the output.
[string_id] in description, line [linenumber], and translation, line [linenumber]: field
widths of argument [count] are not the same.
[string_id] in description, line [linenumber], and translation, line [linenumber]: field
limits of argument [count] are not the same.
Will only mean that the output of the translation is a bit more left or right than
it was in the original. No big deal after all - had some spare time when writing
this part of catcheck ;)
Checking translation vs. description
------------------------------------
[string_id] in description, line [linennumber], exists more than one time.
There are more than one string with the name [string_id] in your description file.
[string_id] (description line [linenumber]) is missing in translation.
This string was specified in the description but is not in your translation file.
All strings that are in the description should appear in the translation, even if
they are the same.
You are probably using an old version of the translation file.
[string_id] in translation, line [linennumber], must be no shorter than [min] bytes (has [length]).
This string has a minimum limit of [min] characters defined in the description
file but your translation has only [length] bytes and thus is too short.
[string_id] in translation, line [linennumber], must be no longer than [max] bytes (has [length]).
This string has a maximum limit of [max] characters defined in the description
file but your translation has [length] bytes and thus is too long.
[string_id] in description, line [linenumber], was 0 bytes long. Translation, line
[linennumber], has [length] bytes.
No text was specified in the description for this string but there is some text
in the translation. This usually appears if the programs' author added some optional
fields in the catalog that e.g. may be used for extra menu shortcuts in translations.
No text in translation, line [linenumber], for [string_id] from description, line [linenumber].
Some text was given in the description file, but there is nothing in the translation.
You most likely updated the translation file with your catalog compiler and did not
yet translate all of the new strings.
[string_id] in description, line [linenumber], has [num] trailing spaces. In translation,
line [linenumber], it has [num].
The original text had some spaces at its end, maybe used to make some table. The
translation has no spaces and thus the full output may look weird.
This problem appears if you are using a text editor to translate the translation
file and you text editor automatically strips the spaces at the end of each line.
This message may be followed by "Both have same length, though.", which makes it
a warning instead of an error.
[string_id] in translation, line [linenumber], exists more than one time in translation.
There are more than one string with the name [string_id] in your translation file.
[string_id] from translation, line [linenumber], does not exist in description.
A string with this id does not exist in the description file. You are most
likely using an outdated translation file.
Catalog version [version] doesn't match translation version [version].
Catalog and translation file versions must match exactly. Note: this means only
the version does not match. catcheck and locale.library do not care about the
revision.
Catalog version [version] doesn't match description version [version].
Catalog and description file versions must match exactly. Note: this means only
the version does not match. catcheck and locale.library do not care about the
revision.
[string_id] (description line [linenumber]) is not in catalog although original and
translation are not the same.
Strings that are the same in the original (i.e. build-in) string and in its
translation must not appear in the catalog file.
However this string is not the same in original and translation but does not
appear in the catalog file.
[string_id] (description line [linenumber]), is not in catalog.
Same as above, but appears if the translation file was not found or couldn't
be loaded for some other reason.
[string_id] in catalog doesn't match same string in translation, line [linenumber].
Oops, this should be the same in translation and catalog as the catalog has
been compiled from the translation. Different files?
[string_id] in catalog (description line [linenumber]):
- compiler didn't store length in first [reallength] bytes.
- stored length of [storedlength] doesn`t match real length of [reallength] bytes.
With the command #lengthbytes it is possible to store the length of a string
in its first 1 to 4 bytes. This kind of string is called a b-string, used in
the programming language BCPL.
Unfortunatly there seems to be no catalog compiler that supports this command
except C='s catcomp. Even worse, some compilers simply forget about that, no
warning, nothing.
If the catalog has been generated by such a compiler, you'll get the first
of the two errors above. catcheck will recognize if the first bytes are used
for the size of the string or are actually part of the string.
You will see the second error if the stored length is definitly incorrect
and has not just been forgotten.
If the stored length is seems to be incorrect but the remaining bytes of
the string (the rest starting at stored length position upto the real end)
contains nothing, i.e. only 0C/0x0, the second message will be extended with
"Only 0Cs in [length] trailing bytes though.".
First two cases are serious bugs, last case is nothing to worry about.
String [string_id] in catalog is not in description and not in translation.
This string has not been defined in the description nor in the translation.
The catalog has most likely not been made from the description and
translation files you have.
String [string_id] in catalog is not in description, but in translation as [string_id].
This string has not been defined in the description file, but it is in the
translation file.
This means that the catalog has been made from the translation file, but
with the help of a description file other than the one you have.
String [string_id] in catalog (named [string_name] in description) exists more than one time.
String [string_id] in catalog exists more than one time.
This error appears if the string with the number [string_id] exists more than
one time in the catalog file.
If there is no string with this id value in the description file, you'll get the
second error message instead of the first.
History
=======
1.4 Aminet release (Aminet release 1.2 had a broken readme)
---
- DUMPTCT
- Now dumps a complete ##version-command to the output file, including name and
date, not just the version.revision-pair.
- \n\r-sequences are printed as "\n\r\"+newline, not "\n\"+newline+"\r".
- Original strings are completely commented, not just the first line.
- catcheck's version was not readable with c:version because another string
containing a $VER: appeared before the real version string in the executable.
Oops.
- Translation/catalog string comparison went one byte too far.
- If the stored length of a string is longer than the maximum allowed and the part
between the max and the defined length is filled with 0x00's, no "String too
long" error will be printed anymore.
This reduces the error list for catalogs where the stored length of a string
does not match the real length because padding bytes at the end where counted
by the compiler, too.
- Prints a warning if a string in the translation continues with a ; on the next
line. This might be a comment and someone forgot to remove the / one line up.
1.3
---
- Catalog version name variable was not cleared between tests of two catalogs.
1.2 Aminet release
---
- Added checking of the name part of the catalogs' version string.
1.1
---
- DUMPTCT did not work correctly (and is still not fully tested).
1.0
---
- LoadCatalog() treated pad-bytes in the catalog STRS-chunk as being part of
the string and thus recorded the wrong string length.
- DUMPSTRING treated arguments like MSG_42 as number instead of name.
- Errors during file loading (read: DOS errors) now appear in line with the
other errors.
- Now "only" needs 8k of stack. Unfortunatly this means that it can only
handle strings up to 2k in length instead of the previous 4k, but your
editor will probably break down on that long lines anyway :)
0.5
---
- Did not check description file if translation could not be loaded -> buggy
description files were reported to be ok.
- DUMPCT did not print default string if there was no translation in catalog
- DUMPCT did not place the whole original string into comments but only
the first line
0.4
---
- New arguments CD, CT and CATALOG allow checking of specific files.
- Errors are no longer reported at the time they are found but collected and
printed after all checking is done. This way file load errors do not appear
before file status line is printed.
- Pattern matching works for now CATNAME.
0.3
---
- Parsing of octal escape characters (\nnn) still did not work. If there were
less than three numbers (\nn or \n) the resulting value was 8 times as big
as it should have been. Never liked that octal numbering system anyway ;)
- DUMPSTRING didn't recognize special escape characters like \n and displayed
them as hex values ("\x0A").
- catcheck's own version was not readable by c:version because some other
strings (actually error messages) that contained "$VER:" appeared first in
the executable - bad luck.
0.2
---
- Argument positions displayed in error messages for wrong RawDoFmt-strings were
to small by 1.
- Parsing of escaped characters using hex numbers (\xnn) was completely broken.
- For octal placeholders (\nnn) always four characters were removed/replaced, even
if the octal value was only something like \0 or similar.
- Did not accept dates in version string with a year value >100 (usually 4-digit years).
Still to do:
------------
- Stack-hungry.
- If a problem with escaped characters using hex or octal numbers appears, the
position catcheck reports is wrong - it's the one in the internal buffer, not
in the original text.