Thêm một Ngôn Ngữ Mới#

Chuẩn Bị (Preparations)#

Nếu ngôn ngữ bạn muốn dịch chưa được khởi công bởi một người nào đó, và bạn muốn kiến tạo một tập hợp các tập tin mới cho ngôn ngữ mong muốn, chẳng hạn 'fr' (Tiếng Pháp) thì trước tiên bạn phải sử dụng môi trường bạn đã kiến tạo nên, như được hướng dẫn trong mục Khởi Đầu (Getting Started), phần về Cài Đặt các Phụ Thuộc (Installing Dependencies)Xây Dựng bản Hướng Dẫn Sử Dụng (Building the Manual) nhé.

Việc làm này sẽ cung cấp cho bạn một môi trường cơ bản cho việc:

  • Tạo một bộ ngôn ngữ phiên dịch mới từ nguồn tiếng Anh.

  • Thực hiện lệnh '"tạo"' để biến các văn bản đã dịch thành các tập tin po thành các tập tin html để thử nghiệm cục bộ.

  • Cập nhật các thay đổi trong văn bản tiếng Anh đã được các cộng tác viên khác thêm vào.

Ví dụ dưới đây cho thấy quá trình kiến tạo một bộ các tập tin mới cho tiếng Pháp, mã Ngôn ngữ fr, trên hệ điều hành Linux. Các hệ điều hành khác có thể biến đổi một đôi chút song về nguyên lý thì hoàn toàn giống nhau.

  1. Create a Blender ID if you have not done so already

  2. Log into projects.blender.org and Create an Issue requesting for commit access in order to transfer changes to the central repository of the translation team.

  3. Open an instance of a console application.

  4. Change the current working directory to the directory of blender-manual, where the instance of Makefile resides.

Thử Nghiệm Biên Dịch để Kiến Tạo các Tập Tin HTML trong Tiếng Anh (Trying the Make Process to Create HTML Files in English)#

  1. Hãy đảm bảo rằng thư mục "xây dựng" được xóa đi, nếu nó tồn tại:

    make clean
    
  2. Chuyển đổi toàn bộ các tập tin "restructuredtext: tái cấu trúc văn bản" thành tập tin phiên dịch pot:

    make gettext
    
  3. Kiến Tạo các tập tin "hypertext markup language: ngôn ngữ đánh dấu siêu văn bản":

    make html
    
  4. After this, you can actually view the created html files locally by opening the blender-manual/build/html/index.html file.

Tạo Trình Mục cho Ngôn Ngữ trong Trình Đơn HTML (Creating the Language Entry in the HTML Menu)#

  1. Create an entry for the language in the html menu by opening file ./build_files/theme/js/version_switch.js (assuming you are at the blender-manual subdirectory).

  2. Tìm bảng về các ngôn ngữ trong biến số var all_langs = {..};.

  3. Điền một mục: "fr": ":abbr:`Tiếng pháp (Français)`",, ("fr": "Français"). (Lưu ý các ký tự Unicode nhé.)

  4. Commit the updated file:

    git add ./build_files/theme/js/version_switch.js
    git commit -m "HTML: Add French to language menu"
    
  5. Push your changes to the upstream repository:

    git push
    

Sinh Tạo Bộ Tập Tin cho Ngôn Ngữ Dự Định (Generating the Set of Files for the Target Language)#

  1. Xuất kho bản dịch hiện tại bằng cách sử dụng lệnh:

    git clone https://projects.blender.org/blender/blender-manual-translations.git locale
    

    This will download all language sets available in the repository into the locale directory of your drive. You can go to the locale directory to see the hidden subdirectory .git within it, together with directories of languages. You'll need to add your own set of files for the language you are trying to translating to.

  2. From the blender-manual directory to generate a set of files for fr language:

    make update_po
    

    Những tập tin này vẫn còn nằm trong Tiếng Anh mà thôi, với các dòng '"message string: văn bản của thông điệp, tức dòng dành cho văn bản phiên dịch"' vẫn còn trống.

  3. Nhập kho bộ tập tin mới vào kho lưu trữ trung tâm:

    cd locale
    git add fr
    git commit -m "Initial commit language set of files for French"
    

Mẹo

  • Bạn nên tạo hai biến môi trường cho các thư mục này, trong tập tin '".bashrc: tập lệnh sắp đặt môi trường dòng lệnh"' để thuận tiện hơn cho việc thay đổi hoặc viết tập lệnh batch/shell cho quá trình dịch và xem xét kết quả:

    export BLENDER_MAN_EN=$HOME/<directory to make file directory above>/blender-manual
    export BLENDER_MAN_FR=$BLENDER_MAN_EN/locale
    
  • Newly generated files will contain some placeholders for authors and revision dates etc. If you find the job of replacing them repetitive, make use of the script change_placeholders.sh in the subdirectory ~/blender-manual/tools/util_maintenance, make a copy of that to your local bin directory and replace all values that were mentioned in the file with your specific details, then after each change to a file, you would do following commands to update the file with your personal details, revision date and time, plus generating the html files for your language, which you can view using your Internet browser:

    $HOME/bin/change_placeholders.sh $BLENDER_MAN_FR
    make -d --trace -w -B -e SPHINXOPTS="-D language='fr'" 2>&1