7.6. Checking TemplatesΒΆ

This step is important because if you have a wrong syntax in your template, this will break the user interface.

So, you need to get either the source tarball of the version you currently localize or to clone locally the Git repository matching your version.

To get the source with Git, run the following command:

git clone --branch bugzilla-X.X-stable https://git.mozilla.org/bugzilla/bugzilla

replacing "X.X" with the 2-digit version number of the stable release of Bugzilla that you want -- e.g. "5.0".

To get the tarball, go on the releases page of bugzilla.org site, download the version you want and uncompress it on your computer.

Then, you can create a symbolic link towards your localized templates in the template/ directory or just copy your localized templates directory here:

cd /your_bugzilla_directory/template
ln -s /path_to_your_localized_templates/ab-CD ab-CD

Replace here ab-CD with your locale code.

You can see the checking scripts in the t/ subdirectory in your Bugzilla root directory.

To check the localized templates, you would only need to run these three ones:

t/004template.t

t/008filter.t

t/009bugwords.t

prove -Q t/004template.t

If your templates are valid, you should see a result like this:

t/004template.t .. ok
All tests successful.
Files=1, Tests=1236,  5 wallclock secs ( 0.11 usr  0.00 sys +  4.70 cusr  0.05 csys =  4.86 CPU)
Result: PASS

If something went wrong, you will see something like this:

#   Failed test 'template/fr/default/index.html.tmpl has bad syntax --ERROR'
#   at t/004template.t line 106.
# Looks like you failed 1 test of 1236.

Test Summary Report
-------------------
t/004template.t (Wstat: 256 Tests: 1236 Failed: 1)
  Failed test:  671
  Non-zero exit status: 1
Files=1, Tests=1236,  4 wallclock secs ( 0.09 usr  0.01 sys +  4.74 cusr  0.04 csys =  4.88 CPU)
Result: FAIL

where you would hopefully see the faulty template and the line number where the error occurred.

Then, fix the error and run the scripts again.

Note

The following Perl modules are needed to run these scripts: Math::Random::ISAAC Email::Address Email::MIME Email::Sender::Simple JSON::XS File::Slurp DateTime::TimeZone DBI Template

On Debian, run the following command to install them:

sudo apt-get install libmath-random-isaac-perl libemail-address-perl libemail-mime-perl libemail-sender-perl libjson-xs-perl libfile-slurp-perl libdatetime-timezone-perl libdbi-perl libtemplate-perl


This documentation undoubtedly has bugs; if you find some, please file them here.

Previous topic

7.5. Localizing The bzLifecycle.png File

Next topic

7.7. Keeping Templates And Documentation Up-to-date