Codeigniter - 更改uri段

The project was developed few years ago and now we need to add custom uri segment to all url. for example now we have

www.address.com/blog/how-does-it-sound

and we need to change it to

www.address.com/ru/blog/how-does-it-sound

but the uri segment /ru/ should be available only when russian language is selected. So the question is - how to do something like that global?

if ( $this->session->userdata('user_lang') && $this->session->userdata('user_lang') == 'ru' ){
     $this->uri->segment(1) = $this->uri->segment(2);
}

I hope you will understand what I need. I found a class in core, but I'm not sure how to edit it properly.