Bugzilla:L10n:Guide: Difference between revisions

Jump to navigation Jump to search
(→‎Terminology: First draft)
Line 80: Line 80:
and create your localized Bugzilla glossary.
and create your localized Bugzilla glossary.


=== Translate templates ===
=== Localizing Templates ===
 
The template files are identified by the extension ''.tmpl''. The are generated with Template Toolkit.<br>
Currently, these templates contain code and localizable strings mixed together that makes the localization of Bugzilla a bit difficult: what is to be localized and what is not?<br>
<pre>
IMPORTANT: Use an UTF8 compliant editor like Gedit, Kate or Emacs under GNU/Linux systems
or Notepad++ under Windows systems and localize the templates using
UTF8 encoding.
</pre>
Here are some examples to help you localizing the right stuff:<br>
A good idea is to start with the localization of ''/template/en/default/global/variables.none.tmpl''. This file contains several terms that will be substituted all around the templates files. You can see in this file lines like these:<br>
<pre>
[%# 1.0@bugzilla.org %]
[%# The contents of this file are subject to the Mozilla Public
  # License Version 1.1 (the "License"); you may not use this file
</pre>
DO NOT translate text located after the character ''#'': the text located after this character is comment.
 
<pre>
[% terms = {
  "bug" => "bug",
  "Bug" => "Bug",
  "abug" => "a bug",
  "Abug" => "A bug",
  "ABug" => "A Bug",
  "bugs" => "bugs",
  "Bugs" => "Bugs",
  "zeroSearchResults" => "Zarro Boogs found",
  "bit" => "bit",
  "bits" => "bits",
  "Bugzilla" => "Bugzilla"
  }
%]
</pre>
DO NOT translate ''terms'' here.
What is to be translated here, is the word after ''=>''.<br>
For instance:<br>
<pre>
  "Bug" => "Bogue",
</pre>
These terms will be used in the templates. Whenever you see expressions like ''$terms.ABug'' or ''$terms.bugs'' in templates, they will be replaced in the user interface with the value you put in this file.<br>
 
Another file that is use by several templates is ''/template/en/default/global/field-descs.none.tmpl''. You can see there lines like these:<br>
<pre>
[% PROCESS global/variables.none.tmpl %]
 
 
[% field_descs = { "[Bug creation]"      => "[$terms.Bug creation]",
                  "actual_time"          => "Actual Hours"
                  "alias"                => "Alias",
                  "assigned_to"          => "Assignee",
 
......
 
[% USE Bugzilla %]
[% FOREACH bz_field = Bugzilla.get_fields() %]
  [% SET field_descs.${bz_field.name} = bz_field.description
    IF !field_descs.${bz_field.name}.defined %]
[% END %]
</pre>
 
DO NOT translate here ''PROCESS'' or ''USE''. As a general rule, never translate capitalized words enclosed between ''<nowiki>[% and %]</nowiki>''.<br>
As previoulsly, translate the word after the ''=>''.<br>
 
<pre>
[% PROCESS global/variables.none.tmpl %]
 
[% field_descs = { "[Bug creation]"      => "[Date de création du $terms.bug]",
                  "actual_time"          => "Heures actuelles"
                  "alias"                => "Alias",
                  "assigned_to"          => "Responsable",
......
 
[% USE Bugzilla %]
[% FOREACH bz_field = Bugzilla.get_fields() %]
  [% SET field_descs.${bz_field.name} = bz_field.description
    IF !field_descs.${bz_field.name}.defined %]
[% END %]
</pre>
 
Now, you can start translating the other templates.
Some other examples of what need to be translated:<br>
<pre>
[% title = BLOCK %]Delete Component '[% comp.name FILTER html %]'
of Product '[% product.name FILTER html %]'
  [% END %]
 
[% PROCESS global/header.html.tmpl
  title = title
%]
 
<table border="1" cellpadding="4" cellspacing="0">
<tr bgcolor="#6666FF">
  <th valign="top" align="left">Field</th>
  <th valign="top" align="left">Value</th>
</tr>
</pre>
Localized example:<br>
<pre>
[% title = BLOCK %]Suppression du composant « [% comp.name FILTER html %] »
du produit « [% product.name FILTER html %] »
  [% END %]
 
[% PROCESS global/header.html.tmpl
  title = title
%]
 
<table border="1" cellpadding="4" cellspacing="0">
<tr bgcolor="#6666FF">
  <th valign="top" align="left">Champ</th>
  <th valign="top" align="left">Valeur</th>
</tr>
</pre>
TBD : add other tricky examples


==== Hardcoded strings ====
==== Hardcoded strings ====
TBD


==== Caveats ====
==== Caveats ====
TBD
<nowiki>[% %]</nowiki> and <nowiki>[%+ %]</nowiki><br>
apostrophes and quotes inside apostrophes pairs and quotes pairs<br>
${terms.bugs}


=== Test ===
=== Test ===
62

edits

Navigation menu