Using JEdit and regexps for translation

You can use JEdit and its Search and Replace feature to make the process of translation much easier and faster. Amongst the common text match and replace you can search strings using more powerful regular expressions and replace the matches with a so called BeanShell snippet. I'm using for example this setting in the Search and Replace dialog (Ctrl+F):

Example 1

Search for:

Copy to clipboard
this ([^\" ]*)",

Replace with: Return value of a BeanShell snippet

Copy to clipboard
" tuto (tento/toto) "+_1+"\","

Search in: Current buffer
Settings: Keep dialog, Regular expressions
Direction: Auto wrap

Then I do prefer to control visually what's happening by clicking "Find" button first and then "Replace & Find" until all matches are replaced or you can click "Replace All" when you're sure what you're doing wink.

This example will match all untranslated strings on lines such as:
// "monitor this map" => "monitor this map",
// "stop monitoring this map" => "stop monitoring this map",
// "Edit this genre:" => "Edit this genre:",

and replace them with:
// "monitor this map" => "monitor tuto (tento/toto) map",
// "stop monitoring this map" => "stop monitoring tuto (tento/toto) map",
// "Edit this genre:" => "Edit tuto (tento/toto) genre:",

Another example:

Search for:

Copy to clipboard
"admin ([^\"]*) tpl",

Replace with:

Copy to clipboard
"\"nastav tpl pro "+_1+"\","

This example will do e.g. the next:
// "admin cache tpl" => "nastav tpl pro cache",
// "admin Banners tpl" => "nastav tpl pro Banners",
// "admin live support tpl" => "nastav tpl pro live support",

Page last modified on Wednesday 15 June 2011 06:13:22 GMT-0000