Bugzilla:L10n:Guide: Difference between revisions

Jump to navigation Jump to search
m
→‎Caveats: Adding declension case
m (→‎Localizing Templates: Fixing typos)
m (→‎Caveats: Adding declension case)
Line 254: Line 254:
apostrophes and quotes inside apostrophes pairs and quotes pairs<br>
apostrophes and quotes inside apostrophes pairs and quotes pairs<br>
${terms.bugs} , <nowiki>[% terms.bugs %]</nowiki> and $terms.bugs<br>
${terms.bugs} , <nowiki>[% terms.bugs %]</nowiki> and $terms.bugs<br>
Declensions
 
<strong>Declensions</strong><br>
English only deals with one plural form and has no declension. Your locale might need to implement declensions and reorder words inside a sentence. WARNING: this is a bit tricky and making mistake here will broke your Bugzilla localization (i.e. some features might not function when your locale package will be installed).<br>
Let's say we have the following:
<pre>
  [% IF !Param("allowbugdeletion") %]
  <p>
    Sorry, there
 
    [% IF comp.bug_count > 1 %]
      are [% comp.bug_count %] [%+ terms.bugs %]
    [% ELSE %]
      is [% comp.bug_count %] [%+ terms.bug %]
    [% END %]
 
    pending for this component. You should reassign
 
    [% IF comp.bug_count > 1 %]
      these [% terms.bugs %]
    [% ELSE %]
      this [% terms.bug %]
    [% END %]
 
    to another component before deleting this component.
  </p>
  [% ELSE %]
</pre>
 
Here, the following expression <tt>comp.bug_count</tt> obviously gives the count number of bugs for a component. <tt>IF comp.bug_count > 1</tt> means "if there are more than one bug".<br>
Let's say your language has to deal with three plural forms and that the terms "bug" and "pending" should be declensed as well.<br>
First, you'll have to populate the <tt>/template/en/default/global/variables.none.tmp</tt> file with the declensions for "bug", which would give something like:
<pre>
[% terms = {
  "bug0" => "declension for zero bug",
  "bug" => "declension for one bug",
  "bug2" => "declension for two bugs",
  "bug3" => "declension for three bugs",
  "bugs" => "declension for more than three bugs",
</pre>
Then, the previous code should look like:
<pre>
  [% IF !Param("allowbugdeletion") %]
  <p>
    Sorry, there
 
    [% IF comp.bug_count > 3 %]
      are [% comp.bug_count %] pending [% terms.bugs %]
    [% ELSE %]
      [% IF comp.bug_count == 0 %]
      is [% comp.bug_count %] pending [% terms.bug0 %]
    [% ELSE %]
      [% IF comp.bug_count == 1 %]
      is [% comp.bug_count %] pending [% terms.bug %]
    [% ELSE %]
      [% IF comp.bug_count == 2 %]
      are [% comp.bug_count %] pending [% terms.bug2 %]
    [% ELSE %]
      [% IF comp.bug_count == 3 %]
      is [% comp.bug_count %] pending [% terms.bug3 %]
    [% END %]
 
    for this component. You should reassign
 
    [% IF comp.bug_count > 1 %]
      these [% terms.bugs %]
    [% ELSE %]
      this [% terms.bug %]
    [% END %]
 
    to another component before deleting this component.
  </p>
  [% ELSE %]
</pre>


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

edits

Navigation menu