- Word of the day: Ouch.
- I’m done with the cancer, but the cancer isn’t done with me
- Goodbye, my dopey dog.
- So long, Alex King
Polluting the internet since 2004
The WordPress TextMate Bundle was just updated to include support for internationalizing strings. Its not terribly obvious how the feature can be used, so I thought that I’d do a quick outline of its features.
The goal of adding this support was to make it as seamless as possible to integrate with your coding style. The command will properly adjust itself for whether your selected text is within a single or double quoted string, it is a quoted string itself, or if it is in a block of HTML instead of PHP.
The command is found under the “Plugin API” section of the plugins menu or by using the
command-shift-i keyboard shortcut.
With the sample code:
Selecting text “
two three” WITHIN the quoted strings will return:
Again, with the same sample code:
Selecting the entire quoted string, including the quotes, will return:
Here our code will return a bit different. With this as our example:
Selecting the string “
one two three four” will return:
Here it uses the
_e() (echoes the result) function instead of the
__() (returns the result) function.
So, overall not complicated but super duper handy. I can’t believe that I didn’t think about this earlier. It was just suggested by Mr. Gordon Brander earlier today and I was so giddy to get it implemented here I am on a Friday night getting it worked in!