Welcome to the SVN tutorial for localizers! Here you'll learn the process of using SVN to obtain Mozilla website source files from the Mozilla servers and pushing your localizations right back to them. First things first, we need to give you a brief introduction to what SVN is and where you can find the necessary tools to get started. If you're already familiar with this information, skip ahead to Mozilla's SVN repositories.
Brief intro to SVN
SVN (abbreviation for Subversion) is a free and open source repository tool we use to manage the localized Mozilla web pages. It's a handy tool that allows us to grab, change, and store versions of source files in one location. You should know that when we say SVN we are referring to either the SVN server and the SVN client. This may seem confusing, but don't fret because we'll make sure to differentiate between the two here:
- SVN server: This is installed on one of Mozilla's servers that we use to manage our localizable web system.
- SVN client: This is what a localizer installs on their own computer. The SVN client is the localizer's communication portal for accessing the Mozilla SVN server. You use it to copy files from the server to your computer and to push changed or localized files back onto the server.
Installing SVN client:
- Linux users can download the SVN client from http://subversion.apache.org/packages.html or install packages provided within their distribution (for example, in Debian,
sudo apt-get install subversion).
- Mac OS X users can find SVN inside the Command Line Tools (available on the Apple Developer website), or use tools like Homebrew or Fink.
- Windows users can install the SVN client directly from the Cygwin setup file. If you already installed Cygwin but it didn't include the SVN package, run the Cygwin installer again and be sure to check the box beside Subversion package. This option is found in the Devel category. A possible alternative is to install TortoiseSVN (graphical interface and command line client).
Mozilla's SVN repositories
Mozilla's SVN server is publicly available at https://svn.mozilla.org. Despite there being several directories at the root of the SVN server, only the
mozillamessaging.com directories apply to web localizers.
For this tutorial we'll use the
mozilla.com project. Here's the layout you will find within the
- Navigating from the command-line with your SVN client, you'll find three directories within
trunkdirectory is what you are most insterested in.
Trunkrefers to a set of files and directories that are in the testing stage (i.e., staging). All file modifications belong in
trunkbecause they are seen most frequently.
mozilla.com/trunk/locales, there are separate directories for each locale that is localizing mozilla.com. In each of those locale directories are other directories with files to be localized in
Working with SVN
Now that you understand the Mozilla SVN repository layout (in particular the layout for
mozilla.com), let's get some files into your hands to start localizing!
The first thing you need to do is copy the Mozilla repository you want to work on to your computer.
- Enter the following command in your command-line tool:
svn checkout https://svn.mozilla.org/projects/mozilla.com/trunk/locales/[your locale code] mozilla-l10n-[your-localeCode]
This command creates the
mozilla-l10n-[your-localeCode] directory on your computer and copies into it all of the files from
https://svn.mozilla.org/projects/moz...om/trunk/locales/[your locale code].
Also, we use
httpbecause changes can only be pushed back to the Mozilla SVN Repository through a secure connection.
- Open the files you want to translate with your favorite text editor.
- Translate the content in those files, save them and check for differences by entering this command from the command-line:
This command produces output with every change made to each file. It's a bit hard to read, but you can also create a diff file (aka a diff patch) use
svn diff > /path/to/output/file.diff to save the output to a file. Note that
path/to/output is meant to indicate the directory on your computer where you wish to store the diff file.
You can also run
to check the list of modified files (they'll display a M before the name) you're about to commit.
- Once you're satisfied with changes, commit them to the appropriate Mozilla SVN repository by entering the following command:
svn commit -m "Minor modifications for Firefox [version #] beta page for [your locale]"
svn commit command will commit your changes directly to the Mozilla SVN repositories. Since you are writing to the repository here, you will be asked for your LDAP login credentials.
-m parameter followed by some text within double quotes (") will be pushed along with your changes. Within the double quotes you should briefly describe your changes so that everyone can see what you contributed.
You can also double check your changes using the ViewVC interface.
- After you commit your changes, wait 15 minutes and check the staging website for your locale. Your recent changes should now be visible online. You will have the chance to see how the localized website will look when it's pushed to prod (i.e., a website that regular visitors will see).
- When localizing websites, l10n-drivers will always add needed files to your repository or update your files with new strings in English. It's very important for you to update your working copy with the newest files from Mozilla SVN repository before you start making changes. Enter the following command from the command-line:
Your local SVN repository (i.e., working directory) will be updated with the newest files from the URL you initially cloned your repository from. It's very important that you do this often. As a general rule, you should at least do it before translating anything.
- Sometimes mistakes happen and you need to start over. Go back to the root of your working directory and execute this command:
svn revert *
This is a really helpful command because it reverts all of your changes to your working directory's last updated state. This is a huge blessing if you have been updating frequently. It's a nightmare if you haven't because it throws away all of your recent hard work. Keep this in mind because if you did a lot of work and you made some errors in just one file, maybe it would be wiser to simply correct those errors instead of reverting your working directory and losing all your work.
Note: sometimes you'll find references to commands in abbreviated form (svn ci = svn commit, svn up = svn update, svn co = svn checkout, etc.)
Commit doesn't work, what's wrong?
- Make you sure you're checking out the repository with https://
- Make sure you're adding a commit message when running
svn commit. Commits with an empty message will be rejected.
- SVN accounts are disabled after 6 months of inactivity. To be used again, they need to be reenabled.
If you have any doubts, ping l10n-drivers on IRC in the #l10n channel.
Off to the races!
Congratulations! You should now be able to use SVN from the command-line to copy directories from the Mozilla repositories, make modifications to those repositories by using SVN commands like
svn up and
svn revert, and finally push your localized work to the Mozilla repositories. If you forget any of the information on this page, don't worry, you can always come back and review. It won't go anywhere any time soon!