Thêm Một Ngôn Ngữ Mới (Adding a Language)

Chuẩn Bị (Preparations)

If the language you want to translate has not been started by someone else already and you wish to create a set of new files for the desired language, say 'fr' (French), then you must first use the environment you have created, as guided in Getting Started, in particular Install and Build sections.

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 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. Goto https://developer.blender.org to create an account for yourself and become a developer/translator for the Blender organization.

  2. Login the account and create a task with todo type, addressing an administrator in the Subscribers field, requesting for a committer right in order to transfer changes to the central repository of the translation team.

  3. Open an instance of the console application, such as Gnome-Terminal emulator.

  4. Change the current working directory to the directory of blender_docs, where the instance of Makefile resides.

Thử Nghiệm Biên Dịch để 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 build đượ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 rst thành tập tin phiên dịch pot:

    make gettext
    
  3. Tạo các tập tin html:

    make html
    
  4. After this, you can actually view the created html files locally following the prompted instruction, such as:

    xdg-open <path to your English manual>/blender_docs/build/html/index.html
    

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 ./resources/theme/js/version_switch.js (assuming you are at the blender_docs 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": "Fran&ccedil;ais",, ("fr": "Français"). (Lưu ý các ký tự Unicode nhé.)

  4. To find out about changes in the local repository:

    svn status
    
  5. Enter your password:

    svn commit --username <your username> -m "your comment"
    
  6. Bring your local repository up to the most recent version of changes, including the one you have just done:

    svn update .
    

Setting the Local Configuration File

  1. Open a text editor to enter the following texts, change the language code to whatever the language you will be translating:

    1
    2
    3
    language = 'fr'
    locale_dirs = ['locale/']
    gettext_compact = True
    
  2. Save this file as conf.py in the blender_docs directory, where Makefile resides.

  3. Tells svn to ignore this file when performing operations by executing this shell command:

    svn propset svn:ignore conf.py .
    

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:

    svn checkout https://svn.blender.org/svnroot/bf-manual-translations/trunk/blender_docs/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 .svn 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_docs directory to generate a set of files for fr language:

    make gettext
    sphinx-intl update -p build/locale -l fr
    

    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 'msgstr' 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
    svn add fr
    svn commit --username <your username> -m "Initial commit language set of files for French"
    
  4. You don't need all other languages being there, so remove the locale directory for the time being:

    rm -fr locale
    

    We will download this new set of language as guided in the next section.

Ghi chú

  • 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' để 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_docs
    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_docs/toos_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