Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for translating RainLab.Pages MenuItem properties #590

Merged
merged 20 commits into from
Aug 6, 2020
Merged

Add support for translating RainLab.Pages MenuItem properties #590

merged 20 commits into from
Aug 6, 2020

Conversation

mjauvin
Copy link
Contributor

@mjauvin mjauvin commented Aug 3, 2020

Complements rainlab/pages-plugin#445

  • changes the MenuItem title/url fields to MLText formwidget
  • handle the pages.menu.referencesGenerated event to replace MenuItem title/url with their translation (if available)

Plugin.php Outdated Show resolved Hide resolved
@mjauvin
Copy link
Contributor Author

mjauvin commented Aug 3, 2020

@LukeTowers We can include the url field as well, all other content is irrelevant in the menu. CMS/Static pages URLs are translated on their own.

Frankly, translating the title and URL will solve the problem for a lot of people. What other cases do you think of?

@mjauvin
Copy link
Contributor Author

mjauvin commented Aug 3, 2020

Screenshot from 2020-08-03 18-54-39
Screenshot from 2020-08-03 18-54-58

name: test-menu
items:
    -
        title: 'My Title'
        type: url
        url: 'My URL'
        code: ''
        viewBag:
            locale:
                fr:
                    title: 'Mon Titre'
                    url: 'Mon URL'
                es:
                    title: 'Mi Titulo'
                    url: 'Mi URL'
            isHidden: '0'
            cssClass: ''
            isExternal: '0'

@LukeTowers
Copy link
Contributor

@mjauvin how does it handle the other reference types?

@mjauvin
Copy link
Contributor Author

mjauvin commented Aug 4, 2020

@LukeTowers it doesn't they are handled on their own (like CMS/Static pages translate their URL on their own for example)

@mjauvin mjauvin added this to the 1.7.3 milestone Aug 5, 2020
@mjauvin
Copy link
Contributor Author

mjauvin commented Aug 5, 2020

@LukeTowers @bennothommo, I am ready to merge this, it's been tested with and without the new related changes for RainLab.Pages. and does not cause problems.

Plugin.php Outdated Show resolved Hide resolved
Plugin.php Outdated Show resolved Hide resolved
classes/EventRegistry.php Outdated Show resolved Hide resolved
classes/EventRegistry.php Outdated Show resolved Hide resolved
traits/MLControl.php Outdated Show resolved Hide resolved
@LukeTowers LukeTowers changed the title make RainLab.Pages MenuItem translatable Add support for translating RainLab.Pages MenuItem properties Aug 5, 2020
traits/MLControl.php Outdated Show resolved Hide resolved
@LukeTowers
Copy link
Contributor

LGTM!

@mjauvin mjauvin requested a review from LukeTowers August 6, 2020 12:32
@mjauvin mjauvin merged commit 85026cb into rainlab:master Aug 6, 2020
@mjauvin mjauvin deleted the ml-menuitem branch August 6, 2020 12:35
@sagjatome
Copy link

I made an update today and now I see the option to translate Menu but I can not save the changes. How can it be?
Cache cleared.
Migrations checked
I tried to add new menu - the same problem.
I open it again to save one more time but the translations disappear from field.
https://youtu.be/CuOESmQPnsI

@mjauvin
Copy link
Contributor Author

mjauvin commented Oct 7, 2020

What version of RainLab.Pages plugin do you have? You need v1.3.6

@sagjatome
Copy link

What version of RainLab.Pages plugin do you have? You need v1.3.6

1.3.5 but i do not get any updates...

image

@mjauvin
Copy link
Contributor Author

mjauvin commented Oct 7, 2020 via email

@sagjatome
Copy link

image

Really, I do, Thanks I lot, mjauvin

image

You need to enable edgeUpdates => true in config/cms.php but since you have version 1.7.3 of the translate plugin, that should already be enabled...

On Wed, Oct 7, 2020 at 3:10 PM sagjatome @.***> wrote: What version of RainLab.Pages plugin do you have? You need v1.3.6 1.3.5 but i do not get any updates... [image: image] https://user-images.githubusercontent.com/59820668/95376473-6f208c80-08e1-11eb-8515-a6ce6ab299ba.png — You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <#590 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAPLTPTY4XWP3GI5XN53UEDSJS4JBANCNFSM4PS7N7ZA .
-- Marc

@zakir1929
Copy link

Thank you for adding this feature finally !!! Now menu item properties can be completely translated. Well done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants