Localization / translation

Since all Bitwarden clients have been translated into many languages it would also be nice if Vaultwarden was not only available in English. Especially because there might be additional users who receive Vaultwarden mails and might not understand English as well as the admin of the server.

If your users don’t understand English you can translate the handlebar templates into your preferred language.

You can use customized templates by

  1. copying the respective files from src/static/templates/email to data/templates/email (where data refers to your DATA_FOLDER and I’m assuming you did not change the TEMPLATES_FOLDER to something else)
  2. changing them (e.g. translate them - but be sure to keep the {{variables}} intact so the links still work) and
  3. restarting vaultwarden to load them.

This can only be done server wide as there is currently no way to either provide the templates in multiple languages to the server or even then for the server to know which language a user wants or needs (i.e. the preferred/selected language is AFAIK only stored client-side / dependend on the client’s locale setting).

Note that the Bitwarden server also has its mail templates in English.

I’ve seen the template files too but I was thinking more of a variant that would benefit all users.
The language could be set as a new option in the admin panel. The web vault also has a fixed language. Possibly this could be taken from there.
Interesting that the Bitwarden server also has only English mail templates. Is that also the case with the cloud version? That could then become a unique feature of Vaultwarden.

The Bitwarden client supports over 50 languages but as I said the server does not even know about the client language settings. Because this is handled entirely client-side. So by default the web-vault just uses the Browser’s locale settings (i.e. which language you have selected). You can change it in your account’s settings to another language but this will only be stored in the Local Storage of that browser.

I think that we would need to actually translate these files first before talking about specific solutions making this more convenient.

That was the point of this feature request. Offering a community-driven solution like Crowdin to get the translations and then integrate them into the server.

Why is the client language relevant? The language of mails and the admin panel could be set in the admin panel itself and as far as I know these settings are not stored locally.

You mentioned how it could be taken from the web-vault and I explained how this is (currently) not possible.

edit: I’ve created a wiki page that explains how translating the email templates works.

There is an item on there roadmap for Enhanced Localization, but that is not something we could use i think.

I’m not sure if we could leverage something like crowdin maybe to help and translate those mails. And then, we can only have one default language and not dynamic.

So, for now, i suggest to translate it your self.

As far as i know this Bitwarden roadmap item is for combining all Crowdin projects into one like they already did with the client Github repos. This will improve the translation consistency between all clients.

I doesn’t need to be Crowdin. Other repos using Github itself where translators create a PR with their translated template files. But plattforms like Crowdin make it easier of course.
Isn’t it relatively easy to integrate a language selection which templates should be used into the admin panel, or am I missing something?

Still, Bitwarden only has English for emails too.
The localization per user is not stored in the database and only within the clients.

Bitwarden also does not support storing the language profile of the user on the server.
The only thing we could do is make some kind of selection in the admin/env where you can say i want to use en_US, nl_NL or de_DE as default mail language. And if that folder exists then use that.
But for one, we do not have that available right now. We do not support multi-language mails.

And, you would then force all users to use that default language, and no way to use a different language for specific users.

If the default language is English most of the users wouldn’t even notice this new language setting.
Setting a different language for specific users is a special use case in my opinion. I think all users can agree to use one language that was set by the admin.

You can already set the language by providing the translated handlebar files in data/templates/email/ - the problem is that those translations do not exist yet. We don’t have the manpower to translate those files ourselves and so far there has been neither the demand nor an effort to share those translations.

So the first step for me would be for others to somehow provide translated files - maybe we could collect them on the wiki page I’ve linked above?

Having a mechanism to make this easier than downloading files from another repository and integrating it into the vaultwarden server itself is something we can discuss once there is a substantial number of translations, so we can keep them up-to-date ourselves somehow. But at least for now I don’t think there is a reason to work on improving the existing mechanism.

Regarding crowdin: I don’t have any experience in setting up crowdin (and it looks like it’s a proprietary product so maybe we want to use another solution) but maybe you could step up and begin by setting up a vaultwarden_l10n project yourself with just those email templates?

I will try to create a translation for the whole template folder including the admin panel. The wiki page would be a start.
I also tried to create a new project at Crowdin with these template files. This worked in principle, but because the files also contain other code that should not be translated, manual work is necessary. It seems that Crowdin only allows you to show or hide automatically recognized code parts for the translators. Removing parts from it does not work if it is not a supported format.
Alternatives would be Weblate and POEditor. Weblate is open source, but only free if you host it yourself. According to the docs, it at least supports HTML files and could probably recognize most of them automatically. HBS specific parts probably not. POEditor does not even accept HBS or HTML files.
I think the best way would be to create one or more files in a supported format (e.g. json files like Bitwarden clients/messages.json at master · bitwarden/clients · GitHub), which contain only the strings to be translated. These would then also have to be replaced by variables in the HBS templates. I could create the list of all strings from the templates.
I think if the barrier to translation is low as on such platforms, then with good communication here and on Github more languages could follow.

I have now translated all mail templates to German and created a Github repo for it: https://github.com/kennymc-c/vaultwarden-lang-de

I also noticed a few issues and inconsistencies between plain text and html texts. For this I have created a PR.

I also left the 404 page out for now, since the graphic contains English text.
I also tried to translate the admin panel via the template files in the admin folder but this seems to contain only a small part of all texts. Other parts are probably in the scripts folder or somewhere else but adapting them obviously doesn’t make sense if you don’t want to manually adapt every change to your translated version.
Changes or additions to the original are also generally the big problem of this kind of translation as already mentioned in the wiki. If I would get an example how variables from another file should look like in the templates and how this variable file should look like, I could create that myself as a basis for other translations.

1 Like

I’ve update the wiki page with a link to your repository so it is easier to find. :+1:

Sorry, I am not sure what you mean or trying to accomplish.

1 Like

Handlebar files can already contain variables. My question was how a file should look like, in which these variables are defined or specified. Inserting content from other files already works via partials but here only the complete code from the other file is inserted. For translated strings it would have to be only certain parts of a file. Also, the English version of this file would have to be used as the master if a variable was missing from the translated file. Is this possible via handlebars or would it have to be solved in a completely different way?