[fpc-pascal] Hot switching RTL locale

leledumbo leledumbo_cool at yahoo.co.id
Fri Nov 4 20:40:22 CET 2016

My web application is currently serving two languages, I use a simple
TStringList based translation strings to achieve that. However, things are a
little harder for locale, especially day and month names. The web
application is an embedded server one, so its lifetime is not on a per
process basis, meaning I must be able to do hot locale switching as people
change the used language (kept in session per visitor).

I notice that clocale can fill DefaultFormatSettings according to server
locale for me, but the unit itself doesn't expose any interface, so I guess
it's not possible to use it for hot switching (the call to setlocale inside
GetFormatSettings has hardcoded parameters).

I have a fallback mechanism to fill (Short|Long)(Month|Day)Names on language
change using the same translation mechanism above, but I'm looking for a
better way if possible.

View this message in context: http://free-pascal-general.1045716.n5.nabble.com/Hot-switching-RTL-locale-tp5726762.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.

More information about the fpc-pascal mailing list