TÊN

po-debconf — giới thiệu


MÔ TẢ

Mục đích của debconf là làm cho tiến trình cấu hình gói là thân thiện với người dùng. Để đạt được, quan trọng là đảm bảo mỗi người dùng sẽ thấy câu hỏi bằng ngôn ngữ của mình. Người dịch cần một khuôn khổ để dịch dễ dàng, không cần theo dõi tiến trình phát triển gói. po-debconf đã được thiết kế để chạy được với các công cụ gettext chuẩn khi dịch tập tin mẫu debconf.


THÊM HỔ TRỢ I18N VÀO TẬP TIN MẪU DEBCONF

Muốn thêm hỗ trợ debconf vào gói thì bạn đã ghi một tập tin mẫu chứa văn bản tiếng Anh (ngôn ngữ gốc). Để thêm khả năng hỗ trợ tiến trình quốc tế hoá (i18n) vào gói, bạn cần phải:

• Tạo debian/po/POTFILES.in

This file contains the list of master templates. It typically contains a single line:

  [type: gettext/rfc822deb] templates

Đường dẫn tương đối với thư mục cha.

• Thêm một dấu gạch dưới vào trước mỗi trường có thể dịch được

Bình thường có thể dịch được các trường kiểu Description, Choices và đôi khi Default.

• Chạy debconf-updatepo

Tiến trình này sẽ tạo tập tin debian/po/templates.pot mà người dịch sẽ dịch sang ngôn ngữ khác.

• Thêm vào debian/control một quan hệ phụ thuộc xây dựng vào po-debconf.


CẬP NHẬT MẪU

Để cho người dịch duy trì bản dịch hiện thời, bạn cũng nên duy trì các tập tin PO hiện thời. Không thì chỉ có bản dịch cũ. Để cập nhật các tập tin PO, đơn giản hãy gọi lệnh này (không có đối số):

  $ debconf-updatepo

Để duy trì các tập tin PO hiện thời, bạn nên chạy lệnh này mỗi lần thay đổi chuỗi tiếng Anh trong mẫu. Cũng nên chạy nó khi bạn nhận bản dịch mới hay bản dịch đã cập nhật, vì người dịch có thể đã dịch tập tin PO cũ.

Nếu bạn thay tên, thêm hay gỡ bỏ bất kỳ tập tin mẫu, cũng nhớ để chỉnh sửa tập tin debian/po/POTFILES.in một cách tương ứng. Không thì một số chuỗi tiếng Anh bị thiếu trong tập tin PO; các chuỗi tiếng Anh này sẽ được hiển thị cho người dùng xem, thậm chí nếu các tập tin PO đã được dịch hoàn toàn.

Chương trình debconf-updatepo là luỹ đẳng: nó sửa đổi tập tin PO chỉ nếu nội dung bị cập nhật. Vì vậy phương pháp tốt nhất để cung cấp các tập tin PO hiện thời trong gói mã nguồn là gọi lệnh này từ đích clean của tập tin debian/rules.

Ghi chú rằng bạn cần phải chạy debconf-updatepo thậm chí nếu bạn sử dụng dh_installdebconf. Hàm thứ hai này gọi po2debconf mà từng gọi debconf-updatepo nếu phát hiện tập tin bị lỗi thời, nhưng không còn là trường hợp lại vì hai lý do :

  1. po2debconf nhờ nhãn giờ để phát hiện tập tin bị lỗi thời, và có thể không chạy đúng khi dùng pbuilder hoặc nếu bản dịch cũ đã được lưu vào đĩa sau khi mẫu bị sửa đổi.

  2. dh_installdebconf được gọi đã lâu sau khi tạo ra tập tin .diff.gz.


TRỘN BẢN DỊCH VỚI BẢN GỐC

You have to make sure that when your package is compiled, translations will get into the built package. You can do that manually, or automatically using the dh_installdebconf script (make sure to have a versioned build dependency against debhelper (>= 4.1.16)).

Để tự kiểm tra, bạn cần phải trộn các mẫu với các bản dịch vào lúc biên dịch (và đặt quan hệ phụ thuộc xây dựng với po-debconf) như thế:

  $ po2debconf debian/templates > debian/tmp/DEBIAN/templates

BE CAREFUL: the two files called templates are not the same at all. The first one contains only the English text, with marks to denote some fields to be translated while the second contains all languages. That is to say that you CANNOT keep only the merged templates, or you won't be able to deal with translations as people submit them to you.


MẪU CHỦ MỚI

Định dạng nguồn tập tin mẫu mới là gần trùng với một của những tập tin mẫu đã phát hành, nhưng mỗi trường có thể dịch được có dấu gạch dưới nằm trước. Thí dụ :

  Template: debconf/frontend
  Type: select
  _Choices: Dialog, Readline, Gnome, Editor, Noninteractive
  Default: Dialog
  _Description: Interface to use for configuring packages:
   Packages that use debconf for configuration share a common look and
   feel.  You can select the type of user interface they use.
   .
   The dialog frontend is a full-screen, character based interface,
   while the readline frontend uses a more traditional plain text
   interface, and the gnome frontend is a modern X interface.  The
   editor frontend lets you configure things using your favorite text
   editor. The noninteractive frontend never asks you any questions.

XẺ DANH SÁCH TÙY CHỌN

Kể từ po-debconf 0.6.0, trường đã địa phương hoá có thể chứa hai dấu gạch dưới nằm trước. Trong trường hợp này, giá trị trường nên là danh sách các giá trị định giới bằng dấu phẩy, mà được chia ra các chuỗi msgid riêng. Vì vậy, nếu thí dụ trước đã chứa:

  __Choices: Dialog, Readline, Gnome, Editor, Noninteractive

thì tạo 5 chuỗi msgid khác nhau. Ghi chú rằng dấu cách nằm sau dấu phẩy không có nghĩa.

Về cơ bản thì _Choices thích hợp với danh sách tùy chọn không thay đổi, nhưng __Choices thích hợp với các trường khác.

Tiếc là nếu bạn chọn chuyển đổi giữa hai dạng này, mọi chuỗi dịch sẽ có nhãn « dịch mờ » (fuzzy). Vẫn còn có thể thay đổi, không mất bản dịch (cần thiết po-debconf >= 1.0). Giả sử là chúng ta muốn chuyển đổi thí dụ trước sang __Choices. Vậy bạn nên sao chép tập tin templates vào tập tin tạm thời.

  $ cp debian/templates debian/foo

Sửa debian/foo, giữ chỉ những trường Template, Type_Choices mà nằm trong thí dụ này.

  Template: debconf/frontend
  Type: select
  _Choices: Dialog, Readline, Gnome, Kde, Editor, Noninteractive

Chạy debconf-gettextize với hai cờ --merge--choices để xây dựng các tập tin PO như thể là __Choices đã được ghi, và trộn các tập tin PO này với các tập tin đã tồn tại:

  $ debconf-gettextize --merge --choices debian/foo

Cuối cùng bạn cần phải gỡ bỏ foo và tự chỉnh sửa debian/templates để thay thế _Choices bằng __Choices trước khi chạy debconf-updatepo.

GHI CHÚ CHO NGƯỜI DỊCH

Các nhà duy trì Dpkg đã quyết định rằng theo quy ước mỗi dòng bắt đầu với dấu thăng (#) là chú thích trong tập tin debian/control, và po-debconf có phải theo quy ước này. Kể từ po-debconf 0.8.0, các chú thích như vậy được ghi vào tập tin PO, và có thể chứa thông tin có ích cho người dịch. Hơn nữa, các phiên bản po-debconf trước sẽ bỏ qua mọi dòng không chứa dấu hai chấm, vì vậy nếu chú thích không chứa dấu hai chấm, không cần thêm quan hệ phụ thuộc xây dựng đặt phiên bản với po-debconf. Thí dụ :

  Template: debconf/button-yes
  Type: text
  # Translators, this text will appear on a button, so KEEP IT SHORT
  _Description: Yes

Chú thích đặc biệt đã được giới thiệu trong po-debconf 1.0 để quản lý chuỗi chứa vài mục khác nhau (như trong trường Choices) hay vài đoạn văn khác nhau (như Description). Hai chỉ thị này cho nhà phát triển điều khiển hữu ích hơn thông tin được hiển thị cho người dịch. Chú thích này theo dạng #flag:directive; các chỉ thị được diễn tả bên dưới.

translate:spec, translate!:spec

Đánh dấu chỉ một số mục là « có thể dịch được »; spec là danh sách con số định giới bằng dấu phẩy, nó xác định những chuỗi nào sẽ được in ra tập tin PO. Cũng có thể xác định phạm vi bằng dấu trừ (v.d. 2-6), và dấu sao (*) có nghĩa « mọi chuỗi ». Chẳng hạn, đối với

  Template: partman-basicfilesystems/fat_mountpoint
  Type: select
  #flag:translate:3,4
  __Choices: /dos, /windows, Enter manually, Do not mount it
  _Description: Mount point for this partition:

Hai mục Enter manuallyDo not mount it sẽ xuất hiện trong tập tin PO, nhưngkhông phải hai mục /dos/windows. Có dấu chấm than nằm sau từ khoá translate thì spec xác định những chuỗi nào sẽ bị hủy ra tập tin PO: các chuỗi khác được in ra. Thí dụ trước tương tự với

  Template: partman-basicfilesystems/fat_mountpoint
  Type: select
  #flag:translate!:1,2
  __Choices: /dos, /windows, Enter manually, Do not mount it
  _Description: Mount point for this partition:

Có thể áp dụng cùng từ khoá cho trường Description để đảm bảo một số chuỗi riêng sẽ không được dịch.

  Template: partman-crypto/options_missing
  Type: error
  #flag:translate!:3
  _Description: Required encryption options missing
   The encryption options for ${DEVICE} are incomplete. Please
   return to the partition menu and select all required options.
   .
   ${ITEMS}

Nhưng mà trường hợp này nguy hiểm, vì ngữ cảnh có thể bị hủy ra tập tin PO: hãy ghi chú để cho người dịch thông tin cần thiết.

comment:spec, comment!:spec

The comment just below this directive applies to the strings specified by spec, which is defined above. By default, a comment written before a translatable field is printed along with all strings belonging to this field. (Note: with po-debconf < 1.0, the comment was printed only with the first string)

  Template: arcboot-installer/prom-variables
  Type: note
  # Translators, the 4th string of this description has been dropped
  # from PO files.  It contains shell commands and should not be
  # translated.
  #flag:comment:3
  # "Stop for Maintenance" should be left in English
  #flag:translate!:4
  _Description: Setting PROM variables for Arcboot
   If this is the first Linux installation on this machine, or if the
   hard drives have been repartitioned, some variables need to be set
   in the PROM before the system is able to boot normally.
   .
   At the end of this installation stage, the system will reboot.
   After this, enter the command monitor from the "Stop for
   Maintenance" option, and enter the following commands:
   .
      setenv OSLoader arcboot
      setenv OSLoadFilename Linux
   .
   You will only need to do this once.  Afterwards, enter the "boot"
   command or reboot the system to proceed to the next stage of the
   installation.

The example above has a comment without #flag:comment directive, where an implicit #flag:comment:* is added. This comment appears with all strings, but the one about Stop for Maintenance is printed only before the relevant string.

partial

Từ khoá này báo po2debconf nên giữ lại các chuỗi đã dịch, thậm chí nếu chưa dịch mọi chuỗi. Hãy sử dụng cẩn thận: từ khoá này đã được giới thiệu nhằm mục đích chính xác.

THÔNG BÁO NGƯỜI DỊCH TRƯỚC KHI TẢI LÊN

Usually translators notice on the status web pages (see below) that translations are outdated, and send patches which will be included in future uploads. But developers are encouraged to ask maintainers of outdated translations for an update before an upload, for instance one week in advance. A dedicated tool, podebconf-report-po, has been written for this purpose. Do not hesitate to abuse it!


CẨN THẬN


TRANG WEB TRẠNG THÁI

Statistics for po-debconf translations are available at http://www.debian.org/intl/l10n/po-debconf/ (or from mirrors); they are automatically updated when new packages are uploaded. Only packages shipping debian/po/templates.pot and debian/po/POTFILES.in files are considered, so you should make sure your source package provides them.

Người dịch có thể lấy tập tin PO và POT từ trang trạng thái, nhưng cũng nên liên lạc với người dịch trước (địa chỉ thư điện tử nằm trong phần đầu của tập tin PO) và/hay nhóm dịch trong hộp thư chung debian-l10n-<language>@lists.debian.org (nếu có : một số nhóm dịch dùng hộp thư chung bên ngoài) để kiểm tra không có người dịch khác đảm nhận cùng bản dịch, và đọc các báo cáo lỗi hiện thời về gói đó để kiểm tra bản dịch đã được đệ trình chưa.

After translating these files, they should submit their work to the maintainer as bug report of severity wishlist with the patch tag.


XEM CŨNG

debconf-gettextize(1), debconf-updatepo(1), dh_installdebconf(1), podebconf-report-po(1). po2debconf(1).


TÁC GIẢ

  Martin Quinson <Martin.Quinson@ens-lyon.fr>
  Denis Barbier <barbier@linuxfr.org>