Multilanguage glitches

A bit wide of a title but…

I am working on a website based on the plainkit to which I added a second language in the config file, then started to build on it using the panel, not by creating txt’s manually

After many work on bp’s and pages, I tried to change the default language in the config file, and this resulted in many pages not responding to their blueprint in the panel.

Looking at content, most pages are not translated: they don’t have a .txt per language. Why ? shouldn’t this happen automatically? does it only happen if I modify the other language content?

If I modify all the fields for the other language will it create the files then I will be able to switch default language?

Duplicating and renaming manually all those files seems something crazy to do.

Thank you!

When switching from single language to multi-language you always have to make sure that you first add the language extension to all text files, that is not done automatically in the Panel and can lead to all sorts of issues, the more so if you start changing the default language midway. This is not ideal, maybe, but explained in the docs. This can usually be done by some batch renaming either in terminal, via Finder on a Mac or some third party tool.

Make sure that you don’t have any files without language extension.

1 Like

Yes but even when multi-language is already set, the secondary languages files are only created when you translate at least one of the fields, so if you want to switch languages afterwards, the language file will indeed be missing if you’ve not translated at least one of the fields in the new default language.

1 Like

@sylvainjule Yes, that is absolutely correct. However, I did a quick test with the langkit.

  • Using the default settings, I created a new page in the standard language (EN) in the projects folder.
  • A new page with a text file with the language extension en was created (no German text file).
  • Then, I set German as the default language in the config.
  • I opened my new project page again
  • I entered some text in German and saved.
  • A text file with the German extension was created.

So, according to this quick test, everything seems to work as expected. Let me know if that is not the case for you.

The main problem usually stems from the fact that language extensions are missing. Then the Panel gets confused.

Anyway, I hope we will see a more robust solution in Kirby Next.

Thank you

I’ve checked and all my text files have the default lang extensions, some files exist for the second lang, and none without extension.

I believe this means I did it correctly and I am safe?

Now If I change default language AND the url extension from this:

c::set('languages', array(
	array(
		'code'		=>	'es',
		'name'		=>	'Spanish',
		'default'	=>	true,
		'locale'	=>	'es_MX',
		'url'		=>	'/',
		),
	array(
		'code'		=>	'en',
		'name'		=>	'English',
		'locale'	=>	'en_US',
		'url'		=>	'/en'
		),
));

to this:

c::set('languages', array(
	array(
		'code'		=>	'es',
		'name'		=>	'Spanish',
		'locale'	=>	'es_MX',
		'url'		=>	'/es',
		),
	array(
		'code'		=>	'en',
		'name'		=>	'English',
		'default'	=>	true,
		'locale'	=>	'en_US',
		'url'		=>	'/'
		),
));

most icons dissappear, as if the pages in the panel were not responding to their blueprints. (edit, I confirm the pages appear as using the default blueprint instead of theirs) What could cause that?

How should I proceed? Should I fill a field in every page, so everything gets its own 2nd language .txt file, then attempt to change the default language?

I would like to mark many fields as non translatable. Should that be done after or before any of this steps?

Thank you very much for your help!

As I said, I can’t reproduce the missing icons or wrong blueprint issue. Are you using the latest Kirby version? Are you using any plugins?

To be on the safe side, it’s probably a good idea to create all text files in all languages before switching the default language. Either via the Panel, by just filling the title field. Or, maybe even do that programmatically.

Toolkit version: 2.5.1
Kirby version: 2.5.1
Panel version: 2.5.1

Custom fields and plugins:

Ok I will attempt to create all text files by either option, before trying to switch default lang.

Thank you,

I remember there was an issue that was fixed in 2.5.3, see changelog. That explains your problems and why it worked correctly in my test environment (K 2.5.4)

Multilang: Correctly detect the intended template if only a content file of a non-default language exists #490

Ahá! that makes sense, thank you.

I am considering upgranding.

If I look for open issues bugs at github kirby and panel I find several related to multi languages.

But I am not sure how to check if these were introduced by the update or just not fixed.

I’d rather create the files by hand or programatically rather than introducing new problems.

What do you think?

Thank you

All of these are old issues (i.e. they are present in 2.5.1 as well). But I can’t really recommend upgrading to 2.5.4 at the moment, because of a Panel bug introduced in 2.5.3 relating to structure fields. It’s already fixed on the dev branch but I don’t know when we are going to ship the release. If you can live with the dev version, I’d upgrade. Otherwise, wait for the next release.

Oh, you mean the download here is not a proper release: https://getkirby.com/changelog/kirby-2-5-4

Where are official complete releases announced / provided for dl?

If you would not upgrade, I guess you’d suggest creating all the files first instead ?

Thank you texnixe, very helpful.

edit /
Here: https://getkirby.com/docs/installation/download which links to here: http://download.getkirby.com/ return 2.5.4 ?

edit2/
I think what you mean is that these bugs introduced by 2.5.3 have not all of them been fixed in 2.5.4.

Yeah, 2.5.4 was a hotfix because of a serious bug introduced in the last minute.

Yes, either upgrade or create the pages before switching.

1 Like