oc-menumanager-plugin icon indicating copy to clipboard operation
oc-menumanager-plugin copied to clipboard

Translatable external URL

Open matteotrubini opened this issue 6 years ago • 5 comments

CONTEXT: multilanguage website managed with Rainlab.Translate

NEEDS: menu items liked to external URL could have different href depending on current locale:

  • IT => google.it
  • ES => google.es

Simply add external_url and url to $translatable fields https://github.com/benfreke/oc-menumanager-plugin/blob/d7b9ccc53dc2d3dc2cefc2c5a91a106ba5587dec/models/Menu.php#L29 is not sufficient due to how internal/external URL values are saved (unique url attribute plus is_external flag).

Do you think you can support that?

In the meanwhile, the only workaround that I see is to use a CMS page to manage a "redirect router" somehow. Any other ideas?

matteotrubini avatar May 11 '18 11:05 matteotrubini

I had the same problem and to fix it I had to fork the plugin, add a field for internal_url and external_url and change the way the $this->url logic works. I don't think there are other ways around this issue. You have to have a field for both internal and external as far as I know.

osmanzeki avatar May 24 '18 18:05 osmanzeki

@osmanzeki do you have considered to place a PR with your changes?

matteotrubini avatar Jun 16 '18 10:06 matteotrubini

@matteotrubini I considered it but as things sometimes are I had a deadline to meet and did not attempt a backward compatible approach. As such I had to add columns and change the way the URL is handled overall. I'll see if I have time to attempt an api compatible PR when I have a minute to work on this.

osmanzeki avatar Jun 16 '18 20:06 osmanzeki

@osmanzeki got it, I've the same troubles 😄 @benfreke a migration that update the table schema and reorganize old data would be acceptable by your POV? It will ensure BC.

matteotrubini avatar Jun 18 '18 07:06 matteotrubini

@matteotrubini yes, as long as there is no breaking changes I'm ok

benfreke avatar Jun 19 '18 03:06 benfreke