[wp-hackers] using translated strings for action names

Sabin Iacob iacobs at m0n5t3r.info
Sat Jun 30 16:24:34 GMT 2007

The new options page mechanism (using an action hook to get potions 
pages and other types of admin section custom pages) builds the action 
names dynamically, so, for instance, for an options page defined like this:

add_options_page("Foo config", "Foo", 5, "foo")

tries to run an action called "options_page_foo"

This seems reasonable (although it looks like a textbook case for the 
YAFL antipattern), but...

when using l10n, "options" becomes "einstellungen" in German, "optiuni" 
in Romanian, "opciones" in Spanish, and who knows what in other 
languages, which leads to wordpress trying respectively 
"einstellungen_page_foo", "optiuni_page_foo", "opciones_page_foo",  etc.

Am I the only one who thinks this is a (trying my best to be polite) bad 

P.S. a workaround is to use sanitize_title(__("Options")) . "_page_foo" 
for the action name.

More information about the wp-hackers mailing list