How to offer different translations for virtual namespaces with userdb?
Hi everyone,
I'd like to configure a feature that, based on userdb locale settings, returns with differently translated string for the same virtual namespace mailbox name.
This is where I ended up so far:
group @namespaces virtual-virtual-english { mailbox All { auto = no special_use = \All } }
group @namespaces virtual-virtual-hungarian { mailbox "Összes levél" { auto = no special_use = \All } }
namespace virtual-virtual { prefix = Virtual/
separator = / mail_driver = virtual mail_path = /var/lib/dovecot/virtual/virtual mail_index_path = %{home}/index/virtual/virtual namespace_subscriptions = no
list = children hidden = no }
UserDB query works:
Debug: Added setting via userdb: namespace/virtual-virtual/@namespaces=virtual-virtual-hungarian
I had to create symlinks in the virtual/virtual directory (otherwise the Hungarian version wouldn't work):
virtual/virtual
All &ANY-sszes lev&AOk-l -> All/
When I list the mailboxes, however, I get back all of them, not just the matching-language elements:
- LIST (\Noselect \HasChildren) "/" Virtual
- LIST (\HasNoChildren) "/" "Virtual/&ANY-sszes lev&AOk-l"
- LIST (\HasNoChildren \All) "/" Virtual/All
"list", "hidden", and "prefix" are seemingly not allowed within a group.
How can I offer different translations for different users in my home setup? Is it possible to translate the namespace prefix?
Dovecot version: 2.4.1.
Thank you,
Ákos
On 21/08/2025 18:25 EEST Ákos Szőts via dovecot <dovecot@dovecot.org> wrote:
Hi everyone,
I'd like to configure a feature that, based on userdb locale settings, returns with differently translated string for the same virtual namespace mailbox name.
This is where I ended up so far:
group @namespaces virtual-virtual-english { mailbox All { auto = no special_use = \All } }
group @namespaces virtual-virtual-hungarian { mailbox "Összes levél" { auto = no special_use = \All } }
Would it work better with
group @namespaces virtual-virtual-english { namespace virtual-virtual { mail_path = /var/lib/dovecot/virtual/virtual-en mailbox All { auto = no special_use = \All } } }
group @namespaces virtual-virtual-hungarian { namespace virtual-virtual { mail_path = /var/lib/dovecot/virtual/virtual-hu mailbox "Összes levél" { auto = no special_use = \All } } }
You need to point the mail_path to language specific location as well, otherwise it will see all mailboxes specified there.
Aki
Would it work better with
group @namespaces virtual-virtual-english { namespace virtual-virtual { mail_path = /var/lib/dovecot/virtual/virtual-en mailbox All { auto = no special_use = \All } } }
[...]
Thank you, this will be the right direction. This way, I can even translate the prefix, too.
However, I found a bug (I think). Out of the following three scenarios, the "namespace within a group" setting doesn't automatically create the indices.
I removed all userdb config and kept only English to minimise the reproducer. The dovecot-virtual file was kept intact across the scenarios:
/var/lib/dovecot/virtual/virtual/en/All: * -Trash -Trash/* -Junk -Junk/* all
*Scenario 1: namespace within a group*
rm -rf the virtual index directory, then start Dovecot with the following config:
group @namespaces-virtual-virtual english { namespace virtual-virtual { prefix = Virtual/ separator = / mail_driver = virtual mail_path = /var/lib/dovecot/virtual/virtual/en mail_index_path = %{home}/index/virtual/virtual/en namespace_subscriptions = no list = yes hidden = no
mailbox All { auto = no special_use = \All } } }
@namespaces-virtual-virtual = english
There are no children under Virtual/:
a LIST "" *
- LIST (\Noselect \HasNoChildren) "/" Virtual
Debug messages:
Namespace virtual-virtual: type=private, prefix=Virtual/, sep=/, inbox=no, hidden=no, list=yes, subscriptions=no fs: root=/var/lib/dovecot/virtual/virtual/en, index=/var/spool/mail/[...]//index/virtual/virtual/en, indexpvt=, control=, inbox=, alt= Namespace virtual-virtual: Using permissions from /var/lib/dovecot/virtual/virtual/en: mode=0755 gid=default Mailbox Virtual: Couldn't open mailbox in list index: Mailbox not found
Index directory content:
./virtual ./virtual/en ./virtual/en/dovecot.list.index.log
*Scenario 2: namespace without group*
The very same config snippet as above, but without the "group @namespaces-virtual-virtual english" and the "@namespaces-virtual-virtual = english" lines. Removed the previous, incomplete, index directory, too.
In this case the listing succeeds:
a LIST "" *
- LIST (\Noselect \HasChildren) "/" Virtual
- LIST (\HasNoChildren \All) "/" Virtual/All
Debug messages:
Namespace virtual-virtual: type=private, prefix=Virtual/, sep=/, inbox=no, hidden=no, list=yes, subscriptions=no fs: root=/var/lib/dovecot/virtual/virtual/en, index=/var/spool/mail/[...]//index/virtual/virtual/en, indexpvt=, control=, inbox=, alt= Namespace virtual-virtual: Using permissions from /var/lib/dovecot/virtual/virtual/en: mode=0755 gid=default Mailbox Virtual/All: Couldn't open mailbox in list index: Mailbox not found Mailbox Virtual/All: Mailbox opened Mailbox Virtual: Couldn't open mailbox in list index: Mailbox not found Mailbox Virtual: Couldn't open mailbox in list index: Mailbox not found Mailbox Virtual/All: Couldn't open mailbox in list index: Mailbox no longer exists in index Mailbox Virtual: Couldn't open mailbox in list index: Mailbox not found
Index directory content:
./en ./en/All ./en/All/dovecot.index.log ./en/dovecot.list.index.log
*Scenario 3: going back to group after created indices*
Here, I didn't remove the index files but re-added the previously removed "group..." config lines. In this case the listing succeeds with a lot less debug message:
Namespace virtual-virtual: type=private, prefix=Virtual/, sep=/, inbox=no, hidden=no, list=yes, subscriptions=no fs: root=/var/lib/dovecot/virtual/virtual/en, index=/var/spool/mail/[...]//index/virtual/virtual/en, indexpvt=, control=, inbox=, alt= Mailbox Virtual: Couldn't open mailbox in list index: Mailbox not found
Ákos
Would it work better with
group @namespaces virtual-virtual-english { namespace virtual-virtual { mail_path = /var/lib/dovecot/virtual/virtual-en mailbox All { auto = no special_use = \All } } }
[...]
Thank you, this will be the right direction. This way, I can even translate the prefix, too.
However, I found a bug (I think). Out of the following three scenarios, the "namespace within a group" setting doesn't automatically create the indices.
I removed all userdb config and kept only English to minimise the reproducer. The dovecot-virtual file was kept intact across the scenarios:
/var/lib/dovecot/virtual/virtual/en/All: * -Trash -Trash/* -Junk -Junk/* all
Scenario 1: namespace within a group
rm -rf the virtual index directory, then start Dovecot with the following config:
group @namespaces-virtual-virtual english { namespace virtual-virtual { prefix = Virtual/ separator = / mail_driver = virtual mail_path = /var/lib/dovecot/virtual/virtual/en mail_index_path = %{home}/index/virtual/virtual/en namespace_subscriptions = no list = yes hidden = no
mailbox All {
auto = no
special_use = \All
}
}
}
@namespaces-virtual-virtual = english
There are no children under Virtual/:
a LIST "" *
- LIST (\Noselect \HasNoChildren) "/" Virtual
Debug messages:
Namespace virtual-virtual: type=private, prefix=Virtual/, sep=/, inbox=no, hidden=no, list=yes, subscriptions=no fs: root=/var/lib/dovecot/virtual/virtual/en, index=/var/spool/mail/[...]//index/virtual/virtual/en, indexpvt=, control=, inbox=, alt= Namespace virtual-virtual: Using permissions from /var/lib/dovecot/virtual/virtual/en: mode=0755 gid=default Mailbox Virtual: Couldn't open mailbox in list index: Mailbox not found
Index directory content:
./virtual ./virtual/en ./virtual/en/dovecot.list.index.log
Scenario 2: namespace without group
The very same config snippet as above, but without the "group @namespaces-virtual-virtual english" and the "@namespaces-virtual-virtual = english" lines. Removed the previous, incomplete, index directory, too.
In this case the listing succeeds:
a LIST "" *
- LIST (\Noselect \HasChildren) "/" Virtual
- LIST (\HasNoChildren \All) "/" Virtual/All
Debug messages:
Namespace virtual-virtual: type=private, prefix=Virtual/, sep=/, inbox=no, hidden=no, list=yes, subscriptions=no fs: root=/var/lib/dovecot/virtual/virtual/en, index=/var/spool/mail/[...]//index/virtual/virtual/en, indexpvt=, control=, inbox=, alt= Namespace virtual-virtual: Using permissions from /var/lib/dovecot/virtual/virtual/en: mode=0755 gid=default Mailbox Virtual/All: Couldn't open mailbox in list index: Mailbox not found Mailbox Virtual/All: Mailbox opened Mailbox Virtual: Couldn't open mailbox in list index: Mailbox not found Mailbox Virtual: Couldn't open mailbox in list index: Mailbox not found Mailbox Virtual/All: Couldn't open mailbox in list index: Mailbox no longer exists in index Mailbox Virtual: Couldn't open mailbox in list index: Mailbox not found
Index directory content:
./en ./en/All ./en/All/dovecot.index.log ./en/dovecot.list.index.log
Scenario 3: going back to group after created indices
Here, I didn't remove the index files but re-added the previously removed "group..." config lines. In this case the listing succeeds with a lot less debug message:
Namespace virtual-virtual: type=private, prefix=Virtual/, sep=/, inbox=no, hidden=no, list=yes, subscriptions=no fs: root=/var/lib/dovecot/virtual/virtual/en, index=/var/spool/mail/[...]//index/virtual/virtual/en, indexpvt=, control=, inbox=, alt= Mailbox Virtual: Couldn't open mailbox in list index: Mailbox not found
Akos
participants (2)
-
Aki Tuomi
-
Ákos Szőts