Q:

Localize URL bases

I run a non-English blog.  I love that WordPress has been translated to Spanish and currently I use the Spanish translated version of WordPress. 
One thing that I'd really like to change is the URL structure for my blog.  For example, instead of sitio.com/category/gatos, I'd like to change the URL to sitio.com/categoria/gatos.  I know you can set the category base and tag base in Settings/Permalinks, but I'd like to know how to do this in code.  Also, I want to translate search/ to busqueda/ and page/ to pagina/.
I want to translate all of these to Spanish. 

category_base
author_base
pagination_base
feed_base
search_base
comments_base

I'd like to be able to make these this just within my own theme (that I've made from scratch), that way these changes could be more portable. 
I've read the WordPress Codex for WP_Rewrite and have experimented with add_rewrite_rule, but I'm still stuck.  Does anyone know where else I could look? 
Update:
With this function, your search form can still use name="s", but the user will be redirect to the appropriate location on submit. 
function redirectSearch()
{
    // Make sure you redirect to whatever your search_base is. 
    if(!empty($_GET['s'])){
        wp_redirect(home_url('/busqueda/').urlencode(get_query_var('s')));
    }
}
add_action('template_redirect', 'redirectSearch');

A:

This should cover everything:
function wpa_rewite_translate(){
    global $wp_rewrite;     
    $wp_rewrite->pagination_base = 'pagina';
    $wp_rewrite->author_base = 'autor';
    $wp_rewrite->comments_base = 'comentarios';
    $wp_rewrite->feed_base = 'alimentar';
    $wp_rewrite->search_base = 'busqueda';
    $wp_rewrite->set_category_base( 'categoria/' );
    $wp_rewrite->set_tag_base( 'etiqueta/' );
}
add_action( 'init', 'wpa_rewite_translate' );

Feel free to laugh at my translations, haha. 
Also, to flush rewrite rules when your theme is activated, add this:
function wpa_flush_rewite(){
    flush_rewrite_rules();
}
add_action( 'after_switch_theme', 'wpa_flush_rewite' );

