Skip to content

Commit 5d8e4e6

Browse files
committed
Improve Translation Center wording
1 parent 604f963 commit 5d8e4e6

1 file changed

Lines changed: 32 additions & 30 deletions

File tree

‎locale/translators/index.php‎

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,8 @@ function main_form(): void
314314

315315
if (!in_array($locale, $system_locales)) {
316316
echo "<td>" . _("Warning: system locale not installed") . "</td>";
317+
} else {
318+
echo "<td></td>";
317319
}
318320
echo "</tr>\n";
319321
}
@@ -323,24 +325,24 @@ function main_form(): void
323325
echo "<h2>" . _("PO Template") . "</h2>";
324326
$pot_file = new POFile($pot_filename);
325327
if ($pot_file->exists) {
326-
echo "<p>" . _("POT template file") . ": ";
327-
echo "<a href='$translate_url?func=view&amp;locale=template'>" . _("View")
328+
echo "<p>" . _("POT template file") . ":<ul>";
329+
echo "<li><a href='$translate_url?func=view&amp;locale=template'>" . _("View")
328330
. "</a> | <a href='$translate_url?func=download&amp;locale=template'>"
329-
. _("Download") . "</a> ";
330-
echo " (" . _("Last modified") . ": "
331-
. date("F d Y H:i:s", $pot_file->last_modified) . ")";
331+
. _("Download") . "</a></li> ";
332+
echo "<li>" . _("Last modified") . ": "
333+
. date("F d Y H:i:s", $pot_file->last_modified) . "</li>";
332334
$total_strings = $pot_file->messages_count;
333335
$translated_strings = $pot_file->messages_translated_count;
334-
echo " - " . sprintf(_("%d strings total"), $total_strings);
335-
echo "</p>";
336+
echo "<li>" . sprintf(_("%d strings total"), $total_strings) . "</li>";
337+
echo "</ul></p>";
336338
} else {
337339
echo "<p>" . _("No POT template file has been generated.") . "</p>";
338340
}
339341

340342
if (in_array("xtext", $allowed_functions)) {
341343
echo "<form action='$translate_url?func=xtext' method='POST'>";
344+
echo _("Run <code>xtext</code> to generate a fresh template file: ");
342345
echo "<input type='submit' value='" . attr_safe(_("Regenerate template file")) . "'> ";
343-
echo _("Run <code>xtext</code> to generate a fresh template file.");
344346
echo "</form>\n";
345347
}
346348
}
@@ -360,63 +362,64 @@ function manage_form(string $locale): void
360362

361363
echo "<p><b>" . _("Locale") . ":</b> $locale</p>\n";
362364
if (!in_array($locale, $system_locales)) {
363-
echo "<p><b>" . sprintf(_("Warning: While a locale translation exists for %s, a system locale does not. Without a system locale installed, gettext will not use this translation."), $locale) . "</b></p>";
365+
echo "<p class='warning'>" . sprintf(_("While a locale translation exists for %s, a system locale does not. Without a system locale installed, gettext will not use this translation."), $locale) . "</p>";
364366
}
365367
echo "<p><b>" . _("Language") . ":</b> " . eng_name($locale) . "</p>\n";
366-
echo "<p><b>" . _("Translation status") . ":</b> ";
367-
if ($translation_enabled) {
368-
echo _("Enabled");
369-
} else {
370-
echo _("Disabled");
371-
}
372-
echo "</p>\n";
368+
echo "<p><b>" . _("Translation status") . ":</b> " . ($translation_enabled ? _("Enabled") : _("Disabled")) . "</p>";
373369

374370
$po_filename = "$dyn_locales_dir/$locale/LC_MESSAGES/messages.po";
375371
$po_file = new POFile($po_filename);
376372
if ($po_file->exists) {
377373
$total_strings = $po_file->messages_count;
378374
$translated_strings = $po_file->messages_translated_count;
379375

380-
echo "<p><b>" . _("PO file") . ":</b> ";
381-
echo "<a href='$translate_url?func=view&amp;locale=$locale'>"
376+
echo "<p><b>" . _("PO file") . ":</b>";
377+
echo "<ul>";
378+
echo "<li><a href='$translate_url?func=view&amp;locale=$locale'>"
382379
. _("View") . "</a> | <a href='$translate_url?func=download&amp;locale=$locale'>"
383-
. _("Download") . "</a> (" . _("Last modified") . ": "
384-
. date("F d Y H:i:s", $po_file->last_modified) . ")";
380+
. _("Download") . "</a></li>";
381+
echo "<li>" . _("Last modified") . ": " . date("F d Y H:i:s", $po_file->last_modified) . "</li>";
385382

386-
echo " - ";
383+
echo "<li>";
387384
echo sprintf(
388385
_('%1$s of %2$s translated (%3$d%%)'),
389386
$translated_strings,
390387
$total_strings,
391388
$translated_strings / $total_strings * 100
392389
);
393-
echo "</p>";
390+
echo "</li>";
394391

395392
$pot_filename = "$dyn_locales_dir/messages.pot";
396393
$pot_file = new POFile($pot_filename);
397394
if ($pot_file->exists && $pot_file->last_modified > $po_file->last_modified) {
398-
echo "<p>" . _("The current template is more recent than the PO file. You should merge the PO file with the current template.") . "</p>";
395+
echo "<li class='warning'>" . _("The current template is more recent than the PO file. You should merge the PO file with the current template.") . "</li>";
399396
}
397+
echo "</ul></p>";
398+
399+
echo "<h2>" . _("Update PO with current template") . "</h2>";
400400

401401
echo "<form action='$translate_url?func=merge' method='POST'>";
402402
echo "<input type='hidden' name='locale' value='$locale'>";
403-
echo "<input type='submit' value='"
404-
. attr_safe(_("Merge current PO file with the current template")) . "'> ";
405-
echo _("Run <code>msgmerge</code> to update the current PO file against the current template.") . "<br>\n";
403+
echo "<p>" . _("Run <code>msgmerge</code> to update the current PO file against the current template to pick up new strings that need translation.") . "</p>\n";
406404
echo "<input type='checkbox' name='fuzzy' checked> "
407405
. _("Do fuzzy matching when an exact match is not found (can be much slower but more accurate)") . "<br>" ;
408-
echo "</form><br><br>\n";
406+
echo "<input type='submit' value='"
407+
. attr_safe(_("Merge PO file with template")) . "'> ";
408+
echo "</form>\n";
409409
} else {
410410
echo "<p>" . _("No PO file.") . "</p>\n";
411411
}
412412

413+
echo "<h2>" . _("Upload new PO file") . "</h2>";
414+
415+
echo "<p>" . _("This replaces the current PO file with the file you provide, and installs the translation for use by the site. Strings marked as \"fuzzy\" are not included in the new translation catalog. Be sure your PO file does not have any marked as fuzzy that you want used.") . "</p>";
416+
413417
echo "<form action='$translate_url?func=upload' method='POST' enctype='multipart/form-data'>\n";
414418
echo "<input type='hidden' name='locale' value='$locale'>";
415419
echo _("Select a PO file to upload:") . " ";
416420
echo "<input type='file' name='userfile'><br>\n";
417421
echo "<input type='submit' value='"
418422
. attr_safe(_("Upload file")) . "'> ";
419-
echo _("This replaces the current PO file with the file you provide, and installs the translation for use by the site.");
420423
echo "</form>\n";
421424

422425
if (user_is_a_sitemanager()) {
@@ -434,15 +437,14 @@ function manage_form(string $locale): void
434437
echo "<input type='submit' value='" . attr_safe(_("Save")) . "'> ";
435438
echo "</form>\n";
436439

437-
echo "<br><br>";
438440
echo "<form action='$translate_url?func=delete' method='POST'>";
439441
echo "<input type='hidden' name='locale' value='$locale'>";
440442
$confirm = javascript_safe(
441443
_("Are you sure you want to delete this locale and its translation file?")
442444
);
445+
echo "<p>" . _("Delete the locale directory, PO file and MO file:") . " ";
443446
echo "<input type='submit' onClick='return confirm(\"$confirm\");' value='"
444447
. attr_safe(_("Delete this locale")) . "'> ";
445-
echo _("Delete the locale directory, PO file and MO file.") . "<br>\n";
446448
echo "</form>\n";
447449
}
448450
}

0 commit comments

Comments
 (0)