Proposal for Relations between Multi-Language items

jeroendesloovere's Avatar

jeroendesloovere

04 Oct, 2012 08:31 AM

This post is for people who build multi-language websites with multi-language modules.
Fork decided to separate page languages, but sometimes you just want modules to listen to items in another language. F.e.: a price that changes in one language, needs to be the same in the other languages.

What happens now is: you change the price in all languages (time-consuming).
Well, what would you say if I have a (simple) proposal to make this happen automatically...

Huh, is this even possible?
Yep, sure do, and its fairly easy to!

We add a new table relations (f.e) with some required fields: 'module', 'module_id', 'language', 'related_module', 'related_id', 'related_language', 'data'

Example: BLOG Module (small overview of what would be added in every model)

CLONE - read more about integrating clone in core, so all modules could use this

// in BackendBlogModel add following function
public static function insertRelations($module, $item, $cloneItem)
{
    // init relation item
    // set variables from $item and $cloneItem
    // insert in relations table
}

EDIT - after_edit event triggered

// in BackendBlogModel add following function
public static function updateRelations($data)
{
    // push the fields you want to be multi-language aware from the edited item to the related items.
}

DELETE - after_delete event triggered

// in BackendBlogModel add following function
public static function deleteRelations($data)
{
    // delete the relations for this item
}

We create a new "Relations module",
and check if the three functions are integrated in a module,
if so, you can add the modules you like to be "multi-language-aware". An easy install and de-install of the modules to be multi-language-aware...

I already implemented this in some (big) modules and it worked perfectly!
But I want it to be implemented in the Core, because it can do so much good in this world!

Advantages

  • table structures don't have to be changed

  • you use it, or not, that easy

  • you even can use it for related items in the same language, with some tweaks!!!

  • think what goodness this can do for prices in modules that have items in multiple languages (but want prices to be the same in every language).

Summary

We have tables for tags, meta, modules_settings, why not for relations?
A uniformed place for relations between multi-language items, with all code integrated in the module itself.

If you like, say Yay!
Comments?

  1. 1 Posted by waldo_cosman on 18 Oct, 2012 02:20 PM

    waldo_cosman's Avatar

    Yay! ;-)

  2. 2 Posted by jeroendesloover... on 31 Oct, 2012 10:29 AM

    jeroendesloovere's Avatar

    One YAY is awesome!

    I guess nobody else is interested in this feature
    or maby their all testing this shizzle out! What they should do!

  3. 3 Posted by waldo_cosman on 31 Oct, 2012 10:32 AM

    waldo_cosman's Avatar

    I can't imagine that i'm the only 'yay' here. When you have multi-language sites, it should save you some work to create a menu and other stuff (like blog, ..)

  4. 4 Posted by jeroendesloover... on 31 Oct, 2012 04:41 PM

    jeroendesloovere's Avatar

    Just talked again to a client that needs this kind of functionality!!!

    I will start working this out, YAY!

  5. Support Staff 5 Posted by tijs on 11 Nov, 2012 11:50 AM

    tijs's Avatar

    As told on IRC. Feel free to develop this on a public repo, it will enable people to comment on your work or even participate.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

11 Sep, 2019 09:58 AM
27 Jun, 2019 08:44 AM
18 Jun, 2019 05:37 PM
14 Jun, 2019 07:45 AM
02 Jun, 2019 03:33 PM

 

31 May, 2019 05:14 AM
10 Apr, 2019 10:27 AM
27 Mar, 2019 11:03 AM
26 Mar, 2019 08:10 PM
20 Mar, 2019 06:47 AM
12 Mar, 2019 12:19 AM