Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

TranslatableDataObject as a replacement of Translatable


Reply


5 Posts   655 Views

Avatar
Marcinkonys

Community Member, 11 Posts

11 April 2013 at 5:38am

Hello SilverStripers,

I just have a simple question: can the TranslatableDataObject module be used as a replacement for the Translatable module?

I'm going to develop a website in two languages, and have tried Translatable in the past, but was wondering whether a multilingual site can be maintained using a single SiteTree.

Having not used DataObjects too much (actually, I don't think I created anything but Page subclasses in my previous SS project...), I was wondering whether I'll actually be able to translate different Page types somehow?

Thanks in advance,
Martin

Avatar
UncleCheese

Forum Moderator, 4094 Posts

12 April 2013 at 2:39pm

Yes, you can use them pretty much interchangeably, but keep in mind that the Translatable module is much more scalable and stable. TranslatableDataObject is good for translating DataObject content (obviously), and also for adding simple translation features to SiteTree page types.

Unlike Translatable, TranslatableDataObject creates translations in columns, not rows, so if you have lots of languages and objects with lots of translatable fields, you run into a real scalability problem.

Translatable module:
| ID | Title | Locale |
--------------------------
| 2 | Home | en_US |
| 3 | Acceuil | fr_FR |

TranslatableDataObject
| ID | Title | Title__fr_FR |
----------------------------------
| 2 | Home | Acceuil |

Avatar
UncleCheese

Forum Moderator, 4094 Posts

12 April 2013 at 2:41pm

It's also important to note that they're not mutually exclusive. I use them cooperatively on my i18n sites. Translatable for the SiteTree, and TranslatableDataObject for everything else.

Avatar
Marcinkonys

Community Member, 11 Posts

13 April 2013 at 4:44am

Thanks for the reply, UncleCheese. Could you give a really simple example of how you'd use them both in the same site? Just to get a better understanding. The main difference I see between the two is that Translatable allows translating Page object fields, and TranslatableDataObject does the same with DataObject fields, right?

Avatar
ayandyan

Community Member, 6 Posts

10 July 2013 at 6:14am

Hi UncleCheese,

You mentioned you're using the modules Translatable & TranslatableDataObject cooperatively on your site. I think I'm only left with this option at this point. May I ask what SS version you are using (3.0 or 3.1)?

I'm trying out the prelease version of SS 3.1 because the Translatable module (https://github.com/silverstripe/silverstripe-translatable#requirements) they released requires this version specifically and that the DataObject translation is in effect. I tested it and the SiteTree translation works (as it always had), but then again the DataObject translation still doesn't work. I'm just stuck with an unresponsive Create button for translating DataObjects with no errors in the console.

I hope you can enlighten me on this. Thanks much.

P.S.

Adding this line in the config file:

Object::add_extension('MyDataObject', 'Translatable');

brings up the Translations tab, but when I go in there the Create button doesn't do anything.