removed hdf setting "LanguageDir"

setting "LANGUAGE_DIR" is now deprecated
moved english language file to template directory
added gettext translation of english language template
available interface languages are now configured via LANGUAGE_LIST
This commit is contained in:
lars 2007-03-20 19:15:04 +00:00
parent dcc2ef9a56
commit 95d4b07ed9
4 changed files with 351 additions and 38 deletions

View File

@ -24,10 +24,6 @@ $LIST_DIR = "$HOME_DIR/lists";
# defaults to "$LIST_DIR/webusers"
$WEBUSERS_FILE = "$LIST_DIR/webusers";
# Where are the language files
# usually something like /usr/local/share/ezmlm-web/lang
$LANGUAGE_DIR = "/usr/local/share/ezmlm-web/lang";
# Where are the template files
# usually something like /usr/local/share/ezmlm-web/template
$TEMPLATE_DIR = "/usr/local/share/ezmlm-web/template";
@ -69,3 +65,7 @@ $HTML_CSS_FILE = "/ezmlm-web.css";
# choose a language (en|de)
# list of available languages - this should include the default language above
# example: LANGUAGE_LIST = ( "en", "de", "si", "jp" );
@LANGUAGE_LIST = ( "en", "de" );

View File

@ -20,11 +20,12 @@ use File::Path;
use DB_File;
use CGI;
use IO::File;
use POSIX qw(tmpnam);
use POSIX;
use Encode;
use English;
use Locale::gettext;
# do not forget: we depend on Mail::Ezmlm::Gpg if the corresponding configuration
# setting is turned on
@ -53,8 +54,13 @@ use vars qw[$HOME_DIR]; $HOME_DIR=$tmp[7];
use vars qw[$DEFAULT_HOST];
# some deprecated configuration settings - they have to be announced
# otherwise old configuration files would break
use vars qw[$LANGUAGE_DIR]; # deprecated since v3.2
# some settings for encrypted mailing lists
use vars qw[$GPG_SUPPORT];
@ -386,9 +392,6 @@ sub load_hdf {
# initialize the data for clearsilver
my $hdf = ClearSilver::HDF->new();
&fatal_error("Language data dir ($LANGUAGE_DIR) not found!") unless (-e $LANGUAGE_DIR);
$hdf->setValue("LanguageDir", "$LANGUAGE_DIR/");
&fatal_error("Template dir ($TEMPLATE_DIR) not found!") unless (-e $TEMPLATE_DIR);
$hdf->setValue("TemplateDir", "$TEMPLATE_DIR/");
@ -414,6 +417,7 @@ sub load_hdf {
return $hdf;
# =========================================================================
sub output_page {
# Print the page
@ -457,9 +461,6 @@ sub load_interface_language
my ($data) = @_;
my $config_language;
# load $HTML_LANGUAGE - this is necessary, if a translation is incomplete
$data->readFile("$LANGUAGE_DIR/$HTML_LANGUAGE" . ".hdf");
# set default language
$config_language = 'en';
$config_language = $HTML_LANGUAGE
@ -482,32 +483,61 @@ sub load_interface_language
$warning = 'InvalidLanguage';
# add the setting to every link
$data->setValue('Config.UI.LinkAttrs.web_lang', "$config_language");
# import the configured resp. the temporarily selected language
$data->readFile("$LANGUAGE_DIR/$config_language" . ".hdf");
&translate_language_data($data, $config_language);
return $data;
# ---------------------------------------------------------------------------
sub add_language_data
sub translate_language_data
my ($hdf, $lang) = @_;
$td = Locale::gettext->domain("ezmlm-web");
my ($hdf, $language) = @_;
my $langdata;
my %translation;
my $key;
# create gettext object
&setlocale(POSIX::LC_MESSAGES, $language);
# read language template
$langdata = ClearSilver::HDF->new();
#TODO: add translation
return $hdf;
# translate all strings
my $subtree = $langdata->getObj("Lang");
%translation = &recurse_hdf($subtree, "Lang");
foreach $key (keys %translation) {
$hdf->setValue($key, gettext($translation{$key}))
# ---------------------------------------------------------------------------
sub recurse_hdf_data
sub recurse_hdf
my ($node, $prefix) = @_;
my ($value, $child, $next, %result, %sub_result, $key);
$value = $node->objValue();
if ($value) {
#print "Prefix: " . $prefix . " / " . $value . "\n";
#TODO: check if this works on the same single object - no tests up to now
$result{$prefix} = $value;
$next = $node->objChild();
while ($next) {
%sub_result = &recurse_hdf($next, $prefix . "." . $next->objName());
foreach $key (keys %sub_result) {
$result{$key} = $sub_result{$key};
$next = $next->objNext();
return %result;
# ---------------------------------------------------------------------------
@ -1499,8 +1529,8 @@ sub gnupg_generate_key() {
$pagename = 'gnupg_secret';
return (0==0);
} else {
return (0==1);
$error = 'GnupgGenerateKey';
return (0==1);
@ -1671,7 +1701,7 @@ sub update_webusers {
my $temp_file;
my $fh;
# generate a temporary filename (as suggested by the Perl Cookbook)
do { $temp_file = tmpnam() }
do { $temp_file = POSIX::tmpnam() }
until $fh = IO::File->new($temp_file, O_RDWR|O_CREAT|O_EXCL);
close $fh;
unless (open(TMP, ">$temp_file")) {
@ -1818,18 +1848,10 @@ sub webauth_create_allowed {
# ---------------------------------------------------------------------------
sub get_available_interface_languages {
my (%languages, @files, $file);
or &fatal_error ("Language directory ($LANGUAGE_DIR) not accessible!");
@files = sort grep { /.*\.hdf$/ } readdir(DIR);
foreach $file (@files) {
my $hdf = ClearSilver::HDF->new();
substr($file, -4) = "";
my $lang_name = $hdf->getValue("Lang.Name", "$file");
$languages{$file} = $lang_name;
my (%languages, $lang_id);
foreach $lang_id (@LANGUAGE_LIST) {
# TODO: retrieve the local spelling of each language
$languages{$lang_id} = $lang_id;
return %languages;

share/template/language.hdf Normal file
View File

@ -0,0 +1,292 @@
Lang {
ID = en
Name = English
Menue {
ListCreate = Create new list
ListDelete = Delete list
Subscribers = Subscribers
AllowList = allow list
DenyList = deny list
DigestList = digest list
ModList = moderators
ConfigMain = Options
ConfigSub = subscription
ConfigPost = posting
ConfigAdmin = administration
ConfigArchive = archive
ConfigProcess = processing
ConfigAll = overview
Gnupg = Key management
GnupgPublicKeys = public keys
GnupgSecretKeys = secret keys
GnupgGenerateKey = generate key
GnupgConvert = Encryption
TextFiles = Text files
ListSelect = Choose a list
Properties = Properties of
Language = Language
Help = Help (external)
Title {
ConfigMain = List configuration
ConfigSub = Subscription options
ConfigPosting = Posting options
ConfigAdmin = Remote administration
ConfigArchive = Archive options
ConfigProcess = Message processing
ConfigAll = Complete configuration
SubscriberList = Subscribers of the list
AllowList = Allowed users
DenyList = Blocked users
DigestList = Digest subscribers
ModList = Moderators of the mailinglist
ListCreate = Create a new list
ListSelect = Choose a list
ListDelete = Delete list
FileSelect = Choose a file for editing
FileEdit = Editing file
GnupgConvert = Encryption
GnupgPublic = Public keys
GnupgSecret = Secret keys
GnupgGenerate = Generate a new keypair
Buttons {
Create = Create list
ConfirmDeletion = Delete the list
DeleteAddress = Delete address(es)
AddAddress = Add address(es)
UpdateConfiguration = Update configuration
UpdateGnupg = Update keyring
EditFile = Edit file
SaveFile = Save file
ResetFile = Remove customized file
LanguageSet = select
GnupgConvertToEncrypted = Convert to an encrypted mailinglist
GnupgConvertToNormal = Convert to a plaintext mainlinglist
DeletePublicKey = Delete public key(s)
DeleteSecretKey = Delete secret key(s)
GnupgImportKey = Import key
GnupgGenerateKey = Generate key pair
GnupgExportKey = download
ErrorMessage {
UnknownAction = this action is undefined
ParameterMissing = this action needs one or more parameters
Forbidden = Error: you are not allowed to do this!
InvalidFileName = The name of the file is invalid!
UnknownConfigPage = The chosen config page is invalid!
UnknownGnupgPage = The chosen gnupg page is invalid!
GnupgKeyImport = Failed to import the uploaded key!
GnupgDelKey = Failed to remove the key(s)!
GnupgGenerateKey = Failed generate a new key!
WarningMessage {
AddAddress = Adding of at least one mail address failed!
DeleteAddress = Removal of at least one mail address failed!
CreateList = Creation of new mailing list failed!
DeleteList = Removal of mailing list failed!
UpdateConfig = Update of configuration failed!
SaveFile = The file could not be saved!
ListNameAlreadyExists = There is already a list with this name!
ListAddressAlreadyExists = There is already a list with this address!
ListDoesNotExist = A list with this name does not exist!
ListDirAccessDenied = Unable to access the list's directory
TextDirAccessDenied = Unable to access the list's directory of text files
SafeRemoveRenameDirFailed = Unable to rename list for safe removal
DotQmailDirAccessDenied = Unable to read the mail user's home directory for .qmail files
SafeRemoveMoveDotQmailFailed = Unable to move .qmail files
UnsafeRemoveListDirFailed = Unable to delete list
UnsafeRemoveDotQmailFailed = Unable to delete .qmail files
InvalidFileFormat = The uploaded file must be a text file
WebUsersUpdate = Could not update the webusers file
WebUsersRead = Could not read the webusers file
InvalidListName = The name of the list contains invalid characters
ReservedListName = This listname may not be used as it is reserved for internal purposes
EmptyListName = The name of the list may not be empty
InvalidLocalPart = The local part of the list address is not valid
RequiresIDX5 = This action requires ezmlm-idx v5.0 or higher.
ResetFileIsDefault = There is no customized text file, that can be removed.
ResetFile = Removal of custimized text file failed.
GnupgNoKeyFile = There was no key file selected for upload!
GnupgDelKey = Removal of (at least) one key failed!
GnupgNoKeySelected = There was no key selected to be removed!
GnupgNoName = The name of the key may not be empty!
GnupgInvalidExpiration = The expiration time is invalid!
GnupgInvalidKeySize = The length of the key is invalid!
GnupgExportKey = Export of key failed!
GnupgConvert = Conversion to encrypted mailing list failed!
SuccessMessage {
AddAddress = The address was added to the list.
DeleteAddress = The address was removed from the list.
CreateList = The new mailing list was successfully created.
DeleteList = The mailing list was successfully removed.
UpdateConfig = The mailing list's configuration was successfully changed.
UpdateGnupg = The keyring has been changed successfully.
SaveFile = The file was saved.
ResetFile = The customized text file was successfully removed. From now on, the system-wide default text file will be used instead of it.
GnupgKeyImport = The key was successfully imported.
GnupgConvert = Encryption is now enabled for this list.
Options {
a = Archive mailing list messages
b = Only moderators are allowed to access the archive
d = Activate the digest list
f = Add a prefix to the subject line of outgoing messages
g = Archive requests from unrecognised senders are denied
h = Subscriptions do not require confirmation by the user
i = Index mailing list messages for WWW archive access
j = Unsubscribe does not require confirmation
k = Use deny list to prevent some users from posting
l = Remote administrators (moderators) may request a subscriber list
m = All incoming messages are moderated
n = Remote administrators (moderators) may edit text files in DIR/text
o = Only moderators may post
p = Allow subscription and archive retrieval for everyone
q = Process mailman-style requests (to local-request@domain)
r = Enable remote administration of the list (for moderators)
s = Subscriptions to the main list and the digest list will be moderated
t = Add a trailing text to every message
u = Only subscribed users may post messages (for moderated lists: always accept subscribers' postings)
w = Remove the ezmlm-warn invocations from the list setup (rarely useful)
x = Remove or reject specific mime types in messages
y = Request a confirmation mail for every posted message
gnupg_allowKeySubmission = Allow key submission via mail
gnupg_encryptToAll = Encrypt to all recipients at once (do not encrypt inividually)
gnupg_NokeyNocrypt = Send plaintext to the subscribers which have no key
gnupg_RequireSub = Only subscribers may post messages
gnupg_signMessages = Sign outgoing messages with the list's key
gnupg_VerifiedKeyReq = Use only verified keys
gnupg_requireSigs = Only verifiably signed messages are accepted
Settings {
0 = Make the list a sublist of another list
3 = Set a custom "From:" header for outgoing messsages
4 = Define customized setting for digest creation (ezmlm-tstdig)
5 = Define the email address of the list owner
6 = Use a SQL database
7 = Define a custom path to the database for posting moderators
8 = Define a custom path to the database for subscription moderators
9 = Define a custom path to the database for remote administators
Misc {
HelpLink = The manual page of ezmlm-idx
Subscription = Subscription
Subscribers = subscribers
RemoteAdmin = Remote Admin
ListName = List Name
ListAddress = List Address
ListOptions = Basic List Options
AllowedToEdit = Users allowed to edit this list via web interface:
HeaderRemove = Headers to strip from every outgoing mail
HeaderAdd = Headers to add to all outgoing mail
MimeRemove = Mime types to strip from all outgoing mail
MimeReject = Messages containing any of these mime type will be rejected
EditFileInfo {
CommonTags = common tags
ListNameLocal = The local part of the list name
ListNameHost = The host name of the list name
MessageNumber = Number of the respective message
SubAddress = The subscription address
SubReplyAddress = The address a subscriber must reply to
AcceptanceAddress = The acceptance address
RejectionAddress = The rejection address
SuggestDefaultPath = You will have to manage them manually.
PostModPathWarn = Posting moderators are stored in a non-standard location
SubModPathWarn = Subscription moderators are stored in a non-standard location
RemoteAdminPathWarn = Remote administrators are stored in a non-standard location
MessageSize.Max = Reject messages exceeding a specified value
MessageSize.Min = Reject messages smaller than a specified value
MessageSize.Unit = bytes
NoFiles = There are no files in the text directory of the mailinglist.
AddSubscriberAddress = Add a new mail address:
AddSubscriberFile = Upload a text file containing mail addresses to be added:
SuggestDefaultPath = It is recommended to use the default path for the moderation database. Otherwise you cannot manage the moderators' list with ezmlm-web.
FooterText = a web interface for
NoListsAvailable = I could not find any accessible list for you.
ConfirmDelete = Do you really want to remove this list completely?
CustomizedFiles = customized files
DefaultFiles = default files
ListLanguage = Language of the list
ListCharset = Charset of the list
ModSubOverridesRemote = Hint: if both the database of subscripton moderators and of remote administrators use customized locations, then the database of subscription moderators will be used for both of them
GnupgNoPublicKeys = There are no public keys available.
GnupgNoSecretKeys = There are no secret keys available.
GnupgImportKey = Import a new key from a file:
GnupgKeyName = Name of the key
GnupgKeyComment = Comment (optional)
GnupgKeySize = Length of the key (bytes)
GnupgKeyExpires = Expiration time (years)
Never = never
Introduction {
ConfigAdmin = Remote administrators are (by default) also moderators for subscription and for posting. They may have the permission to (un)subscribe users and to change the text files of the list by sending emails to the mailing list software.
ConfigArchive = The mailing list archive can be accessed by mail. Additionally you will want to create a list archive, if you plan to publish it (e.g. with ezmlm-www).
ConfigProcess = Modify some message properties, before they are distributed to the subscribers.
ConfigMain = Here you find some settings, that did not fit into any other category.
ConfigPosting = The posting configuration determines, who is allowed to send messages to the list and how these mails will be processed.
ConfigSub = Here you may define, who is allowed to subscribe to the list and you can set some details of the subscription process.
ConfigAll = This is the complete list of all available properties of the list. Usually it should be easier to use the topic-based configuration pages, but - of course - this is your choice.
ListDelete = This mailinglist and everything inside of it will be removed completely.
AllowList = Members of the allow list will not receive outgoing mails, but they have the same rights, as normal subscribers. Usually the allow list will contain mail aliases of subscribers.
DenyList = If you want to prevent specific mail addresses from using this list (subscription, posting, ...), then you should add them to the deny list and activate it. This can be useful for annoying people and even for notorious vacation reply users. But since it is fairly easy to fake an mail address, this will not really improve security.
DigestList = Some users of your mailing list may prefer to receive a regular digest instead of all mailing list messages. They will usually not take part in discussions, but aret somehow interested anyway.
ModList = Moderators (for posting or subscription) and remote administrators can be allowed to manage the most important parts of mailing list administration: moderating subscription and posting, changing filtering rules, and managing users. Moderators may even be configured to be the only ones, who are allowed to send mails to the mailing list.
SubscriberList = Subscribers of a mailing list will receive all outgoing message of the list. They may also be allowed to post messages directly or moderated. Usually anonymous users are able to subscribe and unsubscribe without the help of an administrator - but of course, you may configure this to suit your needs.
TextFiles = The selection box contains a list of files available in the DIR/text directory. These files are sent out in response to specfic user requests or as part of all outgoing messages. Edit them as necessary.
EditTextFile = Change this text according to your needs. Maybe you would like to use some of the reserved tags, that are described at the bottom of this page.
ResetTextFile = This text file was customized for this list. If you want to use the system-wide default text file of the choosen language instead, you may remove this customized file.
GnupgConvert = You can convert a normal mailinglist to an encrypted list and vice versa.
GnupgGenerateKey = Every encrypted mailing list needs a secret key. You can import this key or create it using the form below. After submitting the form, you have to be patient, as it takes some time (up to several minutes) to create a key.
Legend {
ConfigAdmin = Remote administrator's permissions
ConfigArchive = Archive configuration
ConfigPosting = Posting rules
ConfigSub = Subscription details
ConfigMain = General list configuration
ConfigProcess = Processing rules
ConfigAll = Available properties
ListCreate = Properties of the new list
ListDelete = Remove this mailinglist
RelevantOptions = Useful settings
MembersList = Manage subscribers
MembersAllow = Manage allowed users
MembersDeny = Manage blocked users
MembersDigest = Manage digest subscribers
MembersMod = Manage moderators and administrators
TextFiles = Available text files
TextFileEdit = Edit content of text file
TextFileReset = Discard customized text
TextFileInfo = Useful placeholders
AvailableLists = Available lists
GnupgConvert = Encryption support
GnupgPublicKeys = Public keys of this list
GnupgSecretKeys = Secret keys of this list
GnupgKeyImport = Import a key
GnupgGenerateKey = Generate the key for this list

View File

@ -1,6 +1,5 @@