1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-06-20 00:15:31 +00:00

Rename accelerator checking scripts.

This commit is contained in:
Kalle Olavi Niemitalo 2007-07-17 14:32:07 +03:00 committed by Kalle Olavi Niemitalo
parent 6117f8a164
commit e6a2430fb7
5 changed files with 93 additions and 99 deletions

View File

@ -46,8 +46,8 @@ HTML_DOCS-$(CONFIG_POD2HTML) += \
# Don't install these documents, because the corresponding scripts
# are not installed either. However, generating them may be useful.
HTML_DOCS_NOINSTALL-$(CONFIG_POD2HTML) += \
perl-check-accelerator-conflicts.html \
perl-gather-accelerator-contexts.html
perl-msgaccel-check.html \
perl-msgaccel-prepare.html
MAN_DOCS-$(CONFIG_XMLTO) += \
elinks.1 \

View File

@ -53,7 +53,7 @@ $(srcdir)$(POTFILES_ABS_LIST): $(POTFILES_REL)
find src/ -type f -name '*.[ch]' -o -name options.inc -o -name 'actions-*.inc' | sort ) \
> $(srcdir)$(POTFILES_ABS_LIST)
$(srcdir)$(PACKAGE).pot: $(srcdir)$(POTFILES_ABS_LIST) $(srcdir)perl/gather-accelerator-contexts.pl
$(srcdir)$(PACKAGE).pot: $(srcdir)$(POTFILES_ABS_LIST) $(srcdir)perl/msgaccel-prepare
$(XGETTEXT) --default-domain=$(PACKAGE) \
--directory=$(top_srcdir) \
--add-comments --language=C \
@ -77,7 +77,7 @@ $(srcdir)$(PACKAGE).pot: $(srcdir)$(POTFILES_ABS_LIST) $(srcdir)perl/gather-acce
--flag=N__:1:pass-c-format \
-f $(srcdir)$(POTFILES_ABS_LIST) \
&& test -f $(PACKAGE).po \
&& $(PERL) -I"$(srcdir)perl" $(srcdir)perl/gather-accelerator-contexts.pl -S"$(top_srcdir)" $(PACKAGE).po \
&& $(PERL) -I"$(srcdir)perl" $(srcdir)perl/msgaccel-prepare -S"$(top_srcdir)" $(PACKAGE).po \
&& mv -f $(PACKAGE).po $(srcdir)$(PACKAGE).pot
@ -111,7 +111,7 @@ check-po:
@-$(foreach lang,$(basename $(if $(strip $(PO)),$(PO),$(GMOFILES))), \
echo -n "$(lang): "; \
$(GMSGFMT) --check --check-accelerators="~" --verbose --statistics -o /dev/null $(srcdir)$(lang).po; \
$(PERL) -I"$(srcdir)perl" $(srcdir)perl/check-accelerator-conflicts.pl $(srcdir)$(lang).po; \
$(PERL) -I"$(srcdir)perl" $(srcdir)perl/msgaccel-check $(srcdir)$(lang).po; \
)
### Installation and distribution

View File

@ -21,21 +21,21 @@ When a programmer adds a translatable string to the C source code of
ELinks, and the string contains an accelerator, he should also add a
special "gettext_accelerator_context" comment that names the menu or
dialog box in which the string will be used. See the documentation of
gather-accelerator-contexts.pl for the details.
msgaccel-prepare for the details.
When a programmer or translator runs "make update-po" in the
elinks/po directory, gather-accelerator-contexts.pl reads the
"gettext_accelerator_context" comments in the source files and
generates "accelerator_context" comments in elinks.pot. Then,
msgmerge copies them from elinks.pot to *.po.
When a programmer or translator runs "make update-po" in the elinks/po
directory, msgaccel-prepare reads the "gettext_accelerator_context"
comments in the source files and generates "accelerator_context"
comments in elinks.pot. Then, msgmerge copies them from elinks.pot to
*.po.
When a translator edits a *.po file, she does not alter the
"accelerator_context" comments.
When a translator runs "make check-po" in the elinks/po directory,
check-accelerator-conflicts.pl reads the "accelerator_context"
comments in the *.po file, checks the accelerators in the
translations, and displays any conflicts it finds.
msgaccel-check reads the "accelerator_context" comments in the *.po
file, checks the accelerators in the translations, and displays any
conflicts it finds.
FILES
@ -43,12 +43,12 @@ FILES
See each file for copying conditions.
gather-accelerator-contexts.pl reads elinks.pot and the source files
to which it refers, and writes a new elinks.pot with information from
msgaccel-prepare reads elinks.pot and the source files to which it
refers, and writes a new elinks.pot with information from
"gettext_accelerator_context" comments.
check-accelerator-conflicts.pl reads just one *.po file and scans it
for conflicts. It does not access the C source files.
msgaccel-check reads just one *.po file and scans it for conflicts.
It does not access the C source files.
Locale/PO.pm was originally imported from Locale-PO-0.16 on CPAN, and
has since been patched to make it more suitable for these scripts.

View File

@ -7,11 +7,11 @@ use Locale::PO qw();
use Getopt::Long qw(GetOptions :config bundling gnu_compat);
use autouse 'Pod::Usage' => qw(pod2usage);
my $VERSION = "1.5";
my $VERSION = "1.6";
sub show_version
{
print "check-accelerator-conflicts.pl $VERSION\n";
print "msgaccel-check $VERSION\n";
pod2usage({-verbose => 99, -sections => "COPYRIGHT AND LICENSE",
-exitval => 0});
}
@ -208,32 +208,31 @@ __END__
=head1 NAME
check-accelerator-conflicts.pl - Scan a PO file for conflicting
accelerator keys.
msgaccel-check - Scan a PO file for conflicting accelerator keys.
=head1 SYNOPSIS
B<check-accelerator-conflicts.pl> [I<option> ...] F<I<language>.po> [...]
B<msgaccel-check> [I<option> ...] F<I<language>.po> [...]
=head1 DESCRIPTION
B<check-accelerator-conflicts.pl> is part of a framework that detects
conflicting accelerator keys in Gettext PO files. A conflict is when
two items in the same menu or two buttons in the same dialog box use
the same accelerator key.
B<msgaccel-check> is part of a framework that detects conflicting
accelerator keys in Gettext PO files. A conflict is when two items in
the same menu or two buttons in the same dialog box use the same
accelerator key.
The PO file format does not normally include any information on which
strings will be used in the same menu or dialog box.
B<check-accelerator-conflicts.pl> can only be used on PO files to which
this information has been added with B<gather-accelerator-contexts.pl>
or merged with B<msgmerge>.
B<msgaccel-check> can only be used on PO files to which this
information has been added with B<msgaccel-prepare> or merged with
B<msgmerge>.
B<check-accelerator-conflicts.pl> reads the F<I<language>.po> file
named on the command line and reports any conflicts to standard error.
It also tries to suggest replacements for the conflicting accelerators.
B<msgaccel-check> reads the F<I<language>.po> file named on the
command line and reports any conflicts to standard error. It also
tries to suggest replacements for the conflicting accelerators.
B<check-accelerator-conflicts.pl> does not access the source files to
which F<I<language>.po> refers. Thus, it does not matter if the line
B<msgaccel-check> does not access the source files to which
F<I<language>.po> refers. Thus, it does not matter if the line
numbers in "#:" lines are out of date.
=head1 OPTIONS
@ -243,10 +242,9 @@ numbers in "#:" lines are out of date.
=item B<--accelerator-tag=>I<character>
Specify the character that marks accelerators in C<msgstr> strings.
Whenever this character occurs in a C<msgstr>,
B<check-accelerator-conflicts.pl> treats the next character as an
accelerator and checks that it is unique in each of the contexts in
which the C<msgstr> is used.
Whenever this character occurs in a C<msgstr>, B<msgaccel-check>
treats the next character as an accelerator and checks that it is
unique in each of the contexts in which the C<msgstr> is used.
Omitting the B<--accelerator-tag> option implies
B<--accelerator-tag="~">. The option must be given to each program
@ -258,14 +256,13 @@ in the PO file.
=item B<--no-msgid-fallback>
Select how to check entries where the C<msgstr> is missing or fuzzy.
The default is B<--msgid-fallback>, which makes
B<check-accelerator-conflicts.pl> use the C<msgid> instead, and report
any conflicts between C<msgid> and C<msgstr> strings. The alternative
is B<--no-msgid-fallback>, which makes B<check-accelerator-conflicts.pl>
completely ignore such entries.
The default is B<--msgid-fallback>, which makes B<msgaccel-check> use
the C<msgid> instead, and report any conflicts between C<msgid> and
C<msgstr> strings. The alternative is B<--no-msgid-fallback>, which
makes B<msgaccel-check> completely ignore such entries.
Regardless of these options, B<check-accelerator-conflicts.pl> will
suggest accelerators that would conflict with ones defined in C<msgid>
Regardless of these options, B<msgaccel-check> will suggest
accelerators that would conflict with ones defined in C<msgid>
strings. Those strings will be eventually shadowed by C<msgstr>
strings, so their accelerators should not affect which accelerators
the translator chooses for C<msgstr> strings.
@ -278,8 +275,8 @@ the translator chooses for C<msgstr> strings.
=item F<I<language>.po> [...]
The PO files to be scanned for conflicts. These files must include the
"accelerator_context" comments added by B<gather-accelerator-contexts.pl>.
The PO files to be scanned for conflicts. These files must include
the "accelerator_context" comments added by B<msgaccel-prepare>.
If the special comments are missing, no conflicts will be found.
=back
@ -296,9 +293,9 @@ If the special comments are missing, no conflicts will be found.
=head2 Waiting for Locale::PO fixes
When B<check-accelerator-conflicts.pl> includes C<msgstr> strings in
warnings, it should transcode them from the charset of the PO file to
the one specified by the user's locale.
When B<msgaccel-check> includes C<msgstr> strings in warnings, it
should transcode them from the charset of the PO file to the one
specified by the user's locale.
=head1 AUTHOR
@ -335,4 +332,4 @@ DEALINGS IN THE SOFTWARE.
=head1 SEE ALSO
L<gather-accelerator-contexts.pl>, C<xgettext(1)>, C<msgmerge(1)>
L<msgaccel-prepare>, C<xgettext(1)>, C<msgmerge(1)>

View File

@ -8,11 +8,11 @@ use Getopt::Long qw(GetOptions :config bundling gnu_compat);
use autouse 'Pod::Usage' => qw(pod2usage);
use autouse 'File::Spec::Functions' => qw(catfile);
my $VERSION = "1.1";
my $VERSION = "1.2";
sub show_version
{
print "gather-accelerator-contexts.pl $VERSION\n";
print "msgaccel-prepare $VERSION\n";
pod2usage({-verbose => 99, -sections => "COPYRIGHT AND LICENSE",
-exitval => 0});
}
@ -168,24 +168,24 @@ __END__
=head1 NAME
gather-accelerator-contexts.pl - Augment a PO file with information
for detecting accelerator conflicts.
msgaccel-prepare - Augment a PO file with information for detecting
accelerator conflicts.
=head1 SYNOPSIS
B<gather-accelerator-contexts.pl> [I<option> ...] F<I<program>.pot>
B<msgaccel-prepare> [I<option> ...] F<I<program>.pot>
=head1 DESCRIPTION
B<gather-accelerator-contexts.pl> is part of a framework that detects
conflicting accelerator keys in Gettext PO files. A conflict is when
two items in the same menu or two buttons in the same dialog box use
the same accelerator key.
B<msgaccel-prepare> is part of a framework that detects conflicting
accelerator keys in Gettext PO files. A conflict is when two items in
the same menu or two buttons in the same dialog box use the same
accelerator key.
The PO file format does not normally include any information on which
strings will be used in the same menu or dialog box.
B<gather-accelerator-contexts.pl> adds this information in the form of
"accelerator_context" comments, which B<check-accelerator-conflicts.pl>
The PO file format does not normally include any information
on which strings will be used in the same menu or dialog box.
B<msgaccel-prepare> adds this information in the form of
"accelerator_context" comments, which B<msgaccel-check>
then parses in order to detect the conflicts.
The PO file format also does not directly support definitions of
@ -194,17 +194,17 @@ strings, by placing a tilde in front of the character that should be
used as the accelerator key. That is also the syntax supported by
this framework and by B<msgfmt --check-accelerators> of GNU Gettext.
B<gather-accelerator-contexts.pl> first reads the F<I<program>.pot>
file named on the command line. This file must include "#:" comments
that point to the source files from which B<xgettext> extracted each
C<msgid>. B<gather-accelerator-contexts.pl> then scans those source
files for context information and rewrites F<I<program>.pot> to
include the "accelerator_context" comments. Finally, the standard
tool B<msgmerge> can be used to copy the added comments to all the
B<msgaccel-prepare> first reads the F<I<program>.pot> file named on
the command line. This file must include "#:" comments that point
to the source files from which B<xgettext> extracted each C<msgid>.
B<msgaccel-prepare> then scans those source files for context
information and rewrites F<I<program>.pot> to include the
"accelerator_context" comments. Finally, the standard tool
B<msgmerge> can be used to copy the added comments to all the
F<I<language>.po> files.
It is best to run B<gather-accelerator-contexts.pl> immediately after
B<xgettext> so that the source references will be up to date.
It is best to run B<msgaccel-prepare> immediately after B<xgettext>
so that the source references will be up to date.
=head2 Contexts
@ -249,17 +249,16 @@ formatted like this:
[gettext_accelerator_context()]
ends the region. */
B<gather-accelerator-contexts.pl> removes from F<I<program>.pot> any
B<msgaccel-prepare> removes from F<I<program>.pot> any
"gettext_accelerator_context" comments that B<xgettext --add-comments>
may have copied there.
may have copied there.
B<gather-accelerator-contexts.pl> warns if it does not find any
contexts for some use of an C<msgid> that contains the character
specified with the B<--accelerator-tag> option. If the character does
not actually indicate an accelerator in that C<msgid> (e.g. "~" in
"~/.bashrc"), the warning can be silenced by specifying the special
context "IGNORE", which B<gather-accelerator-contexts.pl> otherwise
ignores.
B<msgaccel-prepare> warns if it does not find any contexts for some
use of an C<msgid> that contains the character specified with the
B<--accelerator-tag> option. If the character does not actually
indicate an accelerator in that C<msgid> (e.g. "~" in "~/.bashrc"),
the warning can be silenced by specifying the special context
"IGNORE", which B<msgaccel-prepare> otherwise ignores.
=head1 OPTIONS
@ -270,15 +269,14 @@ B<--source-directory=>F<I<srcdir>>
The directory to which the source references in "#:" lines are
relative. Each use of this option adds one directory to the search
path. If you do not specify this option,
B<gather-accelerator-contexts.pl> implicitly searches the current
directory.
path. If you do not specify this option, B<msgaccel-prepare>
implicitly searches the current directory.
=item B<--accelerator-tag=>I<character>
Specify the character that marks accelerators in C<msgid> strings.
B<gather-accelerator-contexts.pl> looks up accelerator contexts for
any C<msgid> that contains this character.
B<msgaccel-prepare> looks up accelerator contexts for any C<msgid>
that contains this character.
Omitting the B<--accelerator-tag> option implies
B<--accelerator-tag="~">. The option must be given to each program
@ -293,24 +291,23 @@ in the PO file.
=item F<I<program>.pot>
The file to augment with context information.
B<gather-accelerator-contexts.pl> first reads this file and then
overwrites it.
The file to augment with context information. B<msgaccel-prepare>
first reads this file and then overwrites it.
Although this documentation keeps referring to F<I<program>.pot>,
you can also use B<gather-accelerator-contexts.pl> on an already
translated F<I<language>.po>. However, that will only work correctly
if the source references in the "#:" lines are still up to date.
you can also use B<msgaccel-prepare> on an already translated
F<I<language>.po>. However, that will only work correctly if the
source references in the "#:" lines are still up to date.
=back
=head1 BUGS
B<gather-accelerator-contexts.pl> assumes that source files are in
the C programming language: specifically, that a closing brace at
the beginning of a line marks the end of a function.
B<msgaccel-prepare> assumes that source files are in the C programming
language: specifically, that a closing brace at the beginning of a
line marks the end of a function.
B<gather-accelerator-contexts.pl> doesn't check whether the
B<msgaccel-prepare> doesn't check whether the
"gettext_accelerator_context" comments actually are comments.
=head1 AUTHOR
@ -348,4 +345,4 @@ DEALINGS IN THE SOFTWARE.
=head1 SEE ALSO
L<check-accelerator-conflicts.pl>, C<xgettext(1)>, C<msgmerge(1)>
L<msgaccel-check>, C<xgettext(1)>, C<msgmerge(1)>