Esto es un reblog de trabajo para no perder el archivo. Cómo usar SVN para tus traducciones de WordPress, en inglés. Lo guardo por histórico, porque en próximas versiones esta forma de trabajar dejará de funcionar.
Using SVN in your translation flow is not as hard as it seems. If you know some of the basics, you can update a repository (for themes, plugins, or core) in an easy way. Let’s begin :).
We are going to work with the example of the Spanish (Spain) translation. What do we need to begin with?
Permissions
First of all, we need to have permissions granted to write to our Subversion repository. We can ask for this access in the make/polyglots
site.
Don’t forget to:
- Ask for access politely
- Indicate your wp.org user
- Indicate the repository you want access to (you need to be a validator for your language to be granted commit access)
- Tag your post with request. Locale tags are not needed, as they are automatically associated with validators, but they will be appreciated by others translators and validators.
Creating your own local copy
Now that you have access to the repository, you need to make your own local copy to work with it.
First, you need to locate your locale’s repository. You can look for it in https://i18n.svn.wordpress.org. Once you have located it, copy the URL. For the Spanish example, the URL is https://i18n.svn.wordpress.org/es_ES/
The next step is to make the copy. If you are a Mac or Linux user, you only need to go to a terminal. If you are a Windows, user, you can install Win32SVN to work with a terminal with SVN.
We are going to use SVN. SVN is an abbreviation for Subversion, a software versioning and revision control by Apache. SVN (and other revision control software, like git) allow the programmers to work in a collaborative way and allow to all the people involved to look at and review the code, modify it, and revert it if there is any problem.
Once you have your terminal ready, you need to write this with your own locale:
Now you’ll see a lot of archives being copied, and you will have all your locale repository copied in your local directory.
SVN basics
Note that you are right now in a SVN repository. You can see what others have done in the repository by using the command svn log
. When you submit your changes, others will see your activity in the logs.
SVN is a little wayward. When you are in a SVN repository, you need to remember to alway use the command svn
to do things.
- if you want to copy something, you need to use
svn copy
orsvn cp
- if you want to move something, you need to use
svn move
orsvn mv
- if you want to delete something, you need to use
svn delete
orsvn del
- if you add a new file to a directory and want it to be in the SVN repository, you need to use
svn add <file>
to add it to the next commit
You have a list of all the available commands writing svn help
in your local repository.
Creating a new tag and/or branch
Now that we have our local repository, we need to create our new branches and tags. We are going to work with the example of WP 4.0-alpha.
As we see before, when you create a new file or archive you need to add
it to the repository. If you do not add it, you will not be able to commit your files to the repository.
To make things easier, we are going to svn copy
a prior directory and modify the files.
First step, we go into the tags directory. We will have a list of all prior tags.
Now, we copy the last directory created to a new one with our version:
Done! Now we can navigate with our browser to make things easier.
Understanding the repository
In our new directory we will see two directories: dist and messages.
The dist directory has this content:
- license.txt – the license archive
- licencia.txt – name may vary. This is the license in your language.
- readme.html – the readme file in your language.
- wp-admin/setup-config.php – a translated version of the setup in your language
- wp-config-sample.php – a translated version of the config sample in your language
The messages directory has this content:
- admin-xx_XX.mo – the translation archive for the administration ( link )
- admin-xx_XX.po – .po version
- admin-network-xx_XX.mo – the translation archive for the network administration ( link )
- admin-network-xx_XX.po – .po version
- continent-cities-xx_XX.mo – all the translated Continents and Cities to your language ( link )
- continent-cities-xx_XX.po – .po version
- xx_XX.mo – the main WordPress translation ( link )
- xx_XX.po – .po version
- twentyxxxxx – the translation of each official theme (various directories)
- xx_XX.po
- xx_XX.po
Updating your files
At this point, we need to update the files of our new directory to commit the new version. To do this, we need to know how are we going to build the new package.
If you are going to use the translate.wordpress.org option,
- All the installation and setup archives will be read from our new /dist directory (and we will tell the system where they are)
- The translations will be read from the translate.wordpress.org site
If you choose the Subversion option,
- All the installation and setup archives will be read from our new /dist directory (and we will tell the system where they are)
- All the translations will be read from our translations svn directory (and we will tell the system where they are)
You should always try to use the first version. If you need to use the second version, then you will need to:
- go to each one of the translation sites in translate.wordpress.org (you have the links here)
- export the translations in .po and .mo versions
- change the names of the archives to match the list before
- put them in the svn directory in their correct place
Regardless the option we want to use, we need to update the archives in the dist directory. Usually, you will only need to update the version number in the readme.html file. If you need to do something else, it will be mentioned in the make/polyglots
site.
After finishing with the archives and changes, we can use the command svn status
in our parent directory to see the changes that are going to be committed.
Committing changes
- If we are committing a minor version (3.9.1 for example), we will need to commit a tag with the new version
- If we are committing a major version (4.0 for example), we will copy this new tag to a branch to upload the tag and branch
If we are using the Subversion option we will see the list of all .po and .mo archives; it’s a good idea to update the .mo and .po archives in the /trunk directory as well.
If we are using the translate.wordpress.org option, we are ready to commit our changes.
The command to commit our changes is svn commit
or svn ci
. We will add a message using the -m subcommand, containing:
- the version we are uploading
- the language we are uploading
- please use english to make understanding easier
And done! We are ready to go to our local WordPress.org site and build the new version of WordPress.
Building a localized WordPress version
If you have just committed the files to the repository, you will need to wait a bit to see it appear in your local WordPress.org site.
Once it’s working, you need to select:
- the translate.wordpress.org option
- the /dist/ directory
- the development (trunk) project
The WordPress version will change and you will see the last version in development. The revision number will be ignored, it only works in the Subversion option.
If you want to build an official release version, you will need to look in the project list and select the one that you are looking. You will get the last minor version released. Again, the version will be automatic and the revision number will be ignored.
You can build and distribute as many beta and release candidate versions as you want. They will automatically go to the beta and release candidates place.
Deja un comentario