Has anyone thought of an easy way to make translation scalable by letting users activate multi language and create their wanted languages from their website settings in the panel and somehow let them edit and manage the translations of language variables themselfs ? (this is how multi language, by good reasons, works for Shopify themes)
You could simply create a subpage with a structure field with simple key-value pairs… As support for multiple languages is built in to Kirby an the Panel, you’ll be able to add different strings for each language. Still, this isn’t the most user-friendly way.
If you only need translations for a fixed set of expressions, it could be even simpler to create a separate blueprint for this purpose.
Yeah I’ve thought about that, but it seems a bit too hacky and out of context
I might have to venture into some hooks to modify the language variable files within site/language. But I think the difficult part will be to make it possible for users to enable multiple languages and edit it’s set of language variables based on an English default and keep it editable without having to render potentially 1000s of input fields on the site settings page.
In any case, you would need to enable the multi-language feature in the first place, even if only with one language, so that you can call language variables in your template and avoid having to rename the content files after switching on multi-language.
Yeah, and I think it’d still raise the same issue if the initial default language is for instans ‘de’ and then further down the road, I want to support more languages and the default language is changed to ‘en’ as per my issue over here https://github.com/getkirby/kirby/issues/295
(…or maybe it’s what’s causing it - can’t remember)
Yes, that is another important point. I really hope that this issue will be resolved in the upcoming version.
I have an idea how this could be achieved:
The burger menu of the panel displays a new menu item (e.g. “Translation”), if the website is a multi-language site and has at least one language file in the folder /site/languages
.
This panel page shows all language variables of the default language and the content of the language file in the respective language of the panel, so that the panel user can enter all translations in the fields. This page is saved in the respective language file in the folder /site/languages
like https://getkirby.com/docs/languages/variables.
If the language file is missing in any existing language, it will be created when saving on this language page.
May be “Add a new language variable” is only visible in the default language or never (the admin has to add new language variables in the language file of the default language manually).
I look forward to what @bastianallgeier says.
Thank you for your input @anon77445132, that’s actually a pretty nice idea!
@distantnative seems to already have picked up upon this over here https://github.com/getkirby/kirby/issues/403
Great stuff!
Hello @texnixe,
I agree completely.
what’s about adding your cited hint at https://getkirby.com/docs/installation/panel, if you or your team finds time for this?
@anon77445132: I don’t think that’s the right section to add this, it would have to go into the languages section.
Sorry, if a novice starts his/her first Kirby website and this with multi-language he/she should know this before he/she starts the input of any webpages.
Therefore I think this is the first place he/she reads anythink about the panel and its possibilities.
Please reread your quoted post, he/she should know this in front of any input of contents I think.
I know that this a substantive order contradicts but chronological it belongs here, with a link to https://getkirby.com/docs/languages/setup of course.
Well, it would be only a small first step. But I would highly dislike editing the current .php config files, so having languages files as .yml might be better for this. I don’t see custom panel views coming with the next release but maybe a custom front-end edit corm work for your case already?
Edit: And a quick sketch how such a front-end editor could be realized - https://gist.github.com/distantnative/1f5305bd4269937ecd69
@anon77445132: Maybe a separate language section in the Getting Started section makes sense, but the language setup has nothing to do with the panel installation.
I agree entirely to this but a hint with a link may be good
You’re completely right about this one
That’s awesome! -thank you very much for the gist and fast response to this Nico