wintercms / wn-pages-plugin

Static Pages plugin for Winter CMS
https://wintercms.com/
MIT License
9 stars 22 forks source link

Can't translate the pages #26

Closed hambern closed 1 year ago

hambern commented 1 year ago

Description:

I'm trying to get this to work with Winter.Translate (v.2.1). But I can not get them to work together. The only field I can translate is the url-field, nothing else. And when I use already translated pages from an old installation, it can't shift between the languages.

Steps To Reproduce:

Install Winter.Translate and Winter.Pages via composer and then try to translate the fields in the pages.

mjauvin commented 1 year ago

You must use Winter.Pages version 2.0.2.

hambern commented 1 year ago

Well... I do... But I upgraded from the Rainlab versions of the plugins. Could that be the problem?

mjauvin commented 1 year ago

Did you run the migrations?

php artisan migrate

hambern commented 1 year ago

Yes. I've even reinstalled the both plugins several times. No luck. Regular textfields is translatable. Lite when you add buttons to the menu, but not the big "content"-field or the "title"-field. And if i add /en or /sv in the url to get the different translation, all I get is "Page not found". Maybe it's more a Winter.Translate issue than a Winter.Pages issue...

brutalhost commented 1 year ago

I confirm that this problem still exists. I found such a pattern: if you enter content and a title for different languages, the last entered data is driven into the storage of all languages. That is, if I first enter information for the first language, and then for the second - after saving on the site itself, I will only see what I entered for the second language.

mjauvin commented 1 year ago

I can't reproduce this.

Can you try this from a fresh install of winter cms and plugins? Also, don't include plugins other than translate and pages.

brutalhost commented 1 year ago

What have I done to repeat the problem:

  1. utf8mb4_unicode_ci database for Cyrillic support
  2. Installed Winter CMS using install.html
  3. Entered commands in the console:
    composer require winter/wn-pages-plugin
    php artisan winter:up
    composer require winter/wn-translate-plugin
    php artisan winter:up
  4. Settings -> Language Management (/backend/winter/translate/locales): Added the language "Русский" with the code "ru", the "default" checkbox is set. I changed the order of languages, now Russian is in the first place, English is in the second
  5. Added to the standard page template: {%component 'localePicker' %} with the "Force URL schema" setting {% component 'staticPage' %}
  6. Changed the backend interface language to Russian
  7. After these operations, I create a page. After entering Cyrillic texts and clicking on the "Save" button, for some reason, the CMS displays a red icon that the page has not been saved. I press it a second time and the unsaved data notification icon disappears I try to open the page - it opens correctly in Russian. Then I try to edit the page again, but in English. I'm saving it. The new content replaces what I entered in Cyrillic. Now, when opening the /en/my-page and /ru/my-page pages, the same content opens
mjauvin commented 1 year ago

Do you see any errors in the JavaScript console when you save the page (first or second time) ?

brutalhost commented 1 year ago

Do you see any errors in the JavaScript console when you save the page (first or second time) ?

Now I tried to change the pages again and they are saved as they should, in the sense that they are saved the first time. There are no errors in the browser console. I will add that PHP 8.1.9 and Apache 2.4 are used on the server

mjauvin commented 1 year ago

And if you create a new page?

brutalhost commented 1 year ago

And if you create a new page?

Yes, there are no error notifications on the frontend. I figured out the reason for the unsaved entry icon: this happens when I write text in the content field and immediately press Ctrl + S. If I write text and after a longer period of time click on "Save" - the icon does not appear. So the appearance of the icon is not related to the save bug.

mjauvin commented 1 year ago

Ok.

But you said the bug didn't show up the second time around. I wanted to know if this is true for any NEW page you create.

brutalhost commented 1 year ago

I apologize for my Google Translate, but this bug works in all cases: both when editing and when saving. In that text about re-saving, it was the icon that confused me. In fact, saving the document is always processed and it happens according to the same scenario with the presence of a bug: for the standard locale, only the last texts entered in the form fields are saved. For the minor locale, all fields are empty.

brutalhost commented 1 year ago

Here is the video: video link

mjauvin commented 1 year ago

Can you please try version 2.0.2 and confirm the bug does not trigger?

mjauvin commented 1 year ago

@LukeTowers from my testing, something got broken with version 2.1.0 (worked fine up to 2.0.3)

brutalhost commented 1 year ago

Can you please try version 2.0.2 and confirm the bug does not trigger?

There is no bug on version 2.0.2. Translations work

LukeTowers commented 1 year ago

We've identified the issue and I'm working on a fix right now

ivang76 commented 1 year ago

Hi @LukeTowers, have you an idea of a timeline for this fix maybe? I found it as well and at the moment I just forced the downgrade but the editors missed some contents and they have overwritten urls, so you can imagine ;-) thank you!

ivang76 commented 1 year ago

any updates? thank you

LukeTowers commented 1 year ago

Still working on the fix, just finished the improvements to the four plugins (Translate, Sitemap, Pages, & Blog) that will allow for multilingual sitemaps so I'm moving back to fixing this issue now.

mjauvin commented 1 year ago

@ivang76 @hambern @brutalhost, if you can test this fix in your environment, that'd be nice!

der-On commented 1 year ago

Thanks for fixing this! :bow:

ivang76 commented 1 year ago

@mjauvin sorry for the late and thanks a lot for the fix. I'm using the latest version on different sites and everything seems work correctly! just one question... I don't remember if there was some artisan command or similar for this, but I see that the versions in the backend system/updates are different from the ones managed via composer. How can I keep them updated?

mjauvin commented 1 year ago

@ivang76 the backend system/updates is non functional for now. Once the marketplace is released, it will be possible to use either that or composer to manage plugins/themes.