ahmedkaludi / wp-multilang

14 stars 2 forks source link

Language switcher is missing in block editor #14

Closed g4rf closed 3 months ago

g4rf commented 4 months ago

Hello and thanks for starting to maintaine the plugin again. As a problem I ran into, the language switcher is not shown anymore in the block editor, as the block editor core changed and the javascript hack of Valentyn do not work anymore. I rewrote the hack in my own fork.

Nevertheless: Both, Valentyn's solution and mine, are javascript hacks and there must be something like a button API in the block editor, that should be the better approach.

Sanjeevsetu commented 3 months ago

Hi @g4rf

I can see Valentyn's and yours javascript hacks solution are still working. Can you cross check it once??. And we are yet unable to find any API or hooks in block editor. As soon as We find it, We will implement.

g4rf commented 3 months ago

Hi @Sanjeevsetu

thanks for digging into this issue. With the current version 2.4.5 the language switcher is (sometimes) not shown in posts:

grafik

It's because of a race condition: The javascript snippet tries to loads the language switcher, but the gutenberg toolbar isn't loaded yet. That's why I rewrote the javascript snippet with a deferred loading mechanism.

I opened the pull request #51 to solve this issue.