How to let a customer translate his Kirby website?


I try to build a SaaS project. I started with WordPress but finally decided to switch to Kirby.
The SaaS service will provide a turn key website for conference organisers.

By default, the website is in English, but I don’t know which nationality my customers will be.
So imagine my customer will be German and wants his website in German. I don’t know with Kirby how to let him translate his website in German.

There is this awesome plugin but it suppose you know in advance which language to set up in your Kirby website.

Has someone already found a solution to this problem ?


Is the website supposed to be single or multi-language?

In a single language website, I would use site settings to define the parts of the site that need to be translated. URLs can be translated via the URL settings but you should make sure that you don’t use page ID for styling.

In a multi-language website, you can probably define the required languages via site settings and create the array of languages from there. Then you can use @rasteiner’s plugin to translate the strings.

Edit 2:

As regards the Panel, you would have to localize form labels. You could probably do that via a plugin as well, unless you provide labels for all or at least the most important languages :slight_smile:

so you are developing a “SaaS theme” to sell along a kirby license?

translating websites/themes
like @texnixe asked… if you create a all purpose SaaS-theme you might have to ship will multi-language setup. my suggestion would be to create a plugin and only register the languages the customer needs.
if setup, even if using just one language you can use language variables and @rasteiner 's plugin.

The panel will be localized based on the account created.

Each customer will have a VPS with his webserver and Kirby website installed so I will buy a commercial licence for each customer.

I don’t know, it’s depend of the customers. Some will need a single language (and I don’t know which language in advance) and other multilinguals.

In fact I would like to provide to my customer the possibility to translate the form labels, alert message (front labels) … and panel labels in their language (and optionality in other languages for a multilingual website) without my intervention, just after deploying the website.

All the frontend stuff can be done via @rasteiner’s plugin or something similar you create yourself, using c::get() or l::get() depending on setup. As @bnomei suggested, it would probably make sense to make a multi-language setup the default, even if you only use a single language. You should then be able to create the language settings array via some site settings.

As regards Panel labels, I’m not sure.

I somehow feel dragged into this discussion. :wink:

Maybe some clarification about my plugin:
it is intended for multi language sites (in your case that would be a single customers website which is translated in many languages). Not to create many translations of a template.

Your use case seems to be different: you want many websites, but each website will have only one language. In this case my plugin would not really be helpful.

Yes, I think we all understood that. But it is all about translating strings for the frontend, and for a multi-language setup or even for a single language setup with one language defined in config it might well work or at least serve as a basis.

I check the documentation but there is not many details, what is the difference between c::get() and l::get() ?


c::get() to get language setting from the config file
l::get() to get a translation from a language file

I’m right?

c is for config. like a global.
l is based on current detected language and read from files stored at /site/languages.

Ok thanks @bnomei :slight_smile:

Unfortunately I can’t as explained in this thread:

Is it possible to add new language from panel?
So I define only default language and other languages will be added from panel?


No, the language setup has to be defined in the config.php file.

Edit: see also my suggestion here: Translation and config.php Bug?

It is important to keep in mind, though, that if a user deletes a language from the configuration, the then unnecessary text files for that language would have to be removed manually from the file system (unless you write a plugin that does that as well), because otherwise these files could cause trouble in the Panel.

1 Like