Translate FreeBSD Docs: Step-by-Step Guide for New Languages
In this article
Translating FreeBSD documentation allows you to make the operating system accessible to non-English speakers, fostering a more inclusive global community. This process involves cloning the official documentation repository, setting up a local translation environment, and submitting changes via pull requests. Before starting, ensure you have a GitHub account, basic knowledge of Git version control, and familiarity with the SGML/XML markup used in FreeBSD docs.
What You'll Need
- A GitHub account with two-factor authentication enabled.
- Git installed on your local machine (FreeBSD or Linux recommended).
- A text editor that supports syntax highlighting for XML/SGML (e.g., Vim, VS Code, or Emacs).
- Basic understanding of the FreeBSD Porter's Handbook structure.
- Time and patience for reviewing complex technical terminology.
Step-by-Step
- Fork the Repository: Navigate to the
freebsd/freebsd-docrepository on GitHub. Click the "Fork" button in the top right corner to create a copy under your own GitHub account. This is your workspace for making changes without affecting the main project. - Clone Your Fork: Open your terminal and clone the repository to your local machine using the command:
git clone https://github.com/YOUR_USERNAME/freebsd-doc.git. ReplaceYOUR_USERNAMEwith your actual GitHub username. This creates a local directory containing all documentation files. - Navigate to the Language Directory: Change into the cloned directory and locate the language folder you wish to translate. The structure typically follows
src/doc/en_US.ISO8859-1for English. For other languages, look for folders likesrc/doc/de_DE.ISO8859-1(German) or create a new one if it does not exist yet. If creating a new language, check theMakefilein the parent directory to see how languages are registered. - Set Up the Translation Branch: It is best practice to work on a separate branch. Create a new branch named after the language, for example:
git checkout -b de-de-translations. This keeps your work isolated from the main branch and makes merging easier later. - Edit the Files: Open the SGML files (usually ending in .sgml or .xml) in your text editor. Translate the content between the tags carefully. Do not modify the tag names themselves, only the text inside them. Pay attention to special entities like
<command>,<filename>, and<literal>, which should remain unchanged. - Check for Consistency: Use tools like
lintor specific FreeBSD doc validation scripts if available in the repository. Ensure that technical terms are translated consistently throughout the document. Create a glossary if necessary to maintain uniformity. - Commit Your Changes: Once you have completed a section or a file, stage your changes using
git add .and commit them with a descriptive message:git commit -m "Translated Chapter 3 to German". - Push to GitHub: Upload your branch to your forked repository with
git push origin de-de-translations. This makes your changes visible on GitHub. - Create a Pull Request: Go to the original
freebsd/freebsd-docrepository on GitHub. Click "Compare & Pull Request." Select your branch as the source and the main branch as the destination. Write a clear description of what you have translated and any known issues. Submit the pull request for review by the FreeBSD Documentation Project team.
Common Mistakes
One frequent error is translating HTML or SGML tags instead of the content. Always leave tags like <para> or <title> intact. Another mistake is ignoring context; a word like "port" can mean a software package port or a network port. Always verify the context before translating. Additionally, many contributors forget to update the LINGUAS variable in the Makefile when adding a new language, which prevents the build system from recognizing the new translation.
Tips
Start with smaller documents, such as man pages or short guides, before tackling large books like the Porter's Handbook. This helps you get familiar with the workflow. Use translation memory tools if available, but always review manually for accuracy. Collaborate with other translators in the same language group to ensure consistency. Regularly sync your fork with the upstream repository to avoid merge conflicts: git remote add upstream https://github.com/freebsd/freebsd-doc.git followed by git fetch upstream and git rebase upstream/main.
Troubleshooting
If your pull request is rejected, read the comments carefully. Rejections often occur due to formatting errors or untranslated strings. If you encounter merge conflicts, resolve them locally by editing the conflicted files, staging the resolved files, and pushing again. If the build fails locally, check the output for specific line numbers where errors occurred. Common issues include unclosed tags or invalid entities. If you cannot find a suitable translation for a term, leave it in English and add a comment explaining why, or ask for advice in the mailing list.
Frequently Asked Questions
Do I need to be a FreeBSD developer to translate?
No, anyone can contribute translations. You do not need write access to the main repository because you will use a pull request from your fork.
How do I handle untranslatable strings?
If a string contains code, commands, or proper nouns that should not be translated, leave it in English. Add a comment in the source file if needed to explain your decision.
Can I translate multiple languages at once?
It is recommended to focus on one language at a time to maintain quality and consistency. Managing multiple languages simultaneously can lead to confusion and errors.
What if my translation is outdated?
The upstream documentation changes frequently. Periodically sync your branch with the upstream main branch to incorporate recent updates and fix potential conflicts.
Is there a style guide for FreeBSD translations?
Yes, each language team may have its own conventions. Check the existing translations in your target language for style cues. General guidelines emphasize clarity and consistency with standard technical terminology.