Hugolify / hugolify-decap-cms

Decap CMS for Hugolify
MIT License
0 stars 1 forks source link

English default language not working #2

Closed Mecanik closed 9 months ago

Mecanik commented 9 months ago

Hello,

Thank you for this amazing project. Please note that if you set the default language to en the /admin will not load anymore.

Furthermore, even if you use fr and en as available languages, only the fr loads.

Thanks

arthaud-proust commented 9 months ago

Hello Mecanik, thanks for your issue and your interest for Hugolify,

I have some questions to better understand your issue (after some tests I wasn't able to reproduce) :

To clarify, we have two things related to languages in the cms :

I hope my comment will help to solve the problem or to better understand the issue, let me know if I missed something. Thanks

Mecanik commented 9 months ago

Hello,

The documentation does not talk about admin/app/config/locale.js only available-languages.js (from what I can see), so I haven't touched locale.js yet.

The issue is that the CMS is only available in French and no English. After trying to edit available-languages.js, if you leave only 'en' the admin area won't load anymore. Errors are present in the console. If you leave 'fr', 'en' then the admin area loads and you can edit content in both FR and EN.

Now for the life of me I cannot understand why the admin area works now and it didn't yesterday, maybe you updated something?

Thanks

arthaud-proust commented 9 months ago

Hello,

Thanks for your informations.

To change the language of the cms ui, you need to change the locale in admin/app/config/locale.js. You can set it to 'en' to get CMS in English. Currently, this is not in the documentation so I'll add it. Thanks for having noticed it.

I think the errors was caused by the cache, because we didn't update the module yesterday and I cannot reproduce the error with informations you given.

I tested (and cleared cache after relaunched servers) :

Please note that the order in availableLanguages define the order of languages in content edition

If errors remains, please let me know by sharing your availableLanguages and locale.

sebousan commented 9 months ago

@arthaud-proust shouldn't we put this locale variable in availableLanguages?

arthaud-proust commented 9 months ago

@arthaud-proust shouldn't we put this locale variable in availableLanguages?

I would argue to keep different files because they aren't of same concern :

But locale is used for i18n config to set default for available languages. I think this is an issue because we are merging two variable of separated concerns in this file.

I see two ways :

  1. we keep the two files and we continue separating those two variables by adding a defaultLanguage variable in available-langues.js to set defaultLanguage for i18n. So that locale is only used to set cms ui language.
  2. or, we put the locale inside availableLanguages, in this case availableLanguages will have two concerns : cms ui language and content language.

To respect separation of concerns I propose to go on the 1.

Mecanik commented 9 months ago

The current configuration system is OK, I just did not look at /admin/app/config/locale.js because it wasn't mentioned in the docs. Frankly, most people don't even read the docs... but when someone does read it, it would be nice to mention it.

Problem solved now and the CMS works in English and the main site as well.

Thanks