SA Bugzilla – Bug 3755
Add configuration setting: use_language
Last modified: 2019-08-10 14:57:28 UTC
At the moment SA uses the LANG enviroment variable to determinate the localization. This is a problem when you use spamd or the when the users does not have a shell account. My suggestion is to add a "use_language" configuration setting, that when set overrides the LANG enviroment. As far as I understand the code this is not strait forward to implement since the rules (and the 30_text_<lang>.cf file) is red before the userpref.
I think it's a good idea. I'm not sure how to implement it -- consider this scenario: - 6 translations (5 localized + en_US) - 700 rules - 70 chars per description - 32 bytes overhead per string in the storage hash (I'm guessing here, but perl is profligate with memory here) that comes out as (6 * 700 * (70+32)) = 428400 bytes. should we carry that overhead in RAM for all scanning, or read it from disk when needed? (actually, 428k isn't a massive deal now that I think of it...)
I am planing to implement this. I would like your input on the following idea: - Add use_language as a $CONF_TYPE_STRING configuration setting with default value LANG - In parse sub replace the $lang variable with the value of use_language if different from LANG. - Move the 30_text_*.cf file from the rules directory to a seperator directory (eg lang/) - Load these file after the userpref file in the init sub. Is that OK?
Morten, your proposal sounds good to me (not a dev). Hoping you'll follow through, I've updated the milestone to "Future" and changing assignment to you.
Created attachment 3033 [details] Added use_language conf setting
(In reply to comment #3) > Morten, your proposal sounds good to me (not a dev). Hoping you'll follow > through, I've updated the milestone to "Future" and changing assignment to you. Forgot about this for a while... I have implemented this now. The patch has been submitted. In order to make this patch work a lang directory must be created in the rules directory and the 30_*.cf files must be moved to the lang directory (they need to be parsed after the user_pref file). It could by a good time to rename the 30_*.cf file to text_de.cf or something like that. I dont see any use for the number at the start any more.
I faxed the CLA to Apache yesterday.
I've updated your account to reflect your CLA was received a 6+ years later. Is this bug still of interest because I hate to see patches submitted that just stuck in the queue :-(
I'm not going to close this outright, but I'd like to. How many users actually use SA localization? How many of those are not able to set environment variables? I figure this will be super minority. This bug hasn't got any comments in 14 years. I would honestly rather remove 30_text_*.cf completely from the distribution, has someone actually updated them in 15 years??
I like the idea and I think if it can be used with OK_LOCALES somehow, it might be more useful