Every once in a while you’ll stumble upon a string that can’t be translated using the .po or language.php file. When that happens you’ll have to find some other way to translate the string – that’s where Agent Ransack jumps in.
Agent Ransack is basically a search program that enables you to search withing text files. What this means is that you can literally input the string you want to translate into Agent Ransack and he’ll give you the exact file and line number where that string is located. Agent Ransack only works on Windows machines, if you own a Mac try EasyFind, I believe you should get the same results
So, let’s get started!
1. Download the latest version of your theme from member area. Save the theme somewhere on your computer, you don’t have to upload it to the server.
2. Download, install and run Agent Ransack
3. When you first start the program you should see something that looks like this
To make it look less cluttered click on Expert User to disable expert user view. After that click on the options tab and under Contents click on Regular Expression. This is necessary for our search results to be accurate.
4. If you did the above steps correctly your Agent Ransack should now look like this
Please make sure that “Search subfolders” is selected
5. To start searching all we must do is populate the Containing text and Look in fields. In “Containing text” we must enter the string we are searching. In “Look in” we enter the path to our theme on the hard drive. You can also find it by clicking on the “Browse” button
6. As an example for this tutorial I’ll be using the “Appointment fees for this service is” string from our Appointment theme. Inside the theme the string looks like this:
7. To locate that string we must input “Appointment fees for this service is” inside the “Containing text” field and path to our Appointment theme inside the “Look in” field. Once you input everything it should look like this
To start searching just click on the Start button
8. If everything was correctly entered you should see something like this
Search found three files where that string is mentioned. en_US.po (the translation file) and ajax_appointment_time.php (and it’s backup file). Let’s imagine that we can’t translate this using the .po file, we much focus on the ajax_appointment_time.php file.
9. Clicking one of the files will show us all lines inside the file where this string is mentioned. In our case those lines are 111 and 114. To edit a file just click (twice) on the file with your left mouse button, or right-click and chose “Open”.
10. When the file opens just navigate to the mentioned lines and make your translation
Translating with Agent Ransack is extremely simple and most importantly – fast. Your searches will never last more than a few seconds. Certain strings can be harder to find and can make you run into circles. If you find such a string just create a new topic here in the forums and we’ll tell you exactly where you can translate it.
Happy translating! 🙂