Forum OpenACS Development: Language change in a project

Collapse
Posted by Juan Carlos on
I need to create the option inside my project so the user can change the language of the program from english to spanish, and viceverse, with just a click. What can I do?
Collapse
Posted by Antonio Pisano on
One example of such feature you can find in the /acs-lang/www/index page. If, for instance, you go to https://openacs.org/acs-lang/, there you will have the possibility to switch the preferred locale for you on this website.

Of course your application should have been written with localization in mind, that is, have every UI text as a localized message key (with a proper translation for the languages you want to support).

Hope this helps

Antonio

Collapse
Posted by Brian Fenton on
Lots of good docs here https://openacs.org/doc/i18n-introduction

Let me know if you need more specific advice.

Brian

Collapse
Posted by Iuri Sampaio on
Assuming you've read already those 2 posts above, you can easily find the examples using API lang::user::*

You can add whether a link or a form to pass the desired locale, then run the chunk of code bellow.

if {$locale ne ""} {
lang::user::set_locale $locale

ad_returnredirect [ad_conn url]
ad_script_abort
}

Best wishes,
Iuri