--- config.tlu.orig 2011-04-04 18:09:33.000000000 +0200 +++ config.tlu 2011-04-04 18:35:39.000000000 +0200 @@ -122,6 +122,8 @@ return 'from command line option "'..context.name..'"' elseif context.src == 'env' then return 'from environment variable "'..context.name..'"' + elseif context.src == 'loc' then + return 'from operating system locale' elseif context.src == 'file' then return 'in file "'..context.file..'" on line '..context.line elseif context.src == 'def' then @@ -373,6 +375,19 @@ end -- scope of config_files +---------------------- config from locale settings ------------------------- + +function setup_config_from_locale() + local current = os.setlocale(nil, "all") + os.setlocale("", "all") + local native = os.setlocale(nil, "time") + os.setlocale(current, "all") + local lang = string.match(native, "^[a-z][a-z]") + if lang then + set_config_element("lang", lang, {src="loc"}) + end +end + ---------------------- options from built-in defaults ---------------------- -- for default viewer on general Unix, we have a list; the following two @@ -551,6 +566,7 @@ setup_config_from_cl(arg) setup_config_from_env() setup_config_from_files() + setup_config_from_locale() setup_config_from_defaults() -- regex mode is deprecated if config.mode == 'regex' then